fastly.error
STRING, can be read and unset
, but not set
.
Available inall subroutines.
Contains the last error code raised, otherwise not set
.
Some functions that can raise errors don't unset fastly.error
upon being
called. When error-checking an important operation, you can ensure you're
responding only to relevant errors by unsetting fastly.error
beforehand:
declare local var.key STRING = ...;declare local var.iv STRING = ...;declare local var.ciphertext STRING = ...;declare local var.plaintext STRING;
# ... unrelated calls that may produce errors ...
# Clear fastly.error before an important operationunset fastly.error;set var.plaintext = crypto.decrypt_hex(aes256, cbc, nopad, var.key, var.iv, var.ciphertext);
# If fastly.error is set here, we're certain it's due to the call we're concerned withif (fastly.error == "EBADDECRYPT") { error 403 "Wrong key";} else if (fastly.error) { error 503;}
States
Value | Description |
---|---|
EBADDECRYPT | Decryption failed. Produced when the wrong key or IV are used. |
EPARSENUM | Number parsing failed. Claimed to be produced by std.strtol but currently not possible. |
ERANGE | Numerical result out of range. |
EREG | Call to regex routine failed (generic). |
EREGRECUR | Call to regex routine failed because of recursion limits. |
EREGSUB | Call to regex routine failed (generic). |
ESESOOM | Out of workspace memory. |
EDOM | Domain error. This occurs for a mathematical function which is not defined for a particular value; formally, that value is not considered part of its input domain. For example, division by zero, or var.x %= 5; where var.x is a floating point infinity. |
ESYNTHOOM | Synthetic response overflow. |
EUTF8 | Invalid UTF-8. |
EUNAVAIL | Data temporarily unavailable. |
EINVAL | Invalid argument. |