apperror

package
v0.0.0-...-b0195fe Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHTTPStatus

func GetHTTPStatus(kind Kind) int

func HTTPStatus

func HTTPStatus(err error) int

func IsKind

func IsKind(err error, kind Kind) bool

Types

type Error

type Error struct {
	Kind    Kind   // To make errors understandable
	Op      string // <layer>.<domain>.<action>
	Err     error  // wrapped error
	Message string // client safe and friendly message
	Stack   []byte // stack traces
}

func New

func New(kind Kind, op string, err error) *Error

func (*Error) Error

func (e *Error) Error() string

Error implements the built-in error interface

func (*Error) Unwrap

func (e *Error) Unwrap() error

func (*Error) WithErr

func (e *Error) WithErr(err error) *Error

func (*Error) WithMessage

func (e *Error) WithMessage(msg string) *Error

func (*Error) WithOp

func (e *Error) WithOp(op string) *Error

type Kind

type Kind string
var (
	InvalidInput   Kind = "invalid_input"
	AlreadyExists  Kind = "already_exist"
	NotFound       Kind = "not_found"
	Conflict       Kind = "conflict"
	Unauthorised   Kind = "unauthorised"
	Forbidden      Kind = "forbidden"
	RequestTimeout Kind = "request_timeout"
	Internal       Kind = "internal"
	Dependency     Kind = "dependency_failure"
	DatabaseErr    Kind = "database_error"
)

Jump to

Keyboard shortcuts

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