reason

package
v2.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package reason contains types and functions commonly used to handle reason detection and extraction.

Index

Constants

View Source
const InternalReason = "The system has an internal error"

InternalReason is the reason set when the system is experiencing an error that the user cannot resolve.

Variables

This section is empty.

Functions

func Extract

func Extract(err error) ([]string, error)

Extract removes all reason errors from the error chains, returning all other errors and the reason messages.

Types

type Error

type Error struct {
	// Msg is the reason message.
	Msg string
}

Error is a reason error that is detectable.

This should not be used as a "normal" error, instead extract the reasons from the chains using Extract.

func Errorf

func Errorf(format string, a ...any) Error

Errorf returns a formatted reason error.

func (Error) Error

func (e Error) Error() string

Error return the reason as if it were a message. This is used to conform with the error type.

Jump to

Keyboard shortcuts

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