Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultLanguage = "en"
View Source
var ErrorMessages = map[string]map[ErrorCode]string{ "en": { ErrorUserExists: "The User already exists.", ErrorUsernameExists: "This username is already registered.", ErrorEmailExists: "This email is already registered.", ErrorUserDoesntExists: "This user doesn't exists.", ErrorUserInvalidPassword: "The user and/or password didn't match.", ErrorUserInvalidUsername: "This username is invalid.", ErrorUserInvalidEmail: "This email is invalid.", ErrorUserInvalid: "This user is invalid.", ErrorNotEnoughInfo: "There is not enough information to find a user.", ErrorNoPasswordToCompare: "There is no password to compare to.", ErrorMissingParam: "A URL Param is required.", ErrorUnauthorized: "You're not authorized to access this page.", }, "pt-br": { ErrorUserExists: "O Usuario ja existe.", ErrorUsernameExists: "Esse usuario ja existe.", ErrorEmailExists: "Esse email ja existe.", ErrorUserDoesntExists: "Esse usuario não existe.", ErrorUserInvalidPassword: "O usuario e/ou senha não conferem.", ErrorUserInvalidUsername: "Esse nome de usuario não é valido.", ErrorUserInvalidEmail: "Esse email não é valido.", ErrorUserInvalid: "Usuario invalido.", ErrorNotEnoughInfo: "Não tenho informação suficiente para encontrar um usuario.", ErrorNoPasswordToCompare: "Não tenho uma senha para compara-la.", ErrorMissingParam: "Um parametro de url é obrigatorio.", ErrorUnauthorized: "Você não está autorizado a acessar essa página.", }, }
ErrorMessages holds all error messages with support for different languages
Functions ¶
This section is empty.
Types ¶
type Error ¶
func FromCodeLang ¶
FromCodeTranslate creates a new Error using a ID that should lead to a pre-defined error
type ErrorCode ¶
type ErrorCode int
const ( ErrorUnknown ErrorCode = iota ErrorUserExists ErrorUsernameExists ErrorEmailExists ErrorUserDoesntExists ErrorUserInvalidPassword ErrorUserInvalidUsername ErrorUserInvalidEmail ErrorUserInvalid ErrorNotEnoughInfo ErrorNoPasswordToCompare ErrorMissingParam // this is used to check for missing error messages TotalErrorMessages )
ONLY INSERT NEW ERRORS AT THE END
Click to show internal directories.
Click to hide internal directories.