thephpleague / route

Fast PSR-7 based routing and dispatch component including PSR-15 middleware, built on top of FastRoute.
http://route.thephpleague.com
MIT License
651 stars 126 forks source link

HttpExceptionInterface not extending Throwable #284

Closed alanondra closed 4 years ago

alanondra commented 4 years ago

Since HttpExceptionInterface does not extend Throwable, this actually renders any type-checking requiring Throwable for input as incorrect.

For instance \League\Route\Strategy\ApplicationStrategy::throwThrowableMiddleware() creates an anonymous middleware that is written to handle HttpExceptionInterface but expect Throwable.

philipobenito commented 4 years ago

The HTTP exceptions are only handled by the JsonStrategy as an easy way to build a JSON response.

If you'd like to use them in a standard application, you could create a custom strategy with custom exceptions.