errors

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorNilEntityValue     = "ERROR_NIL_ENTITY_VALUE"
	ErrorEmptySqlResult     = "ERROR_EMPTY_SQL_RESULT"
	ErrorDatabaseDuplicated = "ERROR_DUPLICATED_ENTRY"
	ErrorNoRowsAffected     = "ERROR_SQL_NO_ROWS_AFFECTED"
	ErrorGeneratingRsa      = "ERROR_GENERATING_RSA"
)

Variables

This section is empty.

Functions

func Code

func Code(e error) string

Returns the CommonsError code

If e is not type of CommonsError returns an empty string

func Message

func Message(e error) string

Returns the CommonsError message

If e is not type of CommonsError returns an empty string

func New

func New(code string, text string) error

New returns an error that formats as the given code and text (the message). Each call to New returns a distinct error value even if the text is identical.

func NewErrorDatabaseDuplicated

func NewErrorDatabaseDuplicated(text string) error

func NewErrorEmptySqlResult

func NewErrorEmptySqlResult(text string) error

func NewErrorNilEntityValue

func NewErrorNilEntityValue(text string) error

func NewErrorNoRowsAffected

func NewErrorNoRowsAffected(text string) error

Types

type CommonsError

type CommonsError struct {
	Code    string
	Message string
}

CommonsError is a trivial implementation of error.

func GetCommonsError

func GetCommonsError(err error) *CommonsError

func (CommonsError) Error

func (e CommonsError) Error() string

func (CommonsError) MarshalJSON

func (e CommonsError) MarshalJSON() ([]byte, error)

Implements the json.Marshaler interface to control JSON serialization.

func (*CommonsError) Scan

func (e *CommonsError) Scan(value interface{}) error

Implements the sql.Scanner interface to be able to read it from MySQL

func (*CommonsError) String

func (e *CommonsError) String() string

func (CommonsError) Value

func (e CommonsError) Value() (driver.Value, error)

Implements the driver.Valuer interface to be able to insert it into MySQL

Jump to

Keyboard shortcuts

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