Documentation ¶
Index ¶
- type Err
- type Error
- func (self *Error) Describe() string
- func (self *Error) Error() string
- func (self *Error) GetCause() error
- func (self *Error) GetCode() string
- func (self *Error) IntoResponse(opts ...ResponseOption) Response
- func (self *Error) IsErr() bool
- func (self *Error) IsNil() bool
- func (self *Error) Retrace() *Error
- func (self *Error) String() string
- func (self *Error) Trace() string
- func (self *Error) XCause(e error) *Error
- func (self *Error) XCode(codeInt int) *Error
- func (err *Error) XMsg(msg string) *Error
- type ErrorOption
- type Response
- type ResponseOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct { Cause error `json:"cause"` CodeInt int `json:"codeInt"` CodeStr string `json:"codeStr"` Msg string `json:"msg"` Skip int `json:"skip"` Fn string `json:"fn"` File string `json:"file"` Line int `json:"line"` }
Don't alter field CodeStr for predefined Error
func NewError ¶
func NewError(cause error, codeInt int, codeStr string, opts ...ErrorOption) (self *Error)
func (*Error) IntoResponse ¶
func (self *Error) IntoResponse(opts ...ResponseOption) Response
type ErrorOption ¶
type ErrorOption func(*Error)
type ErrorOption func(*Error) bool
func Msg ¶
func Msg(msg string) ErrorOption
func NoTrace ¶
func NoTrace() ErrorOption
func Skip ¶
func Skip(skip int) ErrorOption
type Response ¶
type Response struct { RequestId string `json:"requestId"` Code string `json:"code"` Msg string `json:"msg"` Data any `json:"data"` }
func FromError ¶
func FromError(err *Error, opts ...ResponseOption) Response
func NewResponse ¶
func NewResponse(data any, opts ...ResponseOption) Response
func (*Response) XRequestId ¶
type ResponseOption ¶
type ResponseOption func(*Response)
func RequestId ¶
func RequestId(requestId string) ResponseOption
Click to show internal directories.
Click to hide internal directories.