blob: f85174e89e7779689c58467a4e0ef0f56dc3489c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
package mux
import (
"context"
"encoding/json"
"net/http"
)
var DefaultErrorHandler func(err error) Renderer = func(err error) Renderer {
return RendererFunc(func(ctx context.Context, w http.ResponseWriter) error {
return json.NewEncoder(w).Encode(errorStruct{
Message: err.Error(),
})
})
}
type errorStruct struct {
Message string `json:"message"`
}
|