Documentation
¶
Index ¶
- Variables
- func PlainRender(e *Error) string
- type Error
- func (e *Error) APIErrorCause() *status.Status
- func (e *Error) Cause() error
- func (e *Error) Error() string
- func (e *Error) GRPCStatus() *status.Status
- func (e *Error) MarshalLogObject(enc zapcore.ObjectEncoder) error
- func (e *Error) StackTrace() errors.StackTrace
- func (e *Error) WithAPIError(apiError *status.Status) *Error
- func (e *Error) WithField(key string, value interface{}) *Error
- func (e *Error) WithFields(fields map[string]interface{}) *Error
- func (e *Error) WithWrap(message string) *Error
Constants ¶
This section is empty.
Variables ¶
var Render func(e *Error) string
Functions ¶
func PlainRender ¶
Types ¶
type Error ¶
type Error struct { Err error Stack *stack Wrapper []string Fields map[string]interface{} APIErrors []*status.Status }
Error wrap error with fields and stack
func NewAPIError ¶
NewAPIError create an error and append API error.
func NewMessagef ¶
NewMessagef create an error with message. It will formats according to a format specifier and returns the resulting string.
func (*Error) APIErrorCause ¶
APIErrorCause return the root cause of the API error.
func (*Error) GRPCStatus ¶
GRPCStatus return the internal error's gRPC status or the root cause of the API error. Priority returns the internal error's gRPC status if it implements status.GRPCStatus. If no gRPC status can be use, then create a gRPC status with internal error. Implement gRPC status.GRPCStatus function.
func (*Error) MarshalLogObject ¶
func (e *Error) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject is an implementation of `zapcore.ObjectMarshaler` interface
func (*Error) StackTrace ¶
func (e *Error) StackTrace() errors.StackTrace
StackTrace implement `github.com/pkg/errors` stackTracer interface. To make the `sentry-go` `extractReflectedStacktraceMethod()` works
func (*Error) WithAPIError ¶
WithAPIError append API error to error
func (*Error) WithFields ¶
WithFields append fields to error. Parameter fields will cover value which key is already exists.