Azure / autorest.python

Extension for AutoRest (https://github.com/Azure/autorest) that generates Python code
MIT License
79 stars 57 forks source link

BUG: Get exception when delete operation completed successfully (v6.16.0) #2736

Closed hyang691 closed 1 month ago

msyyc commented 2 months ago

I will take an investigation asap

msyyc commented 2 months ago

Hi @hyang691 Usually 401/403 is error code and shall throw error for SDK users. Could you try to add @error for the Error like ?:

@error
model Error {
  @statusCode statusCode:
      | 403
      | 401; 

      id: string;
      /** The code of the error. */
      code: string;
      /** The message in case of a blocking error in calculation. */
      message: string;
      /** The status of the error. */
      status?: string;
};
hyang691 commented 2 months ago

it works, thanks.

hyang691 commented 1 month ago

Thank @msyyc for your great support, look forward the latest version. :)

msyyc commented 1 month ago

After discussion, Python team thinks your tsp doesn't follow API design principal so it is better to update the tsp. It shall be OK if you change model ErrorResponse to alias ErrorResponse like:


alias ErrorResponse = {
  id: string;
  /** The code of the error. */
  code: string;
  /** The message in case of a blocking error in calculation. */
  message: string;
  /** The status of the error. */
  status?: string;

};

@error
model Error  {
  @statusCode statusCode:
      | 403
      | 500
      | 401; 

     ...ErrorResponse;
};