errors

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package errors provides centralized error types for GPU Go. Keep it minimal - only add what's actually used.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = errors.New("not found")
	ErrConflict      = errors.New("conflict")
	ErrBadRequest    = errors.New("bad request")
	ErrUnavailable   = errors.New("unavailable")
	ErrNotConfigured = errors.New("not configured")
)

Sentinel errors for type checking with errors.Is()

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    string
	Message string
	Err     error
	Details map[string]any
}

Error is a typed error with code, message and optional details

func BadRequest

func BadRequest(message string) *Error

BadRequest creates a bad request error

func Conflict

func Conflict(resource, reason string) *Error

Conflict creates a conflict error

func NotFound

func NotFound(resource, id string) *Error

NotFound creates a not found error

func NotFoundf

func NotFoundf(format string, args ...any) *Error

NotFoundf creates a not found error with formatted message

func Unavailable

func Unavailable(message string) *Error

Unavailable creates a service unavailable error

func Wrap

func Wrap(err error, message string) *Error

Wrap wraps an error with a message

func (*Error) Error

func (e *Error) Error() string

func (*Error) Is

func (e *Error) Is(target error) bool

func (*Error) Unwrap

func (e *Error) Unwrap() error

func (*Error) WithDetail

func (e *Error) WithDetail(key string, value any) *Error

WithDetail adds a detail to the error (chainable)

Jump to

Keyboard shortcuts

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