errors

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: NCSA Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiError

type ApiError struct {
	Status   int    `json:"status"`
	Type     string `json:"type"`
	Message  string `json:"message"`
	RawError string `json:"raw_error,omitempty"`
}

* * Status - the HTTP error code to be sent to the client - should be set by constructor * Type - the broad category - e.g. DatabaseError, AuthorizationError, InternalError * Message - provides additional details on the specific error that occurred. * RawError - the raw error (stringified) that caused the panic. It is only included in the response * to the client, if the config variable DEBUG_MODE is set to true. In other cases, the * field is set to the empty string, which causes its omission when encoded to JSON. *

func AttributeMismatchError

func AttributeMismatchError(raw_error string, message string) ApiError

Used when the user attempts to perform an action that is not permitted as part of the flow. E.g. Attempting to check-in without having RSVPed.

func AuthorizationError

func AuthorizationError(raw_error string, message string) ApiError

An error that occurs when an incoming request comes without a JWT token in the Authorization header.

func DatabaseError

func DatabaseError(raw_error string, message string) ApiError

An error that occurs when a database operation (e.g. fetch / insert / update) doesn't work.

func InternalError

func InternalError(raw_error string, message string) ApiError

Represents errors in the system, including failures in inter-service API calls. If there are multiple possible sources of an error, we use this error.

func MalformedRequestError

func MalformedRequestError(raw_error string, message string) ApiError

An error for when struct validation fails, or there are other issues with the payload to an endpoint.

func UnknownError

func UnknownError(raw_error string, message string) ApiError

Represents errors in the system whose cause is unidentified.

Jump to

Keyboard shortcuts

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