Raise Exception
El botón Raise Exception permite al administrador de la API editar su respuesta al cliente en caso de errores internos o relacionados con el interceptor.
Si ocurre un error, el objeto $call.flowError
es poblado con los siguientes atributos:
-
message
: valor que será exhibido en el cuerpo de la respuesta. -
httpErrorCode
: código de error que será retornado en la petición. -
position
: posición del interceptor en que ocurrió el error. -
interceptorType
: tipo del interceptor en que ocurrió el error.
Cómo usar
El botón está ubicando en el sector Flows, en el área donde se crea o modifica un interceptor, entre Request to Backend y Response to Client:
Al hacer clic en el botón Raise Exception, será abierto el editor, conforme aparece a continuación:
En el editor, será posible crear scripts para ejecutar en casos de excepción.
Cuando el flujo contenga un script creado a través del Raise Exception, será exhibido un botón diferente diciendo que se puede editar aquel script.
Para eliminar un script de Raise Exception, hacer clic en el X rojo junto al botón.
Tipos de interceptores y códigos de error
Tipo | Mensaje | Error en la Petición | Error en la Respuesta |
---|---|---|---|
AccessTokenValidation |
This Access Token is expired |
403 |
- |
AccessTokenValidation |
Access Token is in invalid state (PENDING, REVOKED, CANCELLED, REJECTED) |
403 |
- |
AccessTokenValidation |
Could not find a required Access Token in the request, identified by (location) (name) |
401 |
- |
JsonThreatProtection |
Json format invalid |
400 |
500 |
JsonThreatProtection |
Container depth limit exceeds the maximum allowed for this API (10) |
400 |
500 |
JsonThreatProtection |
Object entry count limit exceeds the maximum allowed for this API (10) |
400 |
500 |
JsonThreatProtection |
Object entry name length limit exceeds the maximum allowed for this API (10) |
400 |
500 |
JsonThreatProtection |
Array element count limit exceeds the maximum allowed for this API (30) |
400 |
500 |
JsonThreatProtection |
String value length limit exceeds the maximum allowed for this API (30) |
400 |
500 |
JsonThreatProtection |
JSON threat protection validation failed: Invalid Content-Type in Header → (Content type) |
415 |
415 |
JsonThreatProtection |
JSON threat protection validation failed: Content-Type not found in Header |
415 |
415 |
XMLThreatProtection |
XML format invalid |
400 |
500 |
XMLThreatProtection |
Name limits element exceeds the maximum allowed for this API (n) |
400 |
500 |
XMLThreatProtection |
Name limits attribute exceeds the maximum allowed for this API (n) |
400 |
500 |
XMLThreatProtection |
Name limits namespace prefix exceeds the maximum allowed for this API (n) |
400 |
500 |
XMLThreatProtection |
Name limits processing instruction target exceeds the maximum allowed for this API (n) |
400 |
500 |
XMLThreatProtection |
Structure limits node depth element exceeds the maximum allowed for this API (n) |
400 |
500 |
XMLThreatProtection |
Structure limits attribute count per element exceeds the maximum allowed for this API (n) |
400 |
500 |
XMLThreatProtection |
Structure limits namespace count per element exceeds the maximum allowed for this API (n) |
400 |
500 |
XMLThreatProtection |
Structure limits child count exceeds the maximum allowed for this API (n) |
400 |
500 |
XMLThreatProtection |
Value limits text exceeds the maximum allowed for this API (n) |
400 |
500 |
XMLThreatProtection |
Value limits attribute exceeds the maximum allowed for this API (n) |
400 |
500 |
XMLThreatProtection |
Value limits namespace URI exceeds the maximum allowed for this API (n) |
400 |
500 |
XMLThreatProtection |
Value limits comment exceeds the maximum allowed for this API (n) |
400 |
500 |
XMLThreatProtection |
Value limits processing instruction data exceeds the maximum allowed for this API (n) |
400 |
500 |
XMLThreatProtection |
XML threat protection validation failed: Invalid Content-Type in Header → (Content type) |
415 |
415 |
XMLThreatProtection |
XML threat protection validation failed: Content-Type not found in Header |
415 |
415 |
SqlThreatProtection |
SQL Injection attack identified in this API Body |
400 |
500 |
SqlThreatProtection |
SQL Injection attack identified in this API Headers |
400 |
500 |
SqlThreatProtection |
SQL Injection attack identified in this API Query Params |
400 |
500 |
TimeTokenValidation |
Could not find a required Time token in the request, identified by (location) (nome) |
403 |
- |
TimeTokenValidation |
Invalid time token in the request, identified by %s %s |
403 |
- |
TokenInterceptor |
Error generating token |
- |
500 |
TimeAllowed |
Time restriction for this API. Works only (hoursOfDay) |
429 |
- |
SpikeArrest |
urrent Spike Arrest Rate exceeds the maximum Rate of %s call each %s %s for this API |
429 |
- |
RestrictAccess |
Access denied for this environment. |
403 |
- |
RateLimit |
Current rate (%s) exceeds the maximum rate (%s) for this API |
429 |
- |
PayloadSize |
Request size (%s bytes) exceeds the maximum allowed size for this API (%s bytes) |
413 |
- |
JWT Validation |
JWT %s has an invalid signature |
403 |
- |
JWT Validation |
JWT is in invalid state %s, rejecting call |
403 |
- |
IP Filtering |
IP List cannot be null |
500 |
- |
IP Filtering |
Blocked access from your IP |
403 |
- |
Encrypt |
An error occurred during the encryption mode |
422 |
- |
Encrypt |
An error occurred during the encryption mode |
422 |
- |
DateTime |
The request is out of the accepted date range between: %s and %s" |
423 |
- |
Custom Interceptor |
Error during process custom interceptor '%s': %s |
500 |
- |
ClientID Validation |
Could not find a required APP in the request, identified by %s %s |
401 |
- |
ClientID Validation |
APP is in invalid state %s |
403 |
- |
CSRF Validation |
Could not find a required CSRF Token in the request, identified by %s, %s |
401 |
- |
CSRF Validation |
CSRFToken is expired |
403 |
- |
CSRF Validation |
Requests with different origins |
403 |
- |
Ejemplo
Verificar Error de Autorización 401:
var resp = {};
if ($call.flowError.httpErrorCode == 401 && $call.flowError.position == 1) {
resp.msg = "msg error";
} else {
resp.msg = "other msg";
}
$call.response.getBody().setString($json.stringify(resp), "utf-8");
$call.response.setHeader("Content-Type", "application/json");
Para información sobre cómo escribir un interceptor JavaScript personalizado, hacer clic aquí
Share your suggestions with us!
Click here and then [+ Submit idea]