Set Error Details node
The Set Error Details node adds details to the JSON response when a journey ends in an error. You can configure the node properties to:
-
Return an error message.
-
Include extra information in the response body in the form of static
key:valuefields. -
Set custom response headers. RAPID only
You can’t modify the protected HTTP headers, nor can you modify the session cookie or load balancer cookie using the
Set-Cookieheader.Protected HTTP headers
-
X-Frame-Options -
X-Content-Type-Options -
Cache-Control -
Content-API-Version -
Expires -
Pragma -
Content-Type -
Content-Length -
Date -
Keep-Alive -
Connection -
Transfer-Encoding -
Server -
Trailer -
Upgrade
-
Place the Set Error Details node before the node that errors in the journey.
Examples
Example 1: Handle identity assertion errors
This example uses the Set Error Details node to handle errors from the Identity Assertion node when the journey ends in an error.
-
The Set Error Details node adds details to the JSON response when the journey ends in an error. This example uses the following configuration:
- Error Message
-
-
Key:
en-gb -
Value:
Identity assertion failure
-
- Error Details
-
-
Key:
errorUrl -
Value:
https://example.com/error
-
-
The Identity Assertion node is configured as described in the documentation.
If an error is encountered, the Set Error Details node displays the configured message to the user and adds both the message and the details to the JSON response.
For example:
{ "code": 401, "reason": "Unauthorized", "message": "Identity assertion failure", "detail": { "errorUrl": "https://example.com/error" } }
Example 2: Set custom response headers
RAPID only
This example uses the Set Error Details node to set a Custom-Error response header when the journey ends in an error. This header could be read by a custom UI or a legacy application to trigger a specific action when an error is encountered.
To simulate an error for demonstration purposes, this simple login journey includes a script that errors.
-
The Page node containing the Platform Username node and Platform Password node prompts for credentials.
-
The Data Store Decision node validates the username-password credentials.
-
The Set Error Details node sets the response header when the journey ends in an error. This example uses the following configuration:
- Response Headers
-
Key:
Custom-ErrorValue:
error-encountered
-
The Scripted Decision node calls the following script, which expects an outcome of
nextbut the node is configured with an outcome oftrue:action.goTo("next");When the script runs, the journeys ends in an error because the
nextoutcome doesn’t exist. The Set Error Details node sets the configured response header.
Follow these steps to try the example:
-
Create the example journey using the journey editor.
-
Authenticate a test user with the journey. Make sure you include the
--show-headersoption (or--includein oldercurlversions) to return the response headers:$ curl --show-headers \ --request POST \ --header 'X-OpenAM-Username: bjensen' \ --header 'X-OpenAM-Password: Ch4ng3it!' \ --header "Accept-API-Version: resource=2.1, protocol=1.0" \ "https://tenant-env-fqdn/am/json/realms/root/realms/alpha/authenticate?authIndexType=service&authIndexValue=myJourney" HTTP/1.1 401 X-Frame-Options: SAMEORIGIN X-Content-Type-Options: nosniff ... Custom-Error: error-encountered ... { "code":401, "reason":"Unauthorized", "message":"Login failure" }
Availability
| Product | Available? |
|---|---|
PingOne Advanced Identity Cloud |
Yes |
PingAM (self-managed) |
Yes |
Ping Identity Platform (self-managed) |
Yes |
Configuration
| Property | Usage | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Error Message |
The message to add to the JSON response when a journey ends in an error. Add a custom, localized message per locale:
|
||||||||||||
Error Details |
The details to add to the JSON response when a journey ends in an error:
|
||||||||||||
Response Headers RAPID only |
The response headers to set:
When finished, click Save to keep your settings. |
(1) Specify a
locale that Java supports, such as en-gb. Otherwise, the node throws a configuration exception with an Invalid locale provided message.