You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by Rob Sessink | Kramp <Ro...@kramp.com> on 2016/06/20 15:30:44 UTC

Providing ODataError in ODataServerErrorException

Hello all

when using Olingo in combination with Dynamis CRM WebApi, the API will provide an error response body (with innererror) on a exception on the server.
This error description could be very informative regarding the reason for the exception. An example would be:

{
  "error":{
    "code":"","message":"Creating this parental association would create a loop in Accounts hierarchy.","innererror":{
      "message":"Creating this parental association would create a loop in Accounts hierarchy.","type":"System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]","stacktrace":"   at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataExecutionContext.Upsert(Entity entity)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataExecutionContext.Update(Entity entity, UpdateOption updateOption)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataServiceDataProvider.UpdateEdmEntity(CrmODataExecutionContext context, String edmEntityName, String entityKeyValue, EdmEntityObject entityObject)\r\n   at Microsoft.Crm.Extensibility.OData.EntityController.PatchEntity(String entityName, String key, EdmEntityObject entityDelta)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
    }
  }
}

Currently only the HTTP statusline is sent back:
HTTP/1.1 500 Internal Server Error


In OdataErrorResponseChecker the ODataError is always placed into the ODataClientErrorException however for ODataServerErrorException the ODataError never set.
Would it make sense to optionaly also enrich ODataServerErrorException with ODataError? I could create a patch if this is welcomed.

Regards Rob



Rob Sessink

Integration Engineer





[cid:1.jpg]


[cid:Kramp_Logo.jpg]<http://www.kramp.com>


[cid:2.jpg]

[Facebook]<https://www.facebook.com/Kramp.Benelux> [Twitter] <https://twitter.com/krampgroup>  [Youtube] <https://www.youtube.com/user/krampgroep>  [Google Plus] <https://plus.google.com/+kramp>  [Linked In] <https://www.linkedin.com/company/kramp>







DISCLAIMER This e-mail message may contain confidential or privileged information and is intended solely for the individual to whom it is addressed. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. If you have received it in error, please notify us immediately by telephoning +31 315 254299, and destroy this e-mail and any attachments. E-mail transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission.


P  Save Paper - Do you really need to print this e-mail?