errs

package
v0.0.0-...-ec88504 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Collaps

func Collaps(e error) error

Collaps create a new error by putting the first path found and the first message found inside the error.

func Wrap

func Wrap(err error, message string) error

Add the message to an error, if cannot or message already exists, wrap it with another one with the new path Wrap returns nil if err == nil

func WrapPath

func WrapPath(err error, path string) error

Add the path to an error, if cannot or path already exists, wrap it with another one with the new path WrapPath returns nil if err == nil

func WrapWithError

func WrapWithError(err error, err2 error) error

WrapWithError wraps err inside an existing error

Types

type Error

type Error struct {
	Err        error     `json:"-"`
	StatusCode int       `json:"_"`
	Message    string    `json:"message,omitempty"`
	Path       string    `json:"path,omitempty"`
	Timestamp  time.Time `json:"timestamp,omitempty"`
}

Error struct easyier error return to the api and is used accross the project.

func New

func New(message string) *Error

New creates a new error

func NewWithCode

func NewWithCode(message string, code int) *Error

New creates a new error with error code

func (*Error) Error

func (e *Error) Error() string

Implementation of the error interface for this struct

Jump to

Keyboard shortcuts

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