Skip to content

[Request] Allow error handlers to be overridden #32

Closed
@akuzemchak

Description

@akuzemchak

There are certain cases where I think developers may want to override previously defined error handlers. For example, let's say I have my main app, and also a REST API. I may want to define a 404 handler for the main app that displays a page:

App::missing(function($e)
{
    return Response::make(View::make('errors.404'), 404);
});

If the request is to one of my API's routes though, I might want my 404s to do this:

App::missing(function($e)
{
    return Response::json([
        'error' => 'Method not found',
    ], 404);
});

From what I can tell, there is no way to override the default 404 handler if the request is to an API route. This was possible in L3 with Event::override() and it would be awesome to get an equivalent in L4.

Thanks for the consideration!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions