fastly.error
STRING, can be read andunset, but notset.
Available inall subroutines.
Contains the last error code raised, otherwisenot set.
Some functions that can raise errors don't unsetfastly.error upon beingcalled. When error-checking an important operation, you can ensure you'reresponding only to relevant errors by unsettingfastly.error beforehand:
declare local var.keySTRING= ...;declare local var.ivSTRING= ...;declare local var.ciphertextSTRING= ...;declare local var.plaintextSTRING;# ... unrelated calls that may produce errors ...# Clear fastly.error before an important operationunsetfastly.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") {error403"Wrong key";}elseif (fastly.error) {error503;}States
| Value | Description |
|---|---|
EBADDECRYPT | Decryption failed. Produced when the wrong key or IV are used. |
EPARSENUM | Number parsing failed. Claimed to be produced bystd.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 inputdomain. For example, division by zero, orvar.x %= 5; wherevar.x is a floating point infinity. |
ESYNTHOOM | Synthetic response overflow. |
EUTF8 | Invalid UTF-8. |
EUNAVAIL | Data temporarily unavailable. |
EINVAL | Invalid argument. |