fiber
fiber copied to clipboard
📝 [Proposal]: Upgrade fiber.NewError() for error handle
Feature Proposal Description
i want use Custom ErrorHandler to handle my error, but now fiber.NewError() has missed my message params
for example i want use fiber.NewError like this:
return fiber.NewError(45001, "my error message", 401)
on fiber.NewError() will missed my params : 401
can you change the Error and NewError() like this:
i will handle the error in my Custom ErrorHandler:
Alignment with Express API
nothing
HTTP RFC Standards Compliance
nothing
API Stability
nothing
Feature Examples
nothing
Checklist:
- [X] I agree to follow Fiber's Code of Conduct.
- [X] I have searched for existing issues that describe my proposal before opening this one.
- [X] I understand that a proposal that does not meet these guidelines may be closed without explanation.
Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord
@pwtitle hi, i think you have a very specific problem that does not match the requirements of other consumers
the fiber.Error struct is public and you can fill it without the NewError method
I'm not sure if this should be considered at all. this is fixable by creating a custom error implementing the error interface and returning it at every error occurrence if I'm not mistaken. The error handler doesn't exactly needs it to be a fiber.Error struct, it only needs the error to be compliant with the error interface.
I could be wrong about this, but from what I've gathered reading the ErrorHandler config parameters, this is what I could understand.
right, so I think this requirement is too specific for a special case and can already be handled well with custom errors