autorest icon indicating copy to clipboard operation
autorest copied to clipboard

The error message is general, need to specify the server exception message

Open pomortaz opened this issue 10 years ago • 2 comments

In C# the AutoRest generated code throws an exception if the status code is not expected:

var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));

The exception message is very general and does not contain the server error message that is returned for example in 'error.message' field. In swagger spec we need a way to specify where the generated code should find the server error message and throws with that message if available. e.g.:

      "default": {
        "x-ms-errorMessage": "error.message"
        "schema": {
          "$ref": "#/definitions/KeyVaultError"
        }

pomortaz avatar Jun 01 '16 17:06 pomortaz

As we move to standardize error messages, this will be needed to define where the message resides inside of the body.

I think this also goes hand-in-hand with the work toward polymorphic discrimination based on error code (from the error body).

devigned avatar Jun 01 '16 18:06 devigned

Howdy!

In our planning for driving towards a stable '1.0' release, I'm marking this issue as 'deferred' :zzz: and we're going to review it during the post-1.0 planning cycle.

It's not to say that we're not going to work on it, or that this isn't not important, but at the moment, we're picking and choosing the stuff we must do before 1.0. :horse_racing: :horse_racing: :horse_racing:

We'll make sure we pick this back up at that point. :tada:

fearthecowboy avatar Jun 15 '16 16:06 fearthecowboy