exterr

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: ISC Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapWithErr

func WrapWithErr(oldErr, newErr error) error

func WrapWithFrame

func WrapWithFrame(oldErr error) error

Types

type Error

type Error struct {
	Err     string `json:"message,omitempty"`
	ErrCode int    `json:"code,omitempty"`
	Comp    string `json:"component,omitempty"`
	File    string `json:"file,omitempty"`
	Line    int    `json:"line,omitempty"`
	Cause   error
}

Error is an extended error main struct

func NewErrorWithErr

func NewErrorWithErr(err error) *Error

NewErrorWithErr creates Error type with error in parameter

func NewErrorWithMessage

func NewErrorWithMessage(msg string) *Error

NewErrorWithMessage creates Error type with string in parameter

func (*Error) Code

func (e *Error) Code() int

Code is getter to error code

func (*Error) Component

func (e *Error) Component() string

Component is getter to component

func (Error) DumpStack

func (e Error) DumpStack() []string

func (Error) DumpStackWithID

func (e Error) DumpStackWithID(requestID string) []string

func (*Error) Error

func (e *Error) Error() string

Error prints component and error code

func (*Error) JSON

func (e *Error) JSON() ([]byte, error)

JSON returns json representation

func (*Error) Message

func (e *Error) Message() string

Message is getter to message

func (*Error) Unwrap

func (e *Error) Unwrap() error

func (*Error) WithCode

func (e *Error) WithCode(code int) *Error

WithCode sets error code of Error

func (*Error) WithComponent

func (e *Error) WithComponent(component string) *Error

WithComponent sets component name of Error

Jump to

Keyboard shortcuts

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