Documentation ¶
Index ¶
- func SetDefaultReportErrorFunc(fn ReportErrorFunc)
- type HTTPError
- func BadRequest(msg string, originalErr error, extras map[string]interface{}) *HTTPError
- func Conflict(msg string, originalErr error, extras map[string]interface{}) *HTTPError
- func Forbidden(msg string, originalErr error, extras map[string]interface{}) *HTTPError
- func InternalError(ctx context.Context, msg string, originalErr error, ...) *HTTPError
- func NewHTTPError(statusCode int, msg string, originalErr error, extras map[string]interface{}) *HTTPError
- func NotFound(msg string, originalErr error, extras map[string]interface{}) *HTTPError
- func Unauthorized(msg string, originalErr error, extras map[string]interface{}) *HTTPError
- func UnprocessableEntity(msg string, originalErr error, extras map[string]interface{}) *HTTPError
- type ReportError
- type ReportErrorFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDefaultReportErrorFunc ¶
func SetDefaultReportErrorFunc(fn ReportErrorFunc)
SetDefaultReportErrorFunc sets a new defaultReportErrorFunc to report unexpected errors.
Types ¶
type HTTPError ¶
type HTTPError struct { StatusCode int `json:"-"` Message string `json:"error"` // Extras contains extra information about the error. Extras map[string]interface{} `json:"extras,omitempty"` // Err is an optional field that can be used to wrap the original error to pass it forward. Err error `json:"-"` }
func BadRequest ¶
func InternalError ¶
func NewHTTPError ¶
func Unauthorized ¶
func UnprocessableEntity ¶
func (*HTTPError) Render ¶
func (e *HTTPError) Render(w http.ResponseWriter)
type ReportError ¶
type ReportError struct {
// contains filtered or unexported fields
}
ReportError is a struct type used to report unexpected errors.
Click to show internal directories.
Click to hide internal directories.