xerrors

package
v0.0.0-...-b372aa1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

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

type FieldError struct {
	Field   string      `json:"field"`
	Input   string      `json:"input"`
	Message string      `json:"message"`
	Debug   interface{} `json:"debug,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL