errors

package
v0.0.0-...-bc6e940 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package errors defines the domain errors used in the application.

Index

Constants

View Source
const (
	// InputEmpty error indicates empty input params
	InputEmpty = "InputEmpty"

	// NotFound error indicates a missing / not found record
	NotFound = "NotFound"

	// ValidationError indicates an error in input validation
	ValidationError = "ValidationError"

	// ResourceAlreadyExists indicates a duplicate / already existing record
	ResourceAlreadyExists = "ResourceAlreadyExists"

	// RepositoryError indicates a repository (e.g database) error
	RepositoryError = "RepositoryError"

	// UnknownError indicates an error that the app cannot find the cause for
	UnknownError = "UnknownError"
)

Variables

This section is empty.

Functions

func ErrorType

func ErrorType(err error) string

ErrorType is used to distinguish between app error and unknown error

Types

type AppError

type AppError struct {
	Err  error
	Type string
}

AppError defines an application (domain) error

func NewAppError

func NewAppError(err error, errType string) *AppError

NewAppError initializes a new domain error using an error and its type.

func NewAppErrorWithType

func NewAppErrorWithType(errType string) *AppError

NewAppErrorWithType initializes a new default error for a given type.

func (*AppError) Error

func (appErr *AppError) Error() string

String converts the app error to a human-readable string.

Jump to

Keyboard shortcuts

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