blob: 416d578e7356ae5074816d1e218bbb824dfb3754 (
plain) (
tree)
|
|
package mux
import (
"context"
"encoding/json"
"io"
)
var DefaultErrorHandler func(err error) Renderer = func(err error) Renderer {
return RendererFunc(func(ctx context.Context, w io.Writer) error {
return json.NewEncoder(w).Encode(errorStruct{
Message: err.Error(),
})
})
}
type errorStruct struct {
Message string `json:"message"`
}
|