apperror

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package apperror defines the platform-wide application error type used to map domain and application failures to transport-level responses.

Index

Constants

View Source
const (
	CodeValidation     = Code(TypeValidation)
	CodeNotFound       = Code(TypeNotFound)
	CodeAuthentication = Code(TypeAuthentication)
	CodeAuthorization  = Code(TypeAuthorization)
)

Variables

This section is empty.

Functions

func IsAppError

func IsAppError(err error) bool

Types

type AppError

type AppError struct {
	Type    Type          `json:"type"`
	Code    Code          `json:"code"`
	Message string        `json:"message"`
	Details []interface{} `json:"details"`
}

func Authentication

func Authentication(message string) *AppError

func Authorization

func Authorization(message string) *AppError

func Logic

func Logic(message string, code Code) *AppError

func NotFound

func NotFound(message string) *AppError

func NotFoundEntity

func NotFoundEntity(entity string) *AppError

func Validation

func Validation(validationErrors map[string]string) *AppError

func (*AppError) Error

func (e *AppError) Error() string

func (*AppError) IsAuthentication

func (e *AppError) IsAuthentication() bool

func (*AppError) IsAuthorization

func (e *AppError) IsAuthorization() bool

func (*AppError) IsLogic

func (e *AppError) IsLogic() bool

func (*AppError) IsNotFound

func (e *AppError) IsNotFound() bool

func (*AppError) IsValidation

func (e *AppError) IsValidation() bool

type Code

type Code string

type Type

type Type string
const (
	TypeLogic          Type = "logic"
	TypeValidation     Type = "validation"
	TypeNotFound       Type = "not_found"
	TypeAuthentication Type = "authentication"
	TypeAuthorization  Type = "authorization"
)

Jump to

Keyboard shortcuts

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