[PR #44] [CLOSED] ResourceException now has status_code #149

Closed
opened 2026-02-27 15:46:41 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/proxmoxer/proxmoxer/pull/44
Author: @mihailstoynov
Created: 1/29/2021
Status: Closed

Base: developHead: more-expressive-resource-exception


📄 Description

ResourceException now has status_code, status_message, content, reason fields that help when processing errors.

Very useful when you just want to test just the response code of the request like this:

    retries = 5
    while retries:
        try:
            return request_orig(*args, **kwargs)
        except ResourceException as e:
            if e.status_code == 500 and re.match("command '.*?' failed: got timeout", e.reason):
                retries -= 1
            else:
                raise


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/proxmoxer/proxmoxer/pull/44 **Author:** [@mihailstoynov](https://github.com/mihailstoynov) **Created:** 1/29/2021 **Status:** ❌ Closed **Base:** `develop` ← **Head:** `more-expressive-resource-exception` --- ### 📄 Description ResourceException now has status_code, status_message, content, reason fields that help when processing errors. Very useful when you just want to test just the response code of the request like this: ``` retries = 5 while retries: try: return request_orig(*args, **kwargs) except ResourceException as e: if e.status_code == 500 and re.match("command '.*?' failed: got timeout", e.reason): retries -= 1 else: raise ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 15:46:41 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/proxmoxer#149
No description provided.