Transformation Errorsanchor

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.

Transformation errors are returned in the response body to your application. The body is a JSON structure with a format resembling this example:

  1. 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"
}
ErrorExplanationAdditional message fields
Received invalid transformation. Does not type checkOne or more type errors were found.type_errors: An array of type errors
Transformations must return one of boolean, nil, number, stringAll Forward API functions must return a type that can be serialized.return_type: The type currently returned by the transformation
Invalid expiration yearThe 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 monthThe 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 charsetThe first argument (charset) was not a valid character encoding.charset: the provided charset
integer received a non-numeric stringThe argument was a valid string but could not be parsed as an integer.None
slice index range out of bounds for value lengthThe provided substring start and end index are out of bounds for the given string valueslice-start: given start index (inclusive)

slice-stop: given end index (exclusive) value-string: given string value value-length: given string length

Type errorsanchor

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 categoryExample type errorExplanation
Invalid arityFunction "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 numberA function was called with an incorrect argument type. Arguments are 0-indexed.
Invalid function nameFunction "not_a_real_function" does not existA function that doesn't exist was called.

A transformation may return multiple type errors if multiple arguments have invalid types or if both arity and argument type(s) are invalid.