Skip to content

Api errors need a class #194

@Daanra

Description

@Daanra

The below snippet is copied from a comment on the PR: #191 that was not resolved yet.

If I am not mistaken, we could create our own error, such as ApiError and throw these in our endpoints.

Then, it should be automatically passed to an error handler. So instead of doing

err.shouldReload = true;
err.status = 400;
next(err);

We could do something like:
throw new ApiError()
and then we handle it in an error handler.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions