Skip to main content
October 28, 2024
Question

web API Endpoint - Display actual Error instead of Generic Message

  • October 28, 2024
  • 4 replies
  • 0 views

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"
}
)
)

    4 replies

    stefanhelzle0001
    Brainy
    October 28, 2024

    Hm ... assuming that you use a!writeRecords, according to the documentation there should be some information available.

    https://docs.appian.com/suite/help/24.3/Write_Records_Smart_Service.html#parameters

    arunr0008Author
    October 28, 2024

    Using a!writeToDataStoreEntity

    somasundaram.d
    October 29, 2024

    AFAIK, There is no easy way to show the detailed error message. Usually, I would include a text to contact the administrator.

    mikes0011
    Brainy
    October 29, 2024

    You can send back pretty much whatever detail you want in an API http response of course, but I don't know how much detail (if any) we can get from the onError of a!writeToDataStoreEntity...