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 ¶
var ErrAlreadyOpen = NewGeneralError("Storage driver already open", http.StatusBadRequest)
var ErrAlreadyRegistered = NewGeneralError("Storage driver already registered", http.StatusInternalServerError)
var ErrBadBody = NewGeneralError("Package: Cannot unarshal body", http.StatusBadRequest)
var ErrBadPackage = NewGeneralError("Package: Bad format", http.StatusBadRequest)
var ErrCannotSetId = NewGeneralError("User id cannot be set", http.StatusBadRequest)
var ErrDuplicateEmail = NewGeneralError("Email address already registered", http.StatusConflict)
var ErrDuplicateGuid = NewGeneralError("User GUID already in use", http.StatusInternalServerError)
var ErrDuplicateLogin = NewGeneralError("Login name already exists", http.StatusConflict)
var ErrEmptyFieldForLookup = NewGeneralError("Lookup field is empty", http.StatusBadRequest)
var ErrHeadExpired = NewGeneralError("Head: Request expired", http.StatusBadRequest)
var ErrHeadFuture = NewGeneralError("Head: Request in the future", http.StatusBadRequest)
var ErrHeadNoDomain = NewGeneralError("Head: No domain", http.StatusBadRequest)
var ErrHeadNoId = NewGeneralError("Head: No Id", http.StatusBadRequest)
var ErrHeadNoTimestamp = NewGeneralError("Head: No timestamp set", http.StatusBadRequest)
var ErrInternalDatabase = NewGeneralError("Internal storage error while executing operation", http.StatusInternalServerError)
var ErrInvalidBody = NewGeneralError("Invalid body (mistmatch request?)", http.StatusBadRequest)
var ErrInvalidChecksum = NewGeneralError("Invalid Checksum", http.StatusBadRequest)
var ErrInvalidEmail = NewGeneralError("Invalid email for lookup", http.StatusNotFound)
var ErrInvalidGuid = NewGeneralError("Invalid Guid for lookup", http.StatusNotFound)
var ErrInvalidHeader = NewGeneralError("Invalid header in request", http.StatusBadRequest)
Storage Errors
var ErrInvalidPasswordOrUser = NewGeneralError("Invalid password or user id", http.StatusBadRequest)
var ErrInvalidToken = NewGeneralError("Invalid token for lookup", http.StatusNotFound)
var ErrMatchAnyNotSupported = NewGeneralError("Storage driver does not support 'MatchAnyDomain' for fetch operation", http.StatusInternalServerError)
var ErrMatchingPassword = NewGeneralError("Request: Old and new passwords match", http.StatusBadRequest)
var ErrMissingEmail = NewGeneralError("Request: Missing Email", http.StatusBadRequest)
var ErrMissingLogin = NewGeneralError("Request: Missing login", http.StatusBadRequest)
var ErrMissingName = NewGeneralError("Request: Missing Name", http.StatusBadRequest)
var ErrMissingPassword = NewGeneralError("Request: Missing Password", http.StatusBadRequest)
var ErrMissingPasswordNew = NewGeneralError("Request: Missing New Password", http.StatusBadRequest)
var ErrMissingToken = NewGeneralError("Request: Missing token", http.StatusBadRequest)
var ErrNoDriverFound = NewGeneralError("No storage driver found", http.StatusInternalServerError)
var ErrNoSupport = NewGeneralError("Storage driver does not support function call", http.StatusNotImplemented)
var ErrNotOpen = NewGeneralError("Storage driver is not open", http.StatusInternalServerError)
var ErrPasswordTooShort = NewGeneralError("Request: Password is too short", http.StatusBadRequest)
var ErrPasswordTooSimple = NewGeneralError("Password is too simple", http.StatusBadRequest)
var ErrRequestExpired = NewGeneralError("Request: Request expired", http.StatusBadRequest)
var ErrRequestFuture = NewGeneralError("Request: Request in the future", http.StatusBadRequest)
var ErrRequestNoTimestamp = NewGeneralError("Request: No timestamp set", http.StatusBadRequest)
var ErrSessionExpired = NewGeneralError("User session expired", http.StatusUnauthorized)
var ErrShortGuid = NewGeneralError("GUID must be at least 32 characters long", http.StatusInternalServerError)
var ErrStatusOk = NewGeneralError("", http.StatusOK)
var ErrUserLoggedIn = NewGeneralError("User already logged in", http.StatusBadRequest)
var ErrUserNotActive = NewGeneralError("User is not yet activated", http.StatusUnauthorized)
var ErrUserNotFound = NewGeneralError("User not found", http.StatusNotFound)
var ErrUserNotLoggedIn = NewGeneralError("User not logged in", http.StatusBadRequest)
var ErrUserNotRegistered = NewGeneralError("User not registered", http.StatusBadRequest)
Functions ¶
This section is empty.
Types ¶
type ErrorCoder ¶
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 ¶
General Error structure holds both an error string and an error code.