{"modulePath":"github.com/cloudness-io/cloudness","version":"v0.0.2-alpha.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package errors\n\n## Functions\n\n```go\nfunc As(err error, target any) bool\n```\n\n```go\nfunc Details(err error) map[string]any\n```\nDetails unwraps an error and returns its details.\n\n```go\nfunc Is(err error, target error) bool\n```\n\n```go\nfunc IsAborted(err error) bool\n```\nIsAborted checks if err is aborted error.\n\n```go\nfunc IsBadRequest(err error) bool\n```\nIsBadRequest checks if err is bad request error.\n\n```go\nfunc IsConflict(err error) bool\n```\nIsConflict checks if err is conflict error.\n\n```go\nfunc IsInternal(err error) bool\n```\nIsInternal checks if err is internal error.\n\n```go\nfunc IsInvalidArgument(err error) bool\n```\nIsInvalidArgument checks if err is invalid argument error.\n\n```go\nfunc IsNotFound(err error) bool\n```\nIsNotFound checks if err is not found error.\n\n```go\nfunc IsPreconditionFailed(err error) bool\n```\nIsPreconditionFailed checks if err is precondition failed error.\n\n```go\nfunc IsType[T error](err error) bool\n```\nIsType returns true if err is of type T.\n\n```go\nfunc Message(err error) string\n```\nMessage unwraps an error and returns its message.\n\n```go\nfunc New(text string) error\n```\n\n## Types\n\n```go\ntype Error struct {\n\t// Machine-readable status code.\n\tStatus Status\n\n\t// Human-readable error message.\n\tMessage string\n\n\t// Source error\n\tErr error\n\n\t// Details\n\tDetails map[string]any\n}\n```\n\n```go\nfunc Aborted(format string, args ...interface{}) *Error\n```\nAborted is a helper function to return aborted error status.\n\n```go\nfunc AsError(err error) (e *Error)\n```\nAsError return err as Error.\n\n```go\nfunc BadRequest(format string, args ...interface{}) *Error\n```\nBadRequest is a helper function to return an bad request Error.\n\n```go\nfunc Conflict(format string, args ...interface{}) *Error\n```\nConflict is a helper function to return an conflict Error.\n\n```go\nfunc Failed(format string, args ...interface{}) *Error\n```\nFailed is a helper function to return failed error status.\n\n```go\nfunc Format(code Status, format string, args ...interface{}) *Error\n```\nFormat is a helper function to return an Error with a given status and formatted message.\n\n```go\nfunc Internal(err error, format string, args ...interface{}) *Error\n```\nInternal is a helper function to return an internal Error.\n\n```go\nfunc InvalidArgument(format string, args ...interface{}) *Error\n```\nInvalidArgument is a helper function to return an invalid argument Error.\n\n```go\nfunc NotFound(format string, args ...interface{}) *Error\n```\nNotFound is a helper function to return an not found Error.\n\n```go\nfunc PreconditionFailed(format string, args ...interface{}) *Error\n```\nPreconditionFailed is a helper function to return an precondition failed error.\n\n```go\nfunc (e *Error) Error() string\n```\nError implements the error interface.\n\n```go\nfunc (e *Error) SetDetails(details map[string]any) *Error\n```\n\n```go\nfunc (e *Error) SetErr(err error) *Error\n```\n\n```go\nfunc (e *Error) Unwrap() error\n```\n\n```go\ntype Status string\n```\n\n```go\nconst (\n\tStatusConflict           Status = \"conflict\"\n\tStatusInternal           Status = \"internal\"\n\tStatusInvalidArgument    Status = \"invalid\"\n\tStatusNotFound           Status = \"not_found\"\n\tStatusBadRquest          Status = \"bad_request\"\n\tStatusNotImplemented     Status = \"not_implemented\"\n\tStatusUnauthorized       Status = \"unauthorized\"\n\tStatusFailed             Status = \"failed\"\n\tStatusPreconditionFailed Status = \"precondition_failed\"\n\tStatusAborted            Status = \"aborted\"\n)\n```\n\n```go\nfunc AsStatus(err error) Status\n```\nAsStatus unwraps an error and returns its code. Non-application errors always return StatusInternal.\n\n","path":"github.com/cloudness-io/cloudness/errors","name":"errors","synopsis":"","isRedistributable":true}
