@@ -26,7 +26,7 @@ import (
26
26
)
27
27
28
28
// Version of current package
29
- const Version = "1.10.4 "
29
+ const Version = "1.10.5 "
30
30
31
31
// Map is a shortcut for map[string]interface{}, useful for JSON returns
32
32
type Map map [string ]interface {}
@@ -49,6 +49,14 @@ type App struct {
49
49
50
50
// Settings holds is a struct holding the server settings
51
51
type Settings struct {
52
+ // Possible feature for v1.11.x
53
+ // // ErrorHandler is executed when you pass an error in the Next(err) method
54
+ // // This function is also executed when a panic occurs somewhere in the stack
55
+ // // Default: func(err error, ctx *fiber.Ctx) {
56
+ // // ctx.Status(500).Send(err.Error())
57
+ // // }
58
+ // ErrorHandler func(*Ctx, error)
59
+
52
60
// Enables the "Server: value" HTTP header.
53
61
// Default: ""
54
62
ServerHeader string
@@ -181,6 +189,10 @@ func New(settings ...*Settings) *App {
181
189
Prefork : utils .GetArgument ("-prefork" ),
182
190
BodyLimit : 4 * 1024 * 1024 ,
183
191
Concurrency : 256 * 1024 ,
192
+ // Possible feature for v1.11.x
193
+ // ErrorHandler: func(ctx *Ctx, err error) {
194
+ // ctx.Status(500).SendString(err.Error())
195
+ // },
184
196
},
185
197
}
186
198
// Overwrite settings if provided
@@ -200,6 +212,12 @@ func New(settings ...*Settings) *App {
200
212
getBytes = getBytesImmutable
201
213
getString = getStringImmutable
202
214
}
215
+ // Possible feature for v1.11.x
216
+ // if app.Settings.ErrorHandler == nil {
217
+ // app.Settings.ErrorHandler = func(ctx *Ctx, err error) {
218
+ // ctx.Status(500).SendString(err.Error())
219
+ // }
220
+ // }
203
221
}
204
222
// Initialize app
205
223
return app .init ()
@@ -491,6 +509,10 @@ func (app *App) init() *App {
491
509
Logger : & disableLogger {},
492
510
LogAllErrors : false ,
493
511
ErrorHandler : func (fctx * fasthttp.RequestCtx , err error ) {
512
+ // Possible feature for v1.11.x
513
+ // ctx := app.AcquireCtx(fctx)
514
+ // app.Settings.ErrorHandler(ctx, err)
515
+ // app.ReleaseCtx(ctx)
494
516
if _ , ok := err .(* fasthttp.ErrSmallBuffer ); ok {
495
517
fctx .Response .SetStatusCode (StatusRequestHeaderFieldsTooLarge )
496
518
fctx .Response .SetBodyString ("Request Header Fields Too Large" )
0 commit comments