web API Endpoint There was an error writing to the data store - Get actual error

When we execute the API Endpoint to load the data in DB, we get Generic Error Message " 500 There was an error writing to the data store" 

Is there a way to capture the Actual Error message and Return it as a message instead of the above?

Example: 

Details: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value

Following is the code :onError: a!httpResponse(
statusCode: 500,
headers: {
a!httpHeader(name: "Content-Type", value: "application/json")
},
body: a!toJson(
{
error: "There was an error writing to the data store"
}
)
)

  Discussion posts and replies are publicly visible