errors

package
v0.0.0-...-65ae5a0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	ErrorCode
	// contains filtered or unexported fields
}

Error is a custom error type that implements the error interface.

func New

func New(code ErrorCode) *Error

New returns a new error.

func (*Error) Code

func (e *Error) Code() ErrorCode

Code returns the error code.

func (*Error) Error

func (e *Error) Error() string

Error returns the error message.

type ErrorCode

type ErrorCode int

ErrorCode is a custom error code type.

const (
	// ErrCollectionNameIsEmpty is returned when the collection name is empty.
	ErrCollectionNameIsEmpty ErrorCode = 1000 + iota
	// ErrCollectionNameIsInvalid is returned when the collection name is invalid.
	ErrCollectionNameIsInvalid
)

Error codes.

const (
	// ErrDocumentNotFound is returned when a document is not found.
	ErrDocumentNotFound ErrorCode = 3000 + iota
)
const (
	// ErrUnauthorized is returned when a user is not authorized to perform an action.
	ErrUnauthorized ErrorCode = 2000 + iota
)

func (ErrorCode) ToString

func (c ErrorCode) ToString() string

Jump to

Keyboard shortcuts

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