errors

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: EUPL-1.2 Imports: 1 Imported by: 0

Documentation

Overview

Package errors provides structured error handling for Core applications.

Deprecated: Use pkg/log instead. This package is maintained for backward compatibility and will be removed in a future version. All error handling functions are now available in pkg/log:

// Instead of:
import "github.com/host-uk/core/pkg/errors"
err := errors.E("op", "msg", cause)

// Use:
import "github.com/host-uk/core/pkg/log"
err := log.E("op", "msg", cause)

Migration guide:

  • errors.Error -> log.Err
  • errors.E -> log.E
  • errors.Wrap -> log.Wrap
  • errors.WrapCode -> log.WrapCode
  • errors.Code -> log.NewCode
  • errors.New -> log.NewError
  • errors.Is -> log.Is
  • errors.As -> log.As
  • errors.Join -> log.Join
  • errors.Op -> log.Op
  • errors.ErrCode -> log.ErrCode
  • errors.Message -> log.Message
  • errors.Root -> log.Root

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As deprecated

func As(err error, target any) bool

As finds the first error in err's tree that matches target.

Deprecated: Use log.As instead.

func Code deprecated

func Code(code, msg string) error

Code creates an error with just a code and message.

Deprecated: Use log.NewCode instead.

func E deprecated

func E(op, msg string, err error) error

E creates a new Error with operation context.

Deprecated: Use log.E instead.

func ErrCode deprecated

func ErrCode(err error) string

ErrCode extracts the error code, or empty string if not set.

Deprecated: Use log.ErrCode instead.

func Is deprecated

func Is(err, target error) bool

Is reports whether any error in err's tree matches target.

Deprecated: Use log.Is instead.

func Join deprecated

func Join(errs ...error) error

Join returns an error that wraps the given errors.

Deprecated: Use log.Join instead.

func Message deprecated

func Message(err error) string

Message extracts the message from an error. For Error types, returns Msg; otherwise returns err.Error().

Deprecated: Use log.Message instead.

func New deprecated

func New(text string) error

New returns an error with the given text.

Deprecated: Use log.NewError instead.

func Op deprecated

func Op(err error) string

Op extracts the operation from an error, or empty string if not an Error.

Deprecated: Use log.Op instead.

func Root deprecated

func Root(err error) error

Root returns the deepest error in the chain.

Deprecated: Use log.Root instead.

func Wrap deprecated

func Wrap(err error, op, msg string) error

Wrap wraps an error with operation context. Returns nil if err is nil.

Deprecated: Use log.Wrap instead.

func WrapCode deprecated

func WrapCode(err error, code, op, msg string) error

WrapCode wraps an error with operation context and an error code.

Deprecated: Use log.WrapCode instead.

Types

type Error deprecated

type Error = log.Err

Error represents a structured error with operational context.

Deprecated: Use log.Err instead.

Jump to

Keyboard shortcuts

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