Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api errors need a class #194

Open
Daanra opened this issue Jun 28, 2018 · 0 comments
Open

Api errors need a class #194

Daanra opened this issue Jun 28, 2018 · 0 comments
Assignees

Comments

@Daanra
Copy link
Collaborator

Daanra commented Jun 28, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants