Mule APIKit Include Reason in 400 error

1.1k Views Asked by At

I have a raml doc the specifies my request data structure with a field like the following:

    "EstInstallDate": {
  "description": "the estimated date that the installation will be completed",
  "type": "string",
  "format": "date"
}

this is great, because when the APIkit is hit, a MessageException is raise with the following text:

string "2016-32-32" is invalid against requested date format(s) yyyy-MM-dd

but the generic 400 error payload is jsut "bad request" I would like to include this error message in the response payload.

how do i do this?

1

There are 1 best solutions below

0
On BEST ANSWER

I found that in my exception block i can access

exception.message

to get the full string of the error. however, it would be great to include which field failed the validation