✨ v3 (feature): use any as default Message type of Error struct#1925
✨ v3 (feature): use any as default Message type of Error struct#1925ReneWerner87 merged 4 commits intov3-betafrom
Conversation
|
On a side note for the v3 fiber func SendError(c *fiber.Ctx, code int, message string) error {
c.Status(code)
return c.JSON(fiber.NewError(code, message))
}Instead a method could simply be defined as: func (c *Ctx) SendError(err Error) error {
c.Status(err.Code)
return c.JSON(err)
} |
I don't think it's good idea to add SendError method into the context. Because some people may want to just send error message instead of Error struct. It's very specific. Probably this PR will be helpful for your use case: #1928 |
closes #1825