Documentation
¶
Index ¶
- Variables
- func ToError(s Status) error
- type Code
- type Err
- type Status
- func Cancelledf(format string, a ...any) Status
- func ChecksumError(msg string) Status
- func ChecksumErrorf(format string, a ...any) Status
- func Closedf(format string, a ...any) Status
- func ConcurrencyError(msg string) Status
- func ConcurrencyErrorf(format string, a ...any) Status
- func Endf(format string, a ...any) Status
- func Error(msg string) Status
- func Errorf(format string, a ...any) Status
- func ExternalError(msg string) Status
- func ExternalErrorf(format string, a ...any) Status
- func Forbidden(msg string) Status
- func Forbiddenf(format string, a ...any) Status
- func New(code Code, msg string) Status
- func Newf(code Code, format string, a ...any) Status
- func Nonef(format string, a ...any) Status
- func NotFound(msg string) Status
- func NotFoundf(format string, a ...any) Status
- func OKf(format string, a ...any) Status
- func ParseError(msg string) Status
- func ParseErrorf(format string, a ...any) Status
- func Recover(e any) Status
- func RecoverStack(e any) (Status, []byte)
- func Redirect(msg string) Status
- func Redirectf(format string, a ...any) Status
- func Rollback(msg string) Status
- func Rollbackf(format string, a ...any) Status
- func Test(message string) Status
- func Testf(format string, a ...any) Status
- func Timeoutf(format string, a ...any) Status
- func Unauthorized(msg string) Status
- func Unauthorizedf(format string, a ...any) Status
- func Unavailable(msg string) Status
- func Unavailablef(format string, a ...any) Status
- func Unsupported(msg string) Status
- func Unsupportedf(format string, a ...any) Status
- func WrapChecksumError(err error) Status
- func WrapChecksumErrorf(err error, format string, a ...any) Status
- func WrapError(err error) Status
- func WrapErrorf(err error, format string, a ...any) Status
- func WrapExternalError(err error) Status
- func WrapExternalErrorf(err error, format string, a ...any) Status
- func WrapParseError(err error) Status
- func WrapParseErrorf(err error, format string, a ...any) Status
- func (s Status) Cancelled() bool
- func (s Status) OK() bool
- func (s Status) String() string
- func (s Status) ToError() error
- func (s Status) WithCode(code Code) Status
- func (s Status) WithError(err error) Status
- func (s Status) WrapText(msg string) Status
- func (s Status) WrapTextf(format string, a ...any) Status
Constants ¶
This section is empty.
Variables ¶
var ( OK = New(CodeOK, "") None = New(CodeNone, "") )
var ( End = New(CodeEnd, "") Wait = New(CodeWait, "") )
var ( Closed = New(CodeClosed, "") Cancelled = New(CodeCancelled, "") Timeout = New(CodeTimeout, "") )
Functions ¶
Types ¶
type Code ¶
type Code string
const ( // CodeNone indicates an undefined status code. CodeNone Code = "" // CodeOK indicates that an operation completed successfully. CodeOK Code = "ok" // CodeTest is a status code for testing. CodeTest Code = "test" )
General class
const ( // CodeError indicates an internal general purpose error. CodeError Code = "error" // CodeExternalError indicates an external error, i.e. an invalid argument, validation error, etc. CodeExternalError Code = "external_error" )
Error class
const ( // CodeNotFound indicates that an object is not found. CodeNotFound Code = "not_found" // CodeForbidden indicates that an operation is forbidden. CodeForbidden Code = "forbidden" CodeUnauthorized Code = "unauthorized" )
Invalid class
const ( // CodeClosed indicates that an object is closed and cannot be used anymore. CodeClosed Code = "closed" // CodeCancelled indicates that an operation was cancelled or stopped on a request. CodeCancelled Code = "cancelled" // CodeRedirect indicates that an operation was redirected. CodeRedirect Code = "redirect" // CodeTimeout indicates that an operation timed out. CodeTimeout Code = "timeout" CodeUnavailable Code = "unavailable" // CodeUnsupported indicates that an operation is not supported or not implemented. CodeUnsupported Code = "unsupported" )
Unavailable class
const ( // CodeEnd indicates a file/channel/stream end. CodeEnd Code = "end" // CodeWait indicates that the caller should wait for the next events/messages/etc. CodeWait Code = "wait" )
Iteration/streaming class
type Status ¶
Status represents an operation status.
func Cancelledf ¶
Cancelledf formats a message and returns a cancelled status.
func ChecksumError ¶
ChecksumError returns a data corruption error status.
func ChecksumErrorf ¶
ChecksumErrorf formats and returns a data corruption error status.
func ConcurrencyError ¶
ConcurrencyError returns a concurrency error status.
func ConcurrencyErrorf ¶
ConcurrencyErrorf formats a message and returns a concurrency error status.
func ExternalError ¶
ExternalError returns an external error status.
func ExternalErrorf ¶
ExternalErrorf formats and returns an external error status.
func Forbiddenf ¶
Forbiddenf formats a message and returns a forbidden status.
func ParseError ¶
ParseError returns a data corruption error status.
func ParseErrorf ¶
ParseErrorf formats and returns a data corruption error status.
func RecoverStack ¶
RecoverStack recovers from a panic and returns an internal error status and a stack trace.
func Unauthorized ¶
Unauthorized returns an unauthorized status.
func Unauthorizedf ¶
Unauthorizedf formats a message and returns an unauthorized status.
func Unavailablef ¶
Unavailablef returns an unavailable status and formats its message.
func Unsupportedf ¶
Unsupportedf returns an unsupported status and formats its message.
func WrapChecksumError ¶
WrapChecksumError returns a data corruption error status.
func WrapChecksumErrorf ¶
WrapChecksumErrorf formats and returns a data corruption error status.
func WrapErrorf ¶
WrapErrorf formats and returns an internal error status.
func WrapExternalError ¶
WrapExternalError returns an external error status.
func WrapExternalErrorf ¶
WrapExternalErrorf formats and returns an external error status.
func WrapParseError ¶
WrapParseError returns a data corruption error status.
func WrapParseErrorf ¶
WrapParseErrorf formats and returns a data corruption error status.