Documentation
¶
Index ¶
- type ErrorObject
- func (e *ErrorObject) BuildErrorMessage(idiom, messageKey string, replacements []string) *ErrorObject
- func (e *ErrorObject) CreateErrorResponse(w http.ResponseWriter, err error, statusCode int)
- func (e *ErrorObject) GetErrorMessage() string
- func (e *ErrorObject) SetError(err error, statusCode int) *ErrorObject
- type ErrorResponse
- type Lang
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorObject ¶
func LoadLanguages ¶
func LoadLanguages(messages map[string]map[string]string, context string) ErrorObject
LoadLanguages função principal necessária para carregar as mensagens de erro que serão utilizadas
func (*ErrorObject) BuildErrorMessage ¶
func (e *ErrorObject) BuildErrorMessage(idiom, messageKey string, replacements []string) *ErrorObject
BuildErrorMessage responsável por atribuir os valores que serão usados para criar uma mensagem de erro internacionalizada
func (*ErrorObject) CreateErrorResponse ¶
func (e *ErrorObject) CreateErrorResponse(w http.ResponseWriter, err error, statusCode int)
CreateErrorResponse constrói a estrutura padrão de mensagem de erro e escreve a resposta no response
func (*ErrorObject) GetErrorMessage ¶
func (e *ErrorObject) GetErrorMessage() string
GetErrorMessage retorna a mensagem de erro como string
func (*ErrorObject) SetError ¶
func (e *ErrorObject) SetError(err error, statusCode int) *ErrorObject
SetError função genérica para ser utilizada caso NÃO seja necessária mensagem customizada traduzida
type ErrorResponse ¶
type ErrorResponse struct {
Error detail `json:"error"`
}
Click to show internal directories.
Click to hide internal directories.