Throw better Exceptions
This commit is contained in:
@@ -39,7 +39,7 @@ abstract class Controller {
|
||||
{
|
||||
if (strpos($destination, '@') === false)
|
||||
{
|
||||
throw new \Exception("Route delegate [{$destination}] has an invalid format.");
|
||||
throw new \InvalidArgumentException("Route delegate [{$destination}] has an invalid format.");
|
||||
}
|
||||
|
||||
list($controller, $method) = explode('@', $destination);
|
||||
@@ -226,7 +226,7 @@ abstract class Controller {
|
||||
return IoC::resolve($key);
|
||||
}
|
||||
|
||||
throw new \Exception("Attempting to access undefined property [$key] on controller.");
|
||||
throw new \OutOfBoundsException("Attempting to access undefined property [$key] on controller.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class Route {
|
||||
|
||||
if ( ! $callback instanceof Closure and ! is_array($callback) and ! is_string($callback))
|
||||
{
|
||||
throw new \Exception('Invalid route defined for URI ['.$this->key.']');
|
||||
throw new \InvalidArgumentException('Invalid route defined for URI ['.$this->key.']');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ class Route {
|
||||
return $this->is(substr($method, 3));
|
||||
}
|
||||
|
||||
throw new \Exception("Call to undefined method [$method] on Route class.");
|
||||
throw new \BadMethodCallException("Call to undefined method [$method] on Route class.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user