ansys / ansys/openapi-common

Failure to deserialize non-200 response results in unexpected exception

Open
#784 1 comment 0 reactions 1 assignee Claimed by @Andy-Grigg View on GitHub
bug
Dominant language
Python
Stars
1
Forks
0
Avg merge
6h 15m
Merged PRs (30d)
24

Description

### 🔍 Before submitting the issue

- [x] I have searched among the existing issues
- [x] I am using a Python virtual environment

### 🐞 Description of the bug

#778 introduced the feature of deserializing the response from the server for non-200 responses and attaching them to the exception.

This is fine if the deserialization succeeds, but if the deserialization fails then we end up with a deserialization error (probably a ValueError or KeyError), which is raised as a result of raising the ApiException. I suggest that this is unexpected, since the important thing is that the request failed, the processing is secondary to this.

We should either ignore the fact that the deserialization failed and raise the ApiException anyway or potentially raise an ExceptionGroup. We still support Python 3.10 though, so we probably need to ignore the secondary exception for now, and maybe look at adding the ExceptionGroup later on.

### 📝 Steps to reproduce

-

### 💻 Which operating system are you using?

Windows

### 📀 Which ANSYS version are you using?

_No response_

### 🐍 Which Python version are you using?

3.10

### 📦 Installed packages

```shell
-
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.