Skip to content

Commit

Permalink
more readable exception messages
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Apr 7, 2014
1 parent 21b2a8b commit c04ee80
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ComponentModel/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function addComponent(IComponent $component, $name, $insertBefore = NULL)
$name = (string) $name;

} elseif (!is_string($name)) {
throw new Nette\InvalidArgumentException("Component name must be integer or string, " . gettype($name) . " given.");
throw new Nette\InvalidArgumentException(sprintf('Component name must be integer or string, %s given.', gettype($name)));

} elseif (!preg_match('#^[a-zA-Z0-9_]+\z#', $name)) {
throw new Nette\InvalidArgumentException("Component name must be non-empty alphanumeric string, '$name' given.");
Expand Down Expand Up @@ -120,7 +120,7 @@ public function getComponent($name, $need = TRUE)
$name = (string) $name;

} elseif (!is_string($name)) {
throw new Nette\InvalidArgumentException("Component name must be integer or string, " . gettype($name) . " given.");
throw new Nette\InvalidArgumentException(sprintf('Component name must be integer or string, %s given.', gettype($name)));

} else {
$a = strpos($name, self::NAME_SEPARATOR);
Expand All @@ -131,7 +131,7 @@ public function getComponent($name, $need = TRUE)

if ($name === '') {
if ($need) {
throw new Nette\InvalidArgumentException("Component or subcomponent name must not be empty string.");
throw new Nette\InvalidArgumentException('Component or subcomponent name must not be empty string.');
}
return;
}
Expand Down

0 comments on commit c04ee80

Please sign in to comment.