Skip to content

Conversation

@msyyc
Copy link
Member

@msyyc msyyc commented Dec 5, 2024

if response.status_code == 400:
error = self._deserialize.failsafe_deserialize(str, pipeline_response)
elif response.status_code == 404:
error = self._deserialize.failsafe_deserialize(_models.NotFoundErrorBase, pipeline_response)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
error = self._deserialize.failsafe_deserialize(_models.NotFoundErrorBase, pipeline_response)
error = self._deserialize.failsafe_deserialize(_models.NotFoundErrorBase, response)

I think it shall be response instead of pipeline_response here.

map_error(status_code=response.status_code, response=response, error_map=error_map)
error = None
if response.status_code == 400:
error = self._deserialize.failsafe_deserialize(str, pipeline_response)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the deserialize type is str here for 400 while int for 501?

error = self._deserialize.failsafe_deserialize(_models.NotFoundErrorBase, pipeline_response)
elif response.status_code == 501:
error = self._deserialize.failsafe_deserialize(int, pipeline_response)
raise HttpResponseError(response=response, model=error)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For 404, old code raise ResourceNotFoundError while new logic always raise HttpResponseError.

raise HttpResponseError(response=response)
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = None
if response.status_code == 400:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For 400/501, failsafe_deserialize will always return None so maybe we don't need the logic.

@tadelesh tadelesh closed this Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants