oauth2/server/error.go

21 lines
412 B
Go

package server
import (
"encoding/json"
"somehole.com/service/router"
)
type ErrorHandler struct {
router.DefaultError
}
func (*ErrorHandler) ErrorResponse(errorResponse router.ErrorResponse) router.ErrorResponse {
return &ErrorHandler{errorResponse.(router.DefaultError)}
}
func (e *ErrorHandler) BodyBytes() (body []byte) {
body, _ = json.Marshal(struct{ Error string }{Error: e.String()})
return
}