exception

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: Apache-2.0 Imports: 5 Imported by: 47

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Catch added in v0.8.0

func Catch(recovered interface{}) error

Catch Exception catch and recovered

func CatchDebug

func CatchDebug()

CatchDebug Catch the exception and print debug info

func CatchPrint

func CatchPrint()

CatchPrint Catch the exception and print it

Types

type Exception

type Exception struct {
	Message string      `json:"message"`
	Code    int         `json:"code"`
	Context interface{} `json:"context"`
}

Exception the Exception type

func Err

func Err(err error, code int) *Exception

Err Create an exception instance from the error

func New

func New(message string, code int, args ...interface{}) *Exception

New Create a new exception instance

func (*Exception) Ctx

func (exception *Exception) Ctx(context interface{}) *Exception

Ctx Add the context for the exception.

func (Exception) Print

func (exception Exception) Print()

Print print the exception

func (Exception) String

func (exception Exception) String() string

String interface

func (Exception) Throw

func (exception Exception) Throw()

Throw Throw the exception and terminal progress.

Jump to

Keyboard shortcuts

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