errors

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsLedgerError

func IsLedgerError(err error) bool

IsLedgerError returns true if the error is of type LedgerError.

Types

type ErrLedger

type ErrLedger string
const (
	// ErrRequestInvalid is returned when the request is invalid.
	ErrRequestInvalid ErrLedger = "RequestError_INVALID_REQUEST"

	// ErrRequestIllegal is returned when the requestor is not authenticated to perform the request.
	ErrRequestIllegal ErrLedger = "RequestError_ILLEGAL_REQUEST"

	// ErrRequestForbidden is returned when the requestor is not authorized to perform the request.
	ErrRequestForbidden ErrLedger = "RequestError_FORBIDDEN"

	// ErrInternal is returned when an internal error occurs.
	ErrInternal ErrLedger = "RequestError_INTERNAL"

	// ErrRecordNotFound is returned when a requested record is not found in the repository.
	ErrRecordNotFound ErrLedger = "RepositoryError_RECORD_NOT_FOUND"

	// ErrRecordInsertConflict is returned when there is a conflict while inserting a record into the repository, such as a duplicate entry.
	ErrRecordInsertConflict ErrLedger = "RepositoryError_RECORD_INSERT_CONFLICT"

	// ErrRepositoryInternal is returned when an internal error occurs within the repository, such as a database failure.
	ErrRepositoryInternal ErrLedger = "RepositoryError_INTERNAL"
)

type LedgerError

type LedgerError struct {
	Code    ErrLedger
	Message string
}

func AsLedgerError

func AsLedgerError(err error) LedgerError

AsLedgerError returns the error as a LedgerError.

func NewLedgerError

func NewLedgerError(code ErrLedger, message string) LedgerError

func (LedgerError) Error

func (e LedgerError) Error() string

Jump to

Keyboard shortcuts

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