ecode

package
v0.0.0-...-51d629d Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2016 License: BSD-3-Clause, BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

GUS uses common errors throughout rather than scattering error codes throughout the system. When adding new drivers or new portions to the system, it is advised that you use these messages, where possible. This will make the client code easier to maintain

All messages have a common format: a code and a message string. The codes give a general type of response while the messages give a detailed error. All codes have been taken from standard http codes when possible.

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyOpen = NewGeneralError("Storage driver already open", http.StatusBadRequest)
View Source
var ErrAlreadyRegistered = NewGeneralError("Storage driver already registered", http.StatusInternalServerError)
View Source
var ErrBadBody = NewGeneralError("Package: Cannot unarshal body", http.StatusBadRequest)
View Source
var ErrBadPackage = NewGeneralError("Package: Bad format", http.StatusBadRequest)
View Source
var ErrCannotSetId = NewGeneralError("User id cannot be set", http.StatusBadRequest)
View Source
var ErrDuplicateEmail = NewGeneralError("Email address already registered", http.StatusConflict)
View Source
var ErrDuplicateGuid = NewGeneralError("User GUID already in use", http.StatusInternalServerError)
View Source
var ErrDuplicateLogin = NewGeneralError("Login name already exists", http.StatusConflict)
View Source
var ErrEmptyFieldForLookup = NewGeneralError("Lookup field is empty", http.StatusBadRequest)
View Source
var ErrHeadExpired = NewGeneralError("Head: Request expired", http.StatusBadRequest)
View Source
var ErrHeadFuture = NewGeneralError("Head: Request in the future", http.StatusBadRequest)
View Source
var ErrHeadNoDomain = NewGeneralError("Head: No domain", http.StatusBadRequest)
View Source
var ErrHeadNoId = NewGeneralError("Head: No Id", http.StatusBadRequest)
View Source
var ErrHeadNoTimestamp = NewGeneralError("Head: No timestamp set", http.StatusBadRequest)
View Source
var ErrInternalDatabase = NewGeneralError("Internal storage error while executing operation", http.StatusInternalServerError)
View Source
var ErrInvalidBody = NewGeneralError("Invalid body (mistmatch request?)", http.StatusBadRequest)
View Source
var ErrInvalidChecksum = NewGeneralError("Invalid Checksum", http.StatusBadRequest)
View Source
var ErrInvalidEmail = NewGeneralError("Invalid email for lookup", http.StatusNotFound)
View Source
var ErrInvalidGuid = NewGeneralError("Invalid Guid for lookup", http.StatusNotFound)
View Source
var ErrInvalidHeader = NewGeneralError("Invalid header in request", http.StatusBadRequest)

Storage Errors

View Source
var ErrInvalidPasswordOrUser = NewGeneralError("Invalid password or user id", http.StatusBadRequest)
View Source
var ErrInvalidToken = NewGeneralError("Invalid token for lookup", http.StatusNotFound)
View Source
var ErrMatchAnyNotSupported = NewGeneralError("Storage driver does not support 'MatchAnyDomain' for fetch operation", http.StatusInternalServerError)
View Source
var ErrMatchingPassword = NewGeneralError("Request: Old and new passwords match", http.StatusBadRequest)
View Source
var ErrMissingEmail = NewGeneralError("Request: Missing Email", http.StatusBadRequest)
View Source
var ErrMissingLogin = NewGeneralError("Request: Missing login", http.StatusBadRequest)
View Source
var ErrMissingName = NewGeneralError("Request: Missing Name", http.StatusBadRequest)
View Source
var ErrMissingPassword = NewGeneralError("Request: Missing Password", http.StatusBadRequest)
View Source
var ErrMissingPasswordNew = NewGeneralError("Request: Missing New Password", http.StatusBadRequest)
View Source
var ErrMissingToken = NewGeneralError("Request: Missing token", http.StatusBadRequest)
View Source
var ErrNoDriverFound = NewGeneralError("No storage driver found", http.StatusInternalServerError)
View Source
var ErrNoSupport = NewGeneralError("Storage driver does not support function call", http.StatusNotImplemented)
View Source
var ErrNotOpen = NewGeneralError("Storage driver is not open", http.StatusInternalServerError)
View Source
var ErrPasswordTooShort = NewGeneralError("Request: Password is too short", http.StatusBadRequest)
View Source
var ErrPasswordTooSimple = NewGeneralError("Password is too simple", http.StatusBadRequest)
View Source
var ErrRequestExpired = NewGeneralError("Request: Request expired", http.StatusBadRequest)
View Source
var ErrRequestFuture = NewGeneralError("Request: Request in the future", http.StatusBadRequest)
View Source
var ErrRequestNoTimestamp = NewGeneralError("Request: No timestamp set", http.StatusBadRequest)
View Source
var ErrSessionExpired = NewGeneralError("User session expired", http.StatusUnauthorized)
View Source
var ErrShortGuid = NewGeneralError("GUID must be at least 32 characters long", http.StatusInternalServerError)
View Source
var ErrStatusOk = NewGeneralError("", http.StatusOK)
View Source
var ErrUserLoggedIn = NewGeneralError("User already logged in", http.StatusBadRequest)
View Source
var ErrUserNotActive = NewGeneralError("User is not yet activated", http.StatusUnauthorized)
View Source
var ErrUserNotFound = NewGeneralError("User not found", http.StatusNotFound)
View Source
var ErrUserNotLoggedIn = NewGeneralError("User not logged in", http.StatusBadRequest)
View Source
var ErrUserNotRegistered = NewGeneralError("User not registered", http.StatusBadRequest)

Functions

This section is empty.

Types

type ErrorCoder

type ErrorCoder interface {
	Error() string
	Code() int
}

The ErrorCoder builds on the standard error definition. All functions return error, but the additional information can be retrieved with a simple cast.

func NewGeneralError

func NewGeneralError(msg string, code int) ErrorCoder

Create a new GeneralError from a string and an integer

func NewGeneralFromError

func NewGeneralFromError(e error, code int) ErrorCoder

Create a new Generalerror from a regular 'error' type and an integer

type GeneralError

type GeneralError struct {
	Message    string
	ReturnCode int
}

General Error structure holds both an error string and an error code.

func (*GeneralError) Code

func (s *GeneralError) Code() int

return the error integer.

func (*GeneralError) Error

func (s *GeneralError) Error() string

Return the error message

Jump to

Keyboard shortcuts

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