In my project, there is a RAD Server that handles access to an MSSQL Database. The client fires CRUD operations via REST to that Server, the Server handles the messages.
Now there is a field in a table that is configured as "unique index". When I try to create a row with an existing value in that field, I get a ekUKViolated
error message. My question is, how can I pass the error object (not the Message) inside my RAD Server to my client via the REST response? In the REST client, I only get an invalid typecasting error.
Response Code looks like that:
try
...
except
on e: Exception do
begin
AResponse.StatusCode := 400;
AResponse.Body.SetValue(TJSONString.Create(e.Message + ' - ' + e.ClassName), True);
Exit;
end;
end;