errors

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlreadyExists

func AlreadyExists(ctx context.Context, message string, field string, conflictValue string) error

AlreadyExists returns a gRPC error indicating a resource already exists Includes precondition failure details for the conflicting field

func Internal

func Internal(ctx context.Context, message string, reason string, domain string) error

Internal returns a gRPC internal error with debug info Includes error info with reason and domain for categorization

func InvalidArgument

func InvalidArgument(ctx context.Context, message string, violations ...FieldViolation) error

InvalidArgument returns a gRPC error with structured field violations Use this for validation errors where specific fields failed validation

func NotFound

func NotFound(ctx context.Context, resourceType string, resourceID string) error

NotFound returns a gRPC error indicating a resource was not found Includes resource info for the missing resource

func PreconditionFailed

func PreconditionFailed(ctx context.Context, message string, violationType string, subject string, description string) error

PreconditionFailed returns a gRPC error for failed preconditions Use when an operation cannot proceed due to the current state of the resource

func RateLimited

func RateLimited(ctx context.Context, message string, retryAfter time.Duration) error

RateLimited returns a gRPC error indicating rate limiting Includes retry information with the recommended retry delay

func WithHelp

func WithHelp(err error, links ...*errdetails.Help_Link) error

WithHelp adds help links to an existing error Useful for providing documentation links for common errors

func WithLocalizedMessage

func WithLocalizedMessage(err error, locale string, localizedMessage string) error

WithLocalizedMessage adds a localized message to an existing error Useful for internationalization support

Types

type FieldViolation

type FieldViolation struct {
	Field       string
	Description string
}

FieldViolation represents a validation error for a specific field

Jump to

Keyboard shortcuts

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