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

Not found error handler #134

Open
DreamTexX opened this issue Jul 26, 2021 · 2 comments
Open

Not found error handler #134

DreamTexX opened this issue Jul 26, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@DreamTexX
Copy link

Is it possible to customize the not found error handler? Or an error handler in generell?

@DreamTexX
Copy link
Author

Okay got it working with Application#pre()

app.pre((next: HandlerFunc) => (context: Context) => {
  try {
    return next(context);
  } catch (error) {
    // ... custom error logic
  }
});

But if possible it would be cool to set custom error handlers per group with Group#errorHandler() or something like this, including 404 errors

@zhmushan
Copy link
Owner

zhmushan commented Aug 1, 2021

@DreamTexX Sorry for being late, ideally we can customize the error logic through the following code, but obviously we can't now, I am pretty sure this is a Bug🤣

app.group("/user", next => c => {
  try {
    return next(c);
  } catch {
    // ... custom error logic
  }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants