err

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2019 License: MIT Imports: 1 Imported by: 7

README

Err

Package err implements a Golang error data type. See GoDoc for details.

Documentation

Overview

Package err implements a Golang error data type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error represents a Golang error which has a "class" as well as a "type". The class and type attributes of this data type, are meant to help facilitate error handling in a Golang software.

func New

func New(errString string, errClass, errType *big.Int, secondary ...error) *Error

New () creates a new data of this type. Always use this function, when you want to create new errors.

Input 0: The error -- a string describing it.

Input 1: The error's class.

Input 2: The error's type. This could be used to further identify errors falling under a common class.

Input 3: If the error you are creating is caused by another error, this value could be that error which caused the error you are creating. For example, if you want to create error A (File could not be opened). And error A was caued by error B (File does not exist). Then the value of this input could be error B. If error A is not caused by any error, you should skip this input.

someErr := err.New ("File could not be opened", big.NewInt (36), big.NewInt (8),
	errors.New ("File does not exist"))

func (*Error) Class

func (e *Error) Class() *big.Int

Class () returns the class of the error.

func (*Error) Error

func (e *Error) Error() string

Error () returns the description of the error.

func (*Error) Type

func (e *Error) Type() *big.Int

Type () returns the type of the error.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap () returns the secondary of the error.

Jump to

Keyboard shortcuts

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