errors

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

一个简单的生成错误的帮助类

Index

Constants

This section is empty.

Variables

View Source
var (
	FormatString = "%v\nthe trace error is\n%s"
)

Functions

func New

func New(format string, p ...interface{}) error

return a error @param format string string format @param p ...interface{} additional parameter @return error

func NewCodeError

func NewCodeError(code int, format string, p ...interface{}) error

Returns an error in format with both the error code and the original error message

@param code int the code of error @param format string string format @param p ...interface{} additional parameter @return error

func NewError

func NewError(err error, format string, p ...interface{}) error

return a error with original error

@param err error original error @param format string string format @param p ...interface{} additional parameter @return error

func PrintErr

func PrintErr()

print error

example: defer errors.PrintErr()

Types

type Error

type Error struct {
	Code int
	Text string
}

new error type

func (Error) Error

func (e Error) Error() string

Implement error interface

@return string

Jump to

Keyboard shortcuts

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