Documentation
¶
Overview ¶
Package dictionary is for our standardized error responses
Index ¶
Constants ¶
View Source
const ( ErrorBadErrorCode = 1 ErrorConfigValidation = 2 ErrorDatabaseOpen = 3 ErrorDatabasePing = 4 ErrorDatabaseUnknownDriver = 5 ErrorDecryptEnv = 6 ErrorInvalidEnv = 7 ErrorLoadingCache = 8 ErrorLoadingConfig = 9 ErrorMethodNotAllowed = 10 ErrorMissingEnv = 11 ErrorReadingConfig = 12 ErrorRequestNotFound = 13 ErrorViper = 14 ErrorLoadingService = 15 ErrorAuthenticationError = 16 ErrorAuthenticationScheme = 17 ErrorAuthenticationNotAdmin = 18 ErrorAuthenticationCallback = 19 )
ErrorCode constants for the different error responses Leave the start and last constants in place
Variables ¶
This section is empty.
Functions ¶
func GetInternalMessage ¶
GetInternalMessage will return the internal message based on the given error code
func GetPublicMessage ¶
GetPublicMessage will return the public message based on the given error code
func GetStatusCode ¶
GetStatusCode will return the http status code on the given error code
Types ¶
type ErrorMessage ¶
type ErrorMessage struct { Code ErrorCode `json:"code"` InternalMessage string `json:"internal_message"` PublicMessage string `json:"public_message"` StatusCode int `json:"status_code"` }
ErrorMessage is used for standardizing the messages/codes for errors
func GetError ¶
func GetError(code ErrorCode, internalMessageReplacements ...interface{}) ErrorMessage
GetError will return the error based on the given error code Set replacements for Sprintf() on the internal message if needed
Click to show internal directories.
Click to hide internal directories.