Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NotFound = Error{ Code: "not_found", Status: http.StatusNotFound, Message: "Resource not found", } Conflict = Error{ Code: "conflict", Status: http.StatusConflict, Message: "A conflicting state exists", } Forbidden = Error{ Code: "forbidden", Status: http.StatusForbidden, Message: "You are not authorized", } Throttled = Error{ Code: "throttled", Status: http.StatusTooManyRequests, Message: "You are doing way too much", } MissingAuth = Error{ Code: "missing_auth", Status: http.StatusUnauthorized, Message: "You are not authenticated", } Unsupported = Error{ Code: "unsupported", Status: http.StatusUnprocessableEntity, Message: "Requested action is not supported", } InvalidInput = Error{ Code: "invalid_input", Status: http.StatusBadRequest, Message: "Your request is not valid", } InternalIssue = Error{ Code: "internal_issue", Status: http.StatusInternalServerError, Message: "Oops, something went wrong", } )
Functions ¶
Types ¶
type Error ¶
type Error struct { Code string `json:"code"` Cause error `json:"cause,omitempty"` Status int `json:"status"` Attribs map[string]any `json:"attribs,omitempty"` Message string `json:"message"` DebugHint string `json:"debug_hint,omitempty"` }
Error represents an error value with all the relevant context.
func (Error) Is ¶
Is checks if 'other' is of type Error and has the same code. See https://blog.golang.org/go1.13-errors.
Click to show internal directories.
Click to hide internal directories.