Hi All,
I have a RAML with below field with pattern and it gives me proper response as 400 Bad request if it fails pattern.
"requestNo": {
"type": "string",
"maxLength": 14,
"pattern": "^[0-9]+$"
},
"Customer":{
"type": "string",
"pattern": "[a-zA-Z]"
}
But I wanted to show field name and message saying as below :
400 Bad Request
{
"Field" : "Customer",
"Message":"Numbers are not allowed in customer field"
}
Hi @amitghorpa ,
you can extract the exception message using this commeent in logger
"# [groovy:message.getExceptionPayload().getRootException().getMessage()]"
but this is not working when we further use it in set payload
Please revert if you have came across any solution to read exception message from RAML.