goerror

package module
v0.0.0-...-fc97634 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: BSD-2-Clause Imports: 3 Imported by: 2

README

goerror Build Status Go Report Card GoDoc

Package goerror implements functions to manipulate errors.

The traditional error handling method in golang is given below which applied recursively up the call stack results in error reports without context or debugging information.

if err != nil {
        return err
}

The package mainly contain three functions

GetErrorInfo

GetErrorType

New

GetErrorInfo

which accepts the error and found the detailed information about the error. GetErrorInfo returns the error wrapped up with the file name, line number and function name in which error occured.

func GetErrorInfo(err error) error

if err != nil {
        return goerror.GetErrorInfo(err)
}

GetErrorType

which accepts the error and found the type of the error. GetErrorType returns the error wrapped up with the error type,

func GetErrorType(err error) error

if err != nil {
        return goerror.GetErrorType(err)
}

New

Which is used to create a new errors. New help us to create custom user defined errors.

func New(err string) error

err := goerror.New("New custom error")

Contributing

We welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high. Before proposing a change, please discuss your change by raising an issue.

License

BSD-2-Clause

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetErrorInfo

func GetErrorInfo(err error) error

GetErrorInfo returns the corresponding error informations. Including the file name , line number, function name

func GetErrorType

func GetErrorType(err error) error

GetErrorType accepts an error and returns the type of the error

func New

func New(err string) error

New returns a new error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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