errdefiner

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package errdefiner enable centralized definition of error code.

Index

Constants

View Source
const (
	ErrParams = errman.ErrParams
	Internal  = errman.Internal
	Unknown   = errman.Unknown
	Success   = errman.Success
)

exports

Variables

This section is empty.

Functions

func Errorf

func Errorf(format string, paras ...interface{}) error

Errorf format an standard error with parameters

func NewErrorWithString

func NewErrorWithString(code int64, msg string) *errman.Error

NewErrorWithString return an error with message

Types

type ErrorCode

type ErrorCode int64

ErrorCode of int

func MustReg

func MustReg(code int64, msg string) ErrorCode

MustReg regist an error with duplicate code check

func (ErrorCode) FmtError

func (c ErrorCode) FmtError(paras ...interface{}) error

FmtError create an error with format

func (ErrorCode) Int64

func (c ErrorCode) Int64() int64

Int64 convert code to int64

func (ErrorCode) Msg

func (c ErrorCode) Msg(paras ...interface{}) string

Msg format an error message string

func (ErrorCode) NewError

func (c ErrorCode) NewError() *errman.Error

NewError create an error without format

func (ErrorCode) WithFormat

func (c ErrorCode) WithFormat() bool

WithFormat check if error message contains format

Jump to

Keyboard shortcuts

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