Skip to content

CdsServiceClient - unspecific error messages are returned #45

Closed

Description

@stvonolf

Hi,
It seems after you switched from SOAP to WebAPI backend, the error messages returned by the CdsServiceClient are very generic.

Examples:

  • Create entity with missing mandatory attribute:
    Microsoft.Rest.HttpOperationException: 'Operation returned an invalid status code 'BadRequest''
    Expected: more specific exception indicating missing/invalid attributes of entity

  • Create entity using impersonation - passing invalid CallerId (random Guid)
    JsonReaderException: Bad JSON escape sequence: \x. Path '_error', line 1, position 170.
    Expected: exception indicating that callerId is invalid

There might be more cases like that - please verify.

Regards,
Stefan

Activity

  1. MattB-msft commented on Aug 20, 2020

    @MattB-msft
    Member

    Some of this is a byproduct of the webAPI error reporting levels today.
    the team is making progress on improving the error reporting there to be more useful.

    We will have a look at the particular errors your pointing at and see if there is a miss in interfering in the client.

    thanks for raising this issue.

    MattB

  2. MattB-msft commented on Aug 20, 2020

    @MattB-msft
    Member

    Took a look at this and there are a few things here..

    1. yes.. the errors between webAPI and OrgService are not consistent, I am raising that to the API team currently.

    2. the actual error is being reported by the CDS client.
      The Exception of "Bad Request" is accurate... its a HttpOperationException, you can decode that to get to the messages.
      We do attach the decoded message as LastError in the CdsService Client..

    For example:
    trying to create an account entry passing an invalid property results in a LastCdsError of :
    ************ HttpOperationException - POST contacts : User Defined |=> An error occurred while validating input parameters: Microsoft.OData.ODataException: Does not support untyped value in non-open type.

    and an Exception of type HttpOperationException will be in the LastCdsExecption, and thrown if your using the basic IOrganziation Service Cmds.

    ** Edit:..
    We are going to add a new Exception to the Client to help out with this... CdsClientOperationException. we will thow that whenever we are using the WebAPI and fault, that will allow us to move up the error message to the top of the message queue so you do not have to dig down to see it.

  3. linked a pull request that will close this issueRelease/update/200826083404 #49on Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions