This example demonstrates the configuration of a custom error template for a Sideband API Endpoint called Test API.
The following fields are associated with the error responses that use this error template:
code
message
To create the error template, perform the following steps:
- Create a file named error-template.vtl with the following contents:
#set ($code = "UNEXPECTED_ERROR") #if($status == 403) #set ($code = "ACCESS_FAILED") #end { "code":"$code", "message":"$message" }
- Add the error template to the configuration.
dsconfig create-error-template \ --template-name "Custom Error Template" \ --set "velocity-template<error-template.vtl"
- Assign the error template to the Sideband API Endpoint.
dsconfig set-sideband-api-endpoint-prop \ --endpoint-name "Test API" \ --set "error-template:Custom Error Template"
The error template is used whenever the Sideband API generates an error in response to a request.