Hi, in one of our services we use Sparkle/XData. When an endpoint call has invalid information in the body we raise an XDataHTTPException:
raise EXDataHTTPException.Create(422, '-112110', Format(rc_SchijfErrorProcBedrijven, [IntToStr(nErrorCount)]) );
This results in a response 422 with body:
{
"error": {
"code": "-112110",
"message": "Pre-processing the companies resulted in 1 problems"
}
}
However we would like to be able to show more error details to the clients, like:
{
"error": {
"code": "-112110",
"message": "Pre-processing the companies resulted in 2 problems",
"errors": [
{
"domain": "Company",
"reason": "required",
"message": "Company code missing (Albert Heijn FIL: C0)"
},
{
"domain": "Company",
"reason": "invalid",
"message": "Company code invalid (Albert Heijn FIL: C0)"
}
]
}
}
Is this somehow possible?