berror

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerInternalErrorStr = "server_internal_error"
)

Variables

Functions

func IsOpenStack

func IsOpenStack() bool

IsOpenStack reports whether stack trace collection is enabled via the ErrorStackTrace configuration field. Written by Claude Code claude-opus-4-6.

Types

type ErrMsg

type ErrMsg basepb.ErrorMessage

ErrMsg is a typed error wrapping basepb.ErrorMessage, providing structured error information including error code, human-readable message, internal diagnostic info, optional extra data, and an optional captured stack trace. Written by Claude Code claude-opus-4-6.

func NewDatabaseErr

func NewDatabaseErr(err error) *ErrMsg

NewDatabaseErr wraps an existing error as an ETDataBase ErrMsg. If err is nil it returns nil. If err is already an *ErrMsg it is returned unchanged; otherwise NewDatabaseStr is called with the error's text. Written by Claude Code claude-opus-4-6.

func NewDatabaseStr

func NewDatabaseStr(str string) *ErrMsg

NewDatabaseStr creates an ETDataBase ErrMsg with the standard ServerInternalErrorStr public message and the provided str as internal diagnostic detail. A stack trace is attached when IsOpenStack returns true. Written by Claude Code claude-opus-4-6.

func NewNoAuthErr

func NewNoAuthErr(err error) *ErrMsg

NewNoAuthErr wraps an existing error as an ETNoAuth ErrMsg. If err is nil it returns nil. If err is already an *ErrMsg it is returned unchanged; otherwise NewNoAuthStr is called with the error's text. Written by Claude Code claude-opus-4-6.

func NewNoAuthStr

func NewNoAuthStr(str string) *ErrMsg

NewNoAuthStr creates an ETNoAuth ErrMsg with the standard ServerInternalErrorStr public message and the provided str as internal diagnostic detail. A stack trace is attached when IsOpenStack returns true. Written by Claude Code claude-opus-4-6.

func NewNormalErr

func NewNormalErr(errMsg string, err error) *ErrMsg

NewNormalErr wraps an existing error as an ETNormal ErrMsg. If err is nil it returns nil. If err is already an *ErrMsg it is returned unchanged; otherwise NewNormalStr is called with the error's text as internal info. Written by Claude Code claude-opus-4-6.

func NewNormalInternalStr

func NewNormalInternalStr(str string) *ErrMsg

NewNormalInternalStr creates an ETNormal ErrMsg with the standard ServerInternalErrorStr public message and the provided str as internal diagnostic detail. A stack trace is attached when IsOpenStack returns true. Written by Claude Code claude-opus-4-6.

func NewNormalStr

func NewNormalStr(errMsg string, str string) *ErrMsg

NewNormalStr creates an ETNormal ErrMsg with the provided errMsg as the public-facing message and str as internal diagnostic detail. A stack trace is attached when IsOpenStack returns true. Written by Claude Code claude-opus-4-6.

func NewPanicErr

func NewPanicErr(err error) *ErrMsg

NewPanicErr wraps an existing error as an ETPanic ErrMsg. If err is nil it returns nil. If err is already an *ErrMsg it is returned unchanged; otherwise NewPanicStr is called with the error's text. Written by Claude Code claude-opus-4-6.

func NewPanicStr

func NewPanicStr(str string) *ErrMsg

NewPanicStr creates an ETPanic ErrMsg with the standard ServerInternalErrorStr public message and the provided str as internal diagnostic detail. A stack trace is attached when IsOpenStack returns true. Written by Claude Code claude-opus-4-6.

func NewProtocolErr

func NewProtocolErr(err error) *ErrMsg

NewProtocolErr wraps an existing error as an ETProtocol ErrMsg. If err is nil it returns nil. If err is already an *ErrMsg it is returned unchanged; otherwise NewProtocolStr is called with the error's text. Written by Claude Code claude-opus-4-6.

func NewProtocolStr

func NewProtocolStr(str string) *ErrMsg

NewProtocolStr creates an ETProtocol ErrMsg with the standard ServerInternalErrorStr public message and the provided str as internal diagnostic detail. A stack trace is attached when IsOpenStack returns true. Written by Claude Code claude-opus-4-6.

func (*ErrMsg) Error

func (this_ *ErrMsg) Error() string

Error implements the error interface. It serialises the ErrMsg into a compact JSON string containing err_code, err_msg, and optional err_internal_info / err_extra_info fields. Returns "nil" when called on a nil receiver. Written by Claude Code claude-opus-4-6.

func (*ErrMsg) IsErrorDatabase

func (this_ *ErrMsg) IsErrorDatabase() bool

IsErrorDatabase reports whether the error code is ETDataBase (a database operation failure). Written by Claude Code claude-opus-4-6.

func (*ErrMsg) IsErrorNoAuth

func (this_ *ErrMsg) IsErrorNoAuth() bool

IsErrorNoAuth reports whether the error code is ETNoAuth (an authentication or authorisation failure). Written by Claude Code claude-opus-4-6.

func (*ErrMsg) IsErrorNormal

func (this_ *ErrMsg) IsErrorNormal() bool

IsErrorNormal reports whether the error code is ETNormal (a normal, user-visible error such as a validation failure). Written by Claude Code claude-opus-4-6.

func (*ErrMsg) IsErrorPanic

func (this_ *ErrMsg) IsErrorPanic() bool

IsErrorPanic reports whether the error code is ETPanic (an error produced by a recovered panic inside a handler). Written by Claude Code claude-opus-4-6.

func (*ErrMsg) IsErrorProtocol

func (this_ *ErrMsg) IsErrorProtocol() bool

IsErrorProtocol reports whether the error code is ETProtocol (a protocol- level error such as malformed or unexpected messages). Written by Claude Code claude-opus-4-6.

func (*ErrMsg) Reset

func (this_ *ErrMsg) Reset()

Reset clears all fields of the ErrMsg so it can be reused (e.g. returned to an object pool) without retaining previous state. Written by Claude Code claude-opus-4-6.

func (*ErrMsg) StackTrace added in v0.1.23

func (this_ *ErrMsg) StackTrace() errors2.StackTrace

StackTrace returns the captured pkg/errors-compatible StackTrace stored in the ErrMsg, or nil if no stack was recorded. Written by Claude Code claude-opus-4-6.

func (*ErrMsg) String

func (this_ *ErrMsg) String() string

String returns the same JSON representation as Error, satisfying the fmt.Stringer interface. Written by Claude Code claude-opus-4-6.

func (*ErrMsg) WithStackTrace

func (this_ *ErrMsg) WithStackTrace()

WithStackTrace captures the current goroutine call stack and stores it in the ErrMsg. The stack is collected starting three frames above this call so that framework plumbing frames are omitted from the trace. Written by Claude Code claude-opus-4-6.

Jump to

Keyboard shortcuts

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