Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could we always include resp.text in ResourceException.content? #144

Open
tiago8 opened this issue Sep 2, 2023 · 0 comments
Open

Could we always include resp.text in ResourceException.content? #144

tiago8 opened this issue Sep 2, 2023 · 0 comments

Comments

@tiago8
Copy link

tiago8 commented Sep 2, 2023

As the title says, would it be possible to always include resp.text in ResourceException.content? Specifically, when hasattr(resp, "reason") is true, the resp.text is not included in the exception which may omit valuable information.

Why?

I was setting up an Ansible playbook to automate the creation of a LXC container but kept running into the error:

Creation of lxc VM 100 failed with exception: 400 Bad Request: Parameter verification failed.

After some debugging I found the issue (invalid rootfs param). It turned out that the API was returning the detailed cause inside resp.text but that wasn't being included in the exception.

As such, always including resp.text in ResourceException.content can provide valuable information for quickly figuring out what is going wrong.

Proposed how

A simple solution would be to replace proxmoxer/core.py#L152 with resp.reason + " Specifically: " + resp.text,

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

No branches or pull requests

1 participant