// if Batch mode as well private void ProcessDataServiceRequest(DataServiceRequestException dsre) { if (dsre.InnerException != null) { string jsonResponse = dsre.InnerException.Message; // Some messages are not json formatted // check the exact format! (Java vs .Net) try { ODataServiceSdlResponse response = JsonConvert.DeserializeObject <ODataServiceSdlResponse>(jsonResponse); this.errorMessage = response.Error.Message; if (response.Error.InnerMessage != null) { this.errorExtraMessage = response.Error.InnerMessage.Message; } } catch (Exception jsonEx) { this.errorMessage = jsonResponse; } } else { this.errorMessage = dsre.Message; } }
private void ProcessDataServiceClient(DataServiceClientException dsce) { var new_Ex = dsce.GetBaseException() as Microsoft.OData.Client.DataServiceClientException; string jsonResponse = new_Ex.Message; this.statusCode = new_Ex.StatusCode; switch (this.statusCode) { case HTTP_STATUS_CODE_UNAUTHORIZED: ODataServiceSpringResponse response401 = JsonConvert.DeserializeObject <ODataServiceSpringResponse>(jsonResponse); this.errorMessage = response401.Message; break; default: ODataServiceSdlResponse response = JsonConvert.DeserializeObject <ODataServiceSdlResponse>(jsonResponse); this.errorMessage = response.Error.Message; break; } }