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
Support for sub fiber's error handlers #1560
Support for sub fiber's error handlers #1560
Conversation
- Mounted fiber and its sub apps error handlers are now saved a new errorHandlers map in App - New public App.ErrorHandler method that wraps the logic for which error handler to user on any given context - Error handler match logic based on request path <=> prefix accuracy - Typo fixes - Tests
Thanks for opening this pull request! 🎉 Please check out our contributing guidelines. If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
thanks for the code @josebalius can you add some documentation for the new feature in our documentation repository https://github.com/gofiber/docs |
@ReneWerner87 sure thing. Is https://github.com/gofiber/docs/blob/master/api/fiber.md the best place to add these docs? I am thinking of expanding on the |
sounds good |
Here is docs PR: gofiber/docs#204 |
@ReneWerner87 is there something else I should do to get these PRs merged? |
No, its okay for now |
Congrats on merging your first pull request! 🎉 We here at Fiber are proud of you! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
Please provide enough information so that others can review your pull request:
Closes #1438
It captures the mounted fiber's configured error handlers and of that fiber's subapps (it's recursive by nature). It is then searched by matching request path to prefix to find the best match. I figured there shouldn't be "that many" sub error handlers even in a large app, however, if this is the wrong assumption we will need a better data structure, something close to what the router does, to be honest. I opted to keep it simple and not over engineer it.
This is a submission for #hacktoberfest !
Explain the details for making this change. What existing problem does the pull request solve?
App.errorHandlers
mapApp.ErrorHandler
method that wraps the logic for which error handler to use on any given contextCommit formatting
✨
Use emojis on commit messages so it provides an easy way of identifying the purpose or intention of a commit. Check out the emoji cheatsheet here: https://gitmoji.carloscuesta.me/