Error code mapping
The error code mapping feature in the Connector Development Kit allows you to link connector error codes to standardized IBM App Connect error codes. By mapping specific error codes and defining conditions, you can choose whether to display the error codes from the connector or the predefined error codes in App Connect. This feature also helps ensure consistency and standardization across your connector.
Fields for error code mapping
The following fields are used for error code mapping:
Field | Data type | Mandatory or Optional | Description |
---|---|---|---|
Error code(s) | Array | Mandatory | A list of error codes for which a mapping is created from CDK. You can either specify the error code in numeric format between 100 and 199 or between 300 and 599 (the error codes can
be one or more comma-separated values), or specify the error code value in a wildcard format 1XX , 3XX , 4XX or 5XX (the error codes can only be a single value). Examples: [401] ,
[402, 403, 501] , [4xx] , [5xx] . |
Condition | String | Optional (mandatory for wildcard error code) | Condition can take "contains" or "not contains" values. It is used at run time to check whether the HTTP error contains or does not contain a particular substring. |
Search text | String | Optional (mandatory for wildcard error code) | Substring value to be searched in the HTTP error response. This property is used together with the condition property. |
Return error code | Number | Mandatory | Standard App Connect error code to which the internal error codes are mapped. Possible values: 400 , 401 , 403 , 404 , 408 , 500 , 502 , 503 ,
504 , and 429 . |
Mapping an error code
To map an error code, complete the following steps:
- Go to the Connector Development Kit home page and select the connector you want to work with.
- Click an action in the Actions tab, and then go to the Response tab.
- Under Error code mapping, click Map new error code + to map a new error code.
- Specify the error code that you want to map in the connector, and then select a corresponding return error code from the dropdown to be displayed in App Connect.
- (Optional) Specify a condition and a search text to be searched for in the error response.
Example of mapping used in different scenarios
The following examples showcase different scenarios where error mapping can be applied and the corresponding output that appears during testing.
Scenario 1: No mapping applied
- Mapped error code: Not defined
- Return error code: Not defined
- Output when tested:
503
Scenario 2: Single error code with no condition or search text
- Mapped error code:
503
- Return error code:
429
- Output when tested:
429
Scenario 3: Comma-separated error codes with no condition or search text
- Mapped error codes:
400
,503
,500
- Return error code:
408
- Output when tested:
408
Scenario 4: Wildcard error code where condition and search text becomes mandatory
- Mapped error code:
5XX
- Return error code:
500
- Output when tested:
500
Scenario 5: Wildcard error code where the condition is 'contains' and the specified search text is present in the server response
- Mapped error code:
5XX
- Return error code:
500
- Output when tested:
500
Scenario 6: Wildcard error code where the condition is 'contains' and the specified search text is not present in the server response
- Mapped error code:
5XX
- Return error code:
500
- Output when tested:
503
Scenario 7: Wildcard error code where the condition is 'not contains' and the specified search text is present in the server response
- Mapped error code:
5XX
- Return error code:
500
- Output when tested:
503
Scenario 8: Wildcard error code where the condition is 'not contains' and the specified search text is not present in the server response
- Mapped error code:
5XX
- Return error code:
500
- Output when tested:
500
Scenario 9: Comma-separated error codes where the condition is 'contains' and the specified search text is present in the server response
- Mapped error codes:
400
,401
,402
- Return error code:
500
- Output when tested:
500
Scenario 10: Comma-separated error codes where the condition is 'contains' and the specified search text is not present in the server response
- Mapped error codes:
400
,401
,402
- Return error code:
500
- Output when tested:
400
Scenario 11: Comma-separated error codes where the condition is 'not contains' and the specified search text is present in the server response
- Mapped error codes:
400
,401
,402
- Return error code:
500
- Output when tested:
400
Scenario 12: Comma-separated error codes where the condition is 'not contains' and the specified search text is not present in the server response
- Mapped error codes:
400
,401
,402
- Return error code:
500
- Output when tested:
500