folded-php / exception

Various kind of exception to throw for your web app.

Home Page:https://packagist.org/packages/folded/exception

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add RouteNotFoundException

khalyomede opened this issue · comments

Description

In the context of a router, the user can add a name to a route, and redirect the end user using a route name.

If this name is not found, I would like to raise a meaningful related exception.

Expected behavior

To be able to use RouteNotFoundException as following:

use Folded\Exceptions\RouteNotFoundException;

try {
  throw (new RouteNotFoundException("route foo not found"))->setRoute("foo");
} catch (RouteNotFoundException $exception) {
  echo "route {$exception->getRoute()} not found";
}

Actual behavior

No exception related to route not found usable.

Alternatives solutions

I am using OutOfRangeException for the moment.

Notes