Documentation
¶
Overview ¶
Package errors provides an errors package for this service. It includes all of the stdlib's functions and types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func As ¶
As finds the first error in err's chain that matches target, and if so, sets target to that error value and returns true.
func Join ¶
Join returns an error that wraps the given errors. Any nil error values are discarded. Join returns nil if every value in errs is nil. The error formats as the concatenation of the strings obtained by calling the Error method of each element of errs, with a newline between each string. A non-nil error returned by Join implements the Unwrap() []error method.
Types ¶
type Category ¶
type Category uint32
Category represents the category of the error.
const ( // CatUnknown represents an unknown category. This should not be used. CatUnknown Category = Category(0) // Unknown // CatUser represents an error that is caused by bad user input. CatUser Category = Category(1) // User // CatInternal represents an internal error. CatInternal Category = Category(2) // Internal )
type EOption ¶
EOption is an optional argument for E().
func WithCallNum ¶
WithCallNum is used if you need to set the runtime.CallNum() in order to get the correct filename and line. This can happen if you create a call wrapper around E(), because you would then need to look up one more stack frame for every wrapper. This defaults to 1 which sets to the frame of the caller of E().
func WithStackTrace ¶
func WithStackTrace() EOption
WithStackTrace will add a stack trace to the error. This is useful for debugging in certain rare cases. This is not recommended for general use as it can cause performance issues when errors are created frequently.
func WithSuppressTraceErr ¶
func WithSuppressTraceErr() EOption
WithSuppressTraceErr will prevent the trace as being recorded with an error status. The trace will still receive the error message. This is useful for errors that are retried and you only want to get a status of error if the error is not resolved.
type Error ¶
Error is the error type for this service. Error implements github.com/gostdlib/base/errors.E .
type LogAttrer ¶
LogAttrer is an interface that can be implemented by an error to return a list of attributes used in logging.
type Type ¶
type Type uint16
Type represents the type of the error.
const ( // TypeUnknown represents an unknown type. TypeUnknown Type = Type(0) // Unknown // TypeBug represents a bug in the calling code. This is only bugs that are known bugs and // not because of bad user input. An example would be a switch statement that doesn't cover // all cases. The default case should return an error of this type. TypeBug Type = Type(1) // Bug // TypeParameter represents an error with a parameter that didn't pass validation. TypeParameter Type = Type(2) // Parameter // TypeConn represents an error with a connection. TypeConn Type = Type(3) // Conn // TypeTimeout represents a timeout error or cancelation. TypeTimeout Type = Type(4) // TimeoutOrCancel // TypeFS represents an error with the file system. TypeFS Type = Type(5) // FS // TypeStorageCreate represents an error with creating storage tables, containers, etc. TypeStorageCreate Type = Type(1000) // StorageCreate // TypeStorageDelete represents an error with deleting something from storage. TypeStorageDelete Type = Type(1001) // StorageDelete // TypeStorageGet represents an error with getting something from storage. TypeStorageGet Type = Type(1002) // StorageGet // TypeStorageList represents an error with listing something from storage. TypeStorageList Type = Type(1003) // StorageList // TypeStorageUpdate represents an error with updating something in storage. TypeStorageUpdate Type = Type(1004) // StorageUpdate // TypeStoragePut represents an error with putting something in storage. TypeStoragePut Type = Type(1005) // StoragePut // TypeStorageClose represents an error with closing storage. TypeStorageClose Type = Type(1006) // StorageClose )