error

package
v0.0.0-...-884b279 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2018 License: MIT Imports: 1 Imported by: 3

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	// 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"
)

Variables

This section is empty.

Functions

This section is empty.

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

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

func NewRestError(code string, message string, details []interface{}) *RestError

NewRestError instantiates a RestError

func (*RestError) AddDetail

func (restError *RestError) AddDetail(errorDetail interface{})

AddDetail adds a detail such as a FieldError to an Error response

func (*RestError) Error

func (restError *RestError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL