Documentation
¶
Index ¶
- Constants
- Variables
- type CustomError
- func BadRequest(traceID string, msg string) *CustomError
- func Conflict(traceID string, msg string) *CustomError
- func Forbidden(traceID string, msg string) *CustomError
- func HandleCustomerError(err error) *CustomError
- func HandleError(ctx context.Context, err error, traceID string) *CustomError
- func HandleValidationError(err error) *CustomError
- func InternalServer(traceID string, msg string) *CustomError
- func New(traceID string, status int, message string, details ...interface{}) *CustomError
- func NotFound(traceID string, msg string) *CustomError
- func Unauthorized(traceID string, msg string) *CustomError
- type FieldError
Constants ¶
View Source
const ( NotFoundRecord = "Registro não encontrado" DuplicatedRecord = "Já existe um registro com os dados fornecidos" TooManyValues = "There is more than one record" InvalidValues = "Invalid values for few fields" UnknownError = "Unknown error" )
Variables ¶
View Source
var ErrInvalidCredentials = fmt.Errorf("invalid email or password")
Functions ¶
This section is empty.
Types ¶
type CustomError ¶
type CustomError struct {
Status int `json:"-"`
ErrorMessage string `json:"error"`
Details interface{} `json:"details,omitempty"`
TraceID string `json:"traceID"`
Debug interface{} `json:"debug,omitempty"`
}
func BadRequest ¶
func BadRequest(traceID string, msg string) *CustomError
func Conflict ¶
func Conflict(traceID string, msg string) *CustomError
func Forbidden ¶
func Forbidden(traceID string, msg string) *CustomError
func HandleCustomerError ¶
func HandleCustomerError(err error) *CustomError
func HandleError ¶
func HandleError(ctx context.Context, err error, traceID string) *CustomError
func HandleValidationError ¶
func HandleValidationError(err error) *CustomError
func InternalServer ¶
func InternalServer(traceID string, msg string) *CustomError
func New ¶
func New(traceID string, status int, message string, details ...interface{}) *CustomError
func NotFound ¶
func NotFound(traceID string, msg string) *CustomError
func Unauthorized ¶
func Unauthorized(traceID string, msg string) *CustomError
func (*CustomError) Error ¶
func (e *CustomError) Error() string
func (*CustomError) StatusCode ¶
func (e *CustomError) StatusCode() int
type FieldError ¶
Click to show internal directories.
Click to hide internal directories.