API reference
Err
A failure value with a category, message, details, causes, and partial result. Err.NOT_FOUND and related names are shared values. join() retains independent failures, and find() searches every cause.
Properties
msg: Stringkind: ErrA failure value with a category, message, details, causes, and partial result. Err.NOT_FOUND and related names are shared values. join() retains independent failures, and find() searches every cause.
info: Dictionarycause: ErrA failure value with a category, message, details, causes, and partial result. Err.NOT_FOUND and related names are shared values. join() retains independent failures, and find() searches every cause.
causes: Arraypartial: Variant
Constants
ERROR = ErrNOT_FOUND = ErrPERMISSION_DENIED = ErrALREADY_EXISTS = ErrINVALID_DATA = ErrTIMED_OUT = ErrINTERRUPTED = ErrUNSUPPORTED = ErrUNAUTHENTICATED = ErrLIMITED = Err
Methods
not_found(msg: String = "") -> Errpermission_denied(msg: String = "") -> Erralready_exists(msg: String = "") -> Errinvalid_data(msg: String = "") -> Errtimed_out(msg: String = "") -> Errinterrupted(msg: String = "") -> Errunsupported(msg: String = "") -> Errunauthenticated(msg: String = "") -> Errlimited(msg: String = "") -> Errfrom(reason: Variant, kind: Err = null) -> Errjoin(errors: Array) -> Erras_kind(kind: Err) -> Errnote(msg: String, info: Dictionary = { }) -> Errwith_partial(value: Variant) -> Errfind(target: Variant, where: Dictionary = { }) -> Errtext() -> Stringname_of(kind: Err) -> Stringnames() -> PackedStringArray
not_found
not_found(msg: String = "") -> ErrReport a missing target with optional detail.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | "" | Message text associated with this operation. |
Return value
Err
Errors
Returns an Err object directly, not a value-and-error pair. An absent error is null; inspect the method description to distinguish creation, lookup, and stored failure.
permission_denied
permission_denied(msg: String = "") -> ErrReport rejected access with optional detail.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | "" | Message text associated with this operation. |
Return value
Err
Errors
Returns an Err object directly, not a value-and-error pair. An absent error is null; inspect the method description to distinguish creation, lookup, and stored failure.
already_exists
already_exists(msg: String = "") -> ErrReport a duplicate target with optional detail.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | "" | Message text associated with this operation. |
Return value
Err
Errors
Returns an Err object directly, not a value-and-error pair. An absent error is null; inspect the method description to distinguish creation, lookup, and stored failure.
invalid_data
invalid_data(msg: String = "") -> ErrReport malformed input with optional detail.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | "" | Message text associated with this operation. |
Return value
Err
Errors
Returns an Err object directly, not a value-and-error pair. An absent error is null; inspect the method description to distinguish creation, lookup, and stored failure.
timed_out
timed_out(msg: String = "") -> ErrReport an expired deadline with optional detail.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | "" | Message text associated with this operation. |
Return value
Err
Errors
Returns an Err object directly, not a value-and-error pair. An absent error is null; inspect the method description to distinguish creation, lookup, and stored failure.
interrupted
interrupted(msg: String = "") -> ErrReport interrupted work with optional detail.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | "" | Message text associated with this operation. |
Return value
Err
Errors
Returns an Err object directly, not a value-and-error pair. An absent error is null; inspect the method description to distinguish creation, lookup, and stored failure.
unsupported
unsupported(msg: String = "") -> ErrReport unavailable behavior with optional detail.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | "" | Message text associated with this operation. |
Return value
Err
Errors
Returns an Err object directly, not a value-and-error pair. An absent error is null; inspect the method description to distinguish creation, lookup, and stored failure.
unauthenticated
unauthenticated(msg: String = "") -> ErrReport failed authentication with optional detail.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | "" | Message text associated with this operation. |
Return value
Err
Errors
Returns an Err object directly, not a value-and-error pair. An absent error is null; inspect the method description to distinguish creation, lookup, and stored failure.
limited
limited(msg: String = "") -> ErrReport exhausted capacity with optional detail.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | "" | Message text associated with this operation. |
Return value
Err
Errors
Returns an Err object directly, not a value-and-error pair. An absent error is null; inspect the method description to distinguish creation, lookup, and stored failure.
from
from(reason: Variant, kind: Err = null) -> ErrConvert a reason while retaining the selected shared category.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
reason | Variant | Required | Failure reason to retain in the result. |
kind | Err | null | Error kind used for classification and matching. |
Return value
Err
Errors
Returns an Err object directly, not a value-and-error pair. An absent error is null; inspect the method description to distinguish creation, lookup, and stored failure.
join
join(errors: Array) -> ErrCombine two independent native failures without building a script array.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
errors | Array | Required | Independent Err values to retain; null entries are ignored. |
Return value
Err
Errors
Returns an Err object directly, not a value-and-error pair. An absent error is null; inspect the method description to distinguish creation, lookup, and stored failure.
as_kind
as_kind(kind: Err) -> ErrReclassify an error with a shared category value.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
kind | Err | Required | Error kind used for classification and matching. |
Return value
Err
Errors
Returns an Err object directly, not a value-and-error pair. An absent error is null; inspect the method description to distinguish creation, lookup, and stored failure.
note
note(msg: String, info: Dictionary = { }) -> ErrAdd context and optional info fields to a new error value while retaining this value as its cause. New fields override copied fields only on the new value.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | Required | Message text associated with this operation. |
info | Dictionary | { } | Additional structured information attached to the error. |
Return value
Err
A new Err with the original error as its cause.
Errors
Returns an Err object directly, not a value-and-error pair. An absent error is null; inspect the method description to distinguish creation, lookup, and stored failure.
Examples
return Err.NOT_FOUND.note("fetch item", {"code": "E_0008"})See also
with_partial
with_partial(value: Variant) -> ErrAttach completed work to a new error without changing the original.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value | Variant | Required | Value to store, serialize, validate or pass to the operation described above. |
Return value
Err
Errors
Returns an Err object directly, not a value-and-error pair. An absent error is null; inspect the method description to distinguish creation, lookup, and stored failure.
find
find(target: Variant, where: Dictionary = { }) -> ErrSearch this error and its causes. An Err target matches a shared category or an exact value; a dictionary target matches info fields on one error value. Every supplied field and its value type must match.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
target | Variant | Required | Shared category, exact Err value, or a nonempty dictionary of info fields to match. |
where | Dictionary | { } | Optional info fields matched on the same Err value as the target. |
Return value
Err
The first matching Err value, or null when none matches. An empty search dictionary does not match.
Errors
Returns an Err object directly, not a value-and-error pair. An absent error is null; inspect the method description to distinguish creation, lookup, and stored failure.
Examples
var conflict := e.find({"source": "postgres", "code": "40001"})
var missing := e.find(Err.NOT_FOUND, {"code": "E_0008"})See also
text
text() -> StringReturn a one-line description including causes.
Parameters
No parameters.
Return value
String
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
name_of
name_of(kind: Err) -> StringSpell the category represented by a shared error value.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
kind | Err | Required | Error kind used for classification and matching. |
Return value
String
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
names
names() -> PackedStringArrayList the category attributes exposed by the error class.
Parameters
No parameters.
Return value
PackedStringArray
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.