Documentation ¶
Index ¶
Constants ¶
const ( // CannotBeBlank indicates a field that was submitted blank, but is required CannotBeBlank = "cannot-be-blank" // ValidationError indicates that a validation rule such as min / max value was violated ValidationError = "validation-error" // MethodNotAllowed indicates that the attempted VERB is not implemented for that endpoint MethodNotAllowed = "method-not-allowed" // MalformedURL indicates that the URL was not parsable as input MalformedURL = "malformed-url" // InvalidRoute indicates that the route does not exist InvalidRoute = "invalid-route" // AuthenticationFailed indicates that authentication did not complete successfully AuthenticationFailed = "authentication-failed" // NotAuthorized indicates that the currently authenticated user is not // permitted to perform an action NotAuthorized = "not-authorized" // SystemError indicates that a systemic issue has occurred with the request SystemError = "system-error" // NotFound indicates that the requested resource was not found NotFound = "not-found" // AlreadyExists indicates that the requested resource already exist AlreadyExists = "already-exists" )
Variables ¶
This section is empty.
Functions ¶
func NewNotAuthenticatedError ¶
func NewNotAuthenticatedError() errors.TracerError
NewNotAuthenticatedError instantiates a NotAuthenticatedError with a stack trace
func NewNotFoundError ¶
func NewNotFoundError() errors.TracerError
NewNotFoundError instantiates a NotFoundError with a stack trace
func TranslateError ¶
func TranslateError(container RestErrorContainer, err error)
TranslateError from an ErrorMessage to a RestError and set it on a ErrorContainer
Types ¶
type FieldError ¶
type FieldError struct { Code string `json:"code"` Message string `json:"message"` Field string `json:"field"` }
FieldError represents a validation error related to a specific input field
func NewFieldError ¶
func NewFieldError(code, message, field string) *FieldError
NewFieldError instantiates a FieldError
func (*FieldError) Error ¶ added in v1.2.1
func (err *FieldError) Error() string
type NotAuthenticatedError ¶
type NotAuthenticatedError struct {
// contains filtered or unexported fields
}
NotAuthenticatedError is returned for a failed login attempt
func (*NotAuthenticatedError) Error ¶
func (err *NotAuthenticatedError) Error() string
func (*NotAuthenticatedError) Trace ¶
func (err *NotAuthenticatedError) Trace() []string
Trace returns the stack trace for the error
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError is returned when the requested resource isn't found
func (*NotFoundError) Error ¶
func (err *NotFoundError) Error() string
func (*NotFoundError) Trace ¶
func (err *NotFoundError) Trace() []string
Trace returns the stack trace for the error
type RestError ¶
type RestError struct { Code string `json:"code"` Message string `json:"message"` Details []interface{} `json:"details"` }
RestError represents the standard error returned by the API Gateway
func NewRestError ¶
NewRestError instantiates a RestError
type RestErrorContainer ¶
RestErrorContainer holds a RestError