devopshq / devopshq/artifactory

Including http_error as attribute in exception

Open
#445 8 comments 0 reactions 0 assignees View on GitHub
enhancement Help Wanted
Dominant language
Python
Stars
306
Forks
161
PR merge metrics
No merged PRs in 30d

Description

It looks to me like the current implementation of `ArtifactoryException` currently only includes the http error code as part of the string message (e.g. `dohq_artifactory.exception.ArtifactoryException: 502 Server Error: Bad Gateway for url: https://myserver.com/artifactory/api/storage/my-repo/path/4242/directory`
Unfortunately our infrastructure is sometimes unstable so we need to retry some operations in case of some specific errors (e.g. 429).

We prefer not to parse the exception message string, as there are some numbers (IDs) in the URL and we would create a dependency to the format of your exception message.

Instead, we think that including an optional (i.e. None on initialization) `http_error_code` would greatly help us. That is anyway what the `HTTPError` of `requests` includes: https://github.com/psf/requests/blob/main/src/requests/exceptions.py#L22

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.