Handling DB Constraint violation error for required field

Certified Senior Developer

 I am using a a!writeToDataStoreEntity function inside a webAPI to write data to a table. If there is any constraint violation, I am not able to handle it properly, instead the calling service receives a 500 Internal Server Error. Is there a way to give a json response back in this case when there is a DB constraint violation error. The error I see in webAPI  is as below:

com.appiancorp.core.expr.portable.Value cannot be cast to com.appiancorp.core.data.Variant

  Discussion posts and replies are publicly visible