Skip to content

Add a way to ignore app-specific exceptions #114

@marcuspoehls

Description

@marcuspoehls

The exception handler provides the ignoreExceptions attribute with pre-defined exceptions: https://github.com/adonisjs/http-server/blob/7.x/src/exception_handler.ts#L64-L69

  protected ignoreExceptions: any[] = [
    errors.E_HTTP_EXCEPTION,
    errors.E_ROUTE_NOT_FOUND,
    errors.E_CANNOT_LOOKUP_ROUTE,
    errors.E_HTTP_REQUEST_ABORTED,
  ]

There’s currently no way to define user-land exceptions that can be ignored. I’m not seeing how I could reuse the ignoreExceptions property and keep the default values assigned, plus adding my own ones.

That’s why I’m suggesting adding a property that can be used for app-specific exceptions.

I’m currently using the ignoreCodes property, which has no default values. But as soon as the framework adds default values here too, I’m in the same situation as above. Also, I can’t ignore an exception by code if an exception doesn’t provide a static code attribute.

Maybe there’s already a way to do what I’m asking for 🙂 if there is, please point me to it

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions