Closed martenb closed 3 years ago
I get it why you need it. What about to create some DispatchException(original, request)? It could be more extendable.
You mean something like this?
IErrorHandler::handle(Throwable $error, DispatchException $exception)
So close, IErrorHandler::handle(DispatchException $e)
, $e->getError()
, $e->getRequest()
.
Ok, and DispatchException
not implements Throwable
, just simple object?
Hmmmm, good point. If it ends with Exception
it should implement it. Otherwise we can rename it to DispatchError and thus it will be simple. It's up to you.
Done
@f3l1x are we including this in v0.7?
Yep, it will be in 0.7.
Is there a reason to not pass ApiRequest to ErrorHandler?
I have two use cases, where i need ApiRequest in ErrorHandler 1) log the request on error 2) cors: i need the request to correctly setup Access-Control-Allow-Origin