Documentation
¶
Index ¶
- Constants
- Variables
- func ConsoleTraceWriter() zerolog.ConsoleWriter
- func ErrorMarshalFunc(err error) interface{}
- type CodedErr
- func (e *CodedErr[T]) Code(code T) *CodedErr[T]
- func (e *CodedErr[T]) Field(key string, value any) *CodedErr[T]
- func (e *CodedErr[T]) Fields(f map[string]any) *CodedErr[T]
- func (e *CodedErr[T]) GetCode() T
- func (e *CodedErr[T]) Msg(msg string) *CodedErr[T]
- func (e *CodedErr[T]) Msgf(msg string, args ...any) *CodedErr[T]
- func (e *CodedErr[T]) Wrap(cause error) *CodedErr[T]
- type Err
- func (e *Err) Error() string
- func (e *Err) Field(key string, value any) *Err
- func (e *Err) Fields(f map[string]any) *Err
- func (e *Err) GetField(field string) any
- func (e *Err) HasField(field string) bool
- func (e *Err) Msg(msg string) *Err
- func (e *Err) Msgf(msg string, args ...any) *Err
- func (e *Err) Unwrap() error
- func (e *Err) Wrap(cause error) *Err
Constants ¶
View Source
const ( MODULE string = "module" SERVICE string = "service" ACTIVITY string = "activity" PACKAGE string = "package" URL string = "url" PATH string = "path" AGENT string = "agent" ID string = "id" SOURCE string = "source" ORIGIN string = "origin" SIZE string = "size" NAME string = "name" )
Variables ¶
View Source
var ErrorTraceFieldName = "_trace"
Functions ¶
func ConsoleTraceWriter ¶
func ConsoleTraceWriter() zerolog.ConsoleWriter
ConsoleTraceWriter creates a zerolog console writer configured for trace output
func ErrorMarshalFunc ¶
func ErrorMarshalFunc(err error) interface{}
ErrorMarshalFunc marshals an error chain into a map with trace information and fields
Types ¶
type CodedErr ¶
CodedErr is a generic error type that embeds Err and includes a typed code field
func CodedError ¶
CodedError creates a new CodedErr instance with the given code
func (*CodedErr[T]) Field ¶
Field adds a single key-value pair to the error's fields (overrides Err.Field to return *CodedErr[T])
func (*CodedErr[T]) Fields ¶
Fields copies all key-value pairs from the provided map to the error's fields (overrides Err.Fields to return *CodedErr[T])
type Err ¶
type Err struct {
// contains filtered or unexported fields
}
Err containing a chain of causes (linked list of errors)
Click to show internal directories.
Click to hide internal directories.