2022-05-05 01:46:15 +02:00
|
|
|
package errors
|
|
|
|
|
|
|
|
import "github.com/kataras/iris/v12/context"
|
|
|
|
|
|
|
|
// DefaultContextErrorHandler returns a context error handler
|
2024-01-10 21:17:58 +01:00
|
|
|
// which calls the HandleError on any incoming error when
|
2022-05-05 01:46:15 +02:00
|
|
|
// a rich rest response failed to be written to the client.
|
|
|
|
// Register it on Application.SetContextErrorHandler method.
|
|
|
|
var DefaultContextErrorHandler context.ErrorHandler = new(jsonErrorHandler)
|
|
|
|
|
|
|
|
type jsonErrorHandler struct{}
|
|
|
|
|
|
|
|
// HandleContextError completes the context.ErrorHandler interface. It's fired on
|
|
|
|
// rich rest response failures.
|
|
|
|
func (e *jsonErrorHandler) HandleContextError(ctx *context.Context, err error) {
|
2024-01-10 21:17:58 +01:00
|
|
|
HandleError(ctx, err)
|
2022-05-05 01:46:15 +02:00
|
|
|
}
|