errors

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 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 added in v0.1.3

func NewErrorDatabaseDuplicated(text string) error

func NewErrorEmptySqlResult added in v0.1.3

func NewErrorEmptySqlResult(text string) error

func NewErrorNilEntityValue added in v0.1.3

func NewErrorNilEntityValue(text string) error

func NewErrorNoRowsAffected added in v0.1.3

func NewErrorNoRowsAffected(text string) error

Types

type CommonsError added in v0.1.3

type CommonsError struct {
	Code    string
	Message string
}

CommonsError is a trivial implementation of error.

func GetCommonsError added in v0.1.3

func GetCommonsError(err error) *CommonsError

func (CommonsError) Error added in v0.1.3

func (e CommonsError) Error() string

func (CommonsError) MarshalJSON added in v0.1.3

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

Implements the json.Marshaler interface to control JSON serialization.

func (*CommonsError) Scan added in v0.1.3

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

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

func (*CommonsError) String added in v0.1.3

func (e *CommonsError) String() string

func (CommonsError) Value added in v0.1.3

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