-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: setup exception hierarchy (#199)
* feat: setup exception hierarchy * fix: improve ActionTimeoutException message * refactor: move APIException in _exceptions module * chore: typo Co-authored-by: Julian Tölle <julian.toelle97@gmail.com> * chore: wording Co-authored-by: Julian Tölle <julian.toelle97@gmail.com> --------- Co-authored-by: Julian Tölle <julian.toelle97@gmail.com>
- Loading branch information
Showing
5 changed files
with
32 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from .hcloud import APIException, Client # noqa | ||
from ._exceptions import APIException, HCloudException # noqa | ||
from .hcloud import Client # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class HCloudException(Exception): | ||
"""There was an error while using the hcloud library""" | ||
|
||
|
||
class APIException(HCloudException): | ||
"""There was an error while performing an API Request""" | ||
|
||
def __init__(self, code, message, details): | ||
self.code = code | ||
self.message = message | ||
self.details = details | ||
|
||
def __str__(self): | ||
return self.message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters