Permalink
Browse files

Component: More informative message in case that name is not available (

  • Loading branch information...
mabar authored and dg committed Jan 4, 2019
1 parent d77f3fc commit 89dd693ecef2a7d1f2c571dfecc575c1ce3e417f
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/ComponentModel/Component.php
@@ -66,7 +66,10 @@
}
if ($throw && $this->monitors[$type][0] === null) {
throw new Nette\InvalidStateException("Component '$this->name' is not attached to '$type'.");
$message = $this->name !== null
? "Component '$this->name' is not attached to '$type'."
: "Component of type '" . static::class . "' is not attached to '$type'.";
throw new Nette\InvalidStateException($message);
}
return $this->monitors[$type][0];

0 comments on commit 89dd693

Please sign in to comment.