Transformation Errors
Availability
Use of the production Forward API is subject
to eligibility. Contact your Account Manager for more information or
submit an inquiry to our Business Development team.
- json
{
"error": "Received invalid transformation. Does not type check",
"message": {
"transformation_error?": true,
"expression": ["not_a_real_function", 1],
"type_errors": ["Function \"not_a_real_function\" does not exist"]
},
"request-uuid": "a-unique-identifier-for-the-request"
}
Error | Explanation | Additional `message` fields |
---|---|---|
Received invalid transformation. Does not type check | One or more type errors were found. | type_errors : An array of type errors
|
Transformations must return one of boolean, nil, number, string | All Forward API functions must return a type that can be serialized. | return_type : The type currently returned by the transformation |
Invalid expiration year | The year argument passed to the format_expiration function was a valid string but not a
valid year. | expiration_year : The invalid value passed for the year |
Invalid expiration month | The month argument passed to the format_expiration function was a valid string but not
a valid month (01 - 12). | expiration_month : The invalid value passed for the month |
encode received an unsupported charset | The first argument (charset) was not a valid character encoding. | charset : the provided charset |
integer received a non-numeric string | The argument was a valid string but could not be parsed as an integer. | None |
slice index range out of bounds for value length | The provided substring start and end index are out of bounds for the given string value | slice-start : given start index (inclusive)\n
|
slice-stop: given end index (exclusive) value-string: given string value value-length: given string length
Type errors
Before the Forward API performs a transformation, it first type checks the transformation to ensure
correctness. All type errors have
Received invalid transformation. Does not type check
as the error
field.
In the message
they all include "transformation_error?": true
and the
triggering transformation as the expression
, so those fields aren't listed below. The
type_errors
field contains a list of errors detected by the type checker. There are
three categories of type error:
Type error category | Example type error | Explanation |
---|---|---|
Invalid arity | Function "join" expects 2 arguments but received 1 of them. | The function was given an unexpected number of arguments. |
Invalid argument type | "join" arg 0: expected string but received number | A function was called with an incorrect argument type. Arguments are 0-indexed. |
Invalid function name | Function "not_a_real_function" does not exist | A function that doesn't exist was called. |