Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions atreugo.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func newFasthttpServer(cfg Config) *fasthttp.Server {
CloseOnShutdown: cfg.CloseOnShutdown,
StreamRequestBody: cfg.StreamRequestBody,
ConnState: cfg.ConnState,
ErrorHandler: cfg.ErrorHandler,
Logger: cfg.Logger,
TLSConfig: cfg.TLSConfig,
FormValueFunc: cfg.FormValueFunc,
Expand Down
11 changes: 11 additions & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,17 @@ type Config struct { // nolint:maligned
// JSONMarshalFunc is used to marshal the response body to writer as JSON.
JSONMarshalFunc JSONMarshalFunc

// ErrorHandler for returning a response in case of an error while receiving or parsing the request.
//
// The following is a non-exhaustive list of errors that can be expected as argument:
// * io.EOF
// * io.ErrUnexpectedEOF
// * ErrGetOnly
// * ErrSmallBuffer
// * ErrBodyTooLarge
// * ErrBrokenChunks
ErrorHandler func(ctx *fasthttp.RequestCtx, err error)

// Configurable view which is called when no matching route is
// found. If it is not set, http.NotFound is used.
NotFoundView View
Expand Down
Loading