errors

package
v0.0.0-...-9ba0e8c Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewErrorf

func NewErrorf(code ErrorCode, format string, a ...interface{}) error

func WrapError

func WrapError(orig error, code ErrorCode, message string) error

func WrapErrorf

func WrapErrorf(orig error, code ErrorCode, format string, a ...interface{}) error

Types

type Error

type Error struct {
	Original error     `json:"original_error"`
	Message  string    `json:"message"`
	ErrCode  ErrorCode `json:"error_code"`
}

func (*Error) Code

func (e *Error) Code() ErrorCode

func (*Error) Error

func (e *Error) Error() string

func (*Error) GRPCStatus

func (e *Error) GRPCStatus() *status.Status

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ErrorCode

type ErrorCode int
const (
	Unknown ErrorCode = iota + 1
	NotFound
	BadRequest
	Internal
	Unauthenticated
	Unauthorized
	Conflict
	QuotaExceeded
)

type FieldViolation

type FieldViolation struct {
	Field       string
	Description string
}

func BuildViolations

func BuildViolations(verrs validator.ValidationErrors) []*FieldViolation

type ValidationError

type ValidationError struct {
	FieldViolations []*FieldViolation
}

func NewValidationError

func NewValidationError(violations []*FieldViolation) *ValidationError

func (*ValidationError) Error

func (e *ValidationError) Error() string

func (*ValidationError) GRPCStatus

func (e *ValidationError) GRPCStatus() *status.Status

Jump to

Keyboard shortcuts

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