Documentation ¶
Index ¶
- func FlattenError(err error) ([]error, error)
- func ReadTrace(stack []error) string
- func StackErrors(currentStack []error, currentErr error, newErr error) ([]error, error)
- type AggregableOf
- type Barrier
- type ComparableOf
- type ConcurrentStackableError
- func (s *ConcurrentStackableError) Empty() bool
- func (s *ConcurrentStackableError) Error() string
- func (s *ConcurrentStackableError) From(e error) error
- func (s *ConcurrentStackableError) Len() int
- func (s *ConcurrentStackableError) Return() error
- func (s *ConcurrentStackableError) Stack(err ...error)
- func (s *ConcurrentStackableError) String() string
- func (s *ConcurrentStackableError) Trace() string
- func (s *ConcurrentStackableError) Unwrap() error
- type ErrorLevel
- type ErrorSeverity
- type LeveledError
- type OperationalError
- type OperationalErrorImpl
- type PersistentSortableOf
- type RWSemaphore
- type Semaphore
- type SortableOf
- type StackableError
- type StackableErrorImpl
- type WrappedError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FlattenError ¶
FlattenError takes an error and returns a slice of errors that represent the stack trace of the error, as well as the last error in the stack trace.
Parameters: - err: The error to flatten.
Returns: - []error: a slice of errors representing the stack trace of the error. - Error: The last error in the stack trace.
Types ¶
type AggregableOf ¶
type AggregableOf interface { ComparableOf Add(other AggregableOf) AggregableOf }
AggregableOf is an interface for types that can be aggregated by a method call
type ComparableOf ¶
type ComparableOf interface {
Equal(o interface{}) bool
}
ComparableOf is an interface for types that can be compared by a method call
type ConcurrentStackableError ¶
type ConcurrentStackableError struct {
// contains filtered or unexported fields
}
func NewConcurrentStackableError ¶
func NewConcurrentStackableError(e error) *ConcurrentStackableError
func (*ConcurrentStackableError) Empty ¶
func (s *ConcurrentStackableError) Empty() bool
func (*ConcurrentStackableError) Error ¶
func (s *ConcurrentStackableError) Error() string
func (*ConcurrentStackableError) From ¶
func (s *ConcurrentStackableError) From(e error) error
func (*ConcurrentStackableError) Len ¶
func (s *ConcurrentStackableError) Len() int
func (*ConcurrentStackableError) Return ¶
func (s *ConcurrentStackableError) Return() error
func (*ConcurrentStackableError) Stack ¶
func (s *ConcurrentStackableError) Stack(err ...error)
func (*ConcurrentStackableError) String ¶
func (s *ConcurrentStackableError) String() string
func (*ConcurrentStackableError) Trace ¶
func (s *ConcurrentStackableError) Trace() string
func (*ConcurrentStackableError) Unwrap ¶
func (s *ConcurrentStackableError) Unwrap() error
type ErrorLevel ¶
type ErrorLevel struct { Key string Severity ErrorSeverity }
func NewErrorLevel ¶
func NewErrorLevel(key string, severity ErrorSeverity) ErrorLevel
NewErrorLevel creates a new ErrorLevel instance with the provided key and severity.
func (ErrorLevel) String ¶
func (e ErrorLevel) String() string
type ErrorSeverity ¶
type ErrorSeverity int
type LeveledError ¶
type LeveledError interface { Error() string Level() ErrorLevel Severity(err LeveledError) int }
func AsLeveled ¶
func AsLeveled(err error) (LeveledError, bool)
AsLeveled checks if the given error is of type LeveledError. If it is, it returns the error as LeveledError and true. If it's not, it returns nil and false.
Parameters: - err: The error to check.
Returns: - LeveledError: The error as LeveledError if it's of type LeveledError. - Bool: True if the error is of type LeveledError, false otherwise.
type OperationalError ¶
func AsOperational ¶
func AsOperational(err error) (OperationalError, bool)
AsOperational is a function that checks if an error is an OperationalError.
Parameters: - err: The error to check.
Returns: - OperationalError: The error as OperationalError if it's of type OperationalError. - bool: True if the error is of type OperationalError, false otherwise.
type OperationalErrorImpl ¶
type OperationalErrorImpl struct {
// contains filtered or unexported fields
}
func NewOperationalError ¶
func NewOperationalError(op string, err error) *OperationalErrorImpl
func (*OperationalErrorImpl) Error ¶
func (e *OperationalErrorImpl) Error() string
func (*OperationalErrorImpl) Operation ¶
func (e *OperationalErrorImpl) Operation() string
type PersistentSortableOf ¶
type PersistentSortableOf interface { SortableOf Unique() []byte }
PersistentSortableOf is an interface for sortable types that are meant to be persisted, so they must be able to be recognizable even when its memory address is changed
type RWSemaphore ¶
type RWSemaphore interface { // StartR starts a read operation StartR() // EndR ends a read operation EndR() // StartW starts a write operation StartW() // EndW ends a write operation EndW() }
type Semaphore ¶
type Semaphore interface { // Acq acquires the semaphore, blocking if the semaphore is at capacity. // This method blocks until the semaphore has available slots. Acq() // Rls releases a semaphore, allowing another operation to proceed. // It blocks until a slot is available in the semaphore's buffer. Rls() }
type SortableOf ¶
type SortableOf interface { Less(o interface{}) bool ComparableOf }
SortableOf is an interface for types that can be sorted by a method call
type StackableError ¶
func AsStackable ¶
func AsStackable(err error) (StackableError, bool)
AsStackable checks if the error is of type StackableError and returns it. If the error isn't of type StackableError, it returns nil and false. Returns the error as StackableError and true if successful, nil and false otherwise.
type StackableErrorImpl ¶
type StackableErrorImpl struct {
// contains filtered or unexported fields
}
func NewStackableError ¶
func NewStackableError(err error) *StackableErrorImpl
func (*StackableErrorImpl) Error ¶
func (s *StackableErrorImpl) Error() string
func (*StackableErrorImpl) Len ¶
func (s *StackableErrorImpl) Len() int
func (*StackableErrorImpl) Stack ¶
func (s *StackableErrorImpl) Stack(e error) error
func (*StackableErrorImpl) Trace ¶
func (s *StackableErrorImpl) Trace() string
func (*StackableErrorImpl) Unwrap ¶
func (s *StackableErrorImpl) Unwrap() error
type WrappedError ¶
func AsWrapped ¶
func AsWrapped(err error) (WrappedError, bool)
AsWrapped checks if the given error is of type WrappedError. If it is, it returns the error as WrappedError and true. If it's not, it returns nil and false.
Parameters: - err: The error to check.
Returns: - WrappedError: The error as WrappedError if it's of type WrappedError. - Bool: True if the error is of type WrappedError, false otherwise.