Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorWithoutStack ¶
func NewByCode ¶
NewByCode get an error predefined in the configuration file by statusCode with a stack trace at the point NewByCode is called.
func WrapByCode ¶
WrapByCode returns an error annotating err with a stack trace at the point WrapByCode is called, and the status code.
Types ¶
type Option ¶
Option is used to configure an StatusError.
func WithExtraMsg ¶
func WithMsgParam ¶
type StatusError ¶
type StatusError interface {
error
Code() int32
Extra() map[string]string
WithExtra(map[string]string)
}
StatusError is an interface for error with status code, you can create an error through NewByCode or WrapByCode and convert it back to StatusError through FromStatusError to obtain information such as error status code.
func FromStatusError ¶
func FromStatusError(err error) (statusErr StatusError, ok bool)
FromStatusError converts err to StatusError.
Click to show internal directories.
Click to hide internal directories.