OData error responses may contain annotations in any of its JSON objects. This is from the OData JSON format document (Section 21.1)
This is very important specially for Client Errors (HTTP code 4xx) when the server wants to pass some more information along with the standard error properties.
I am working with Redfish APIs, which is built on top of OData protocol. The Redfish error response always contains an annotated object associated with it. From it's specification document the error object has the following properties:
|code||String. Defines a MessageId from the Message Registry.|
|message||Displays a human-readable error message that corresponds to the Message in the Message Registry.|
|@Message.ExtendedInfo||Displays an array of Message objects. Describes one or more error messages.|
In Olingo, when we are getting the ODataClientErrorException object, it contains all the properties as specified by OData protocol, like code, messege, target, list of details and innererror. But when the error response contains an annotated object, like from Redfish, we are not able to get hold of it through ODataClientErrorException object. Also there is no way to get the Raw error response back, so that we can retrieve the annotated object from it.
I my case it has become a hurdle to get the annotated object from error response. I could not find any way to get hold of it while using Olingo. And I think it will be very helpful and sometimes necessary to include the annotated object some how in the ODataClientErrorException object. It may include an Olingo Entity, from where we can retrieve the data.