-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve messages for LTD Keeper-related errors
Provide a good error message and ensure that the readable text always appears at the bottom of the log.
- Loading branch information
1 parent
748e597
commit c66965f
Showing
3 changed files
with
44 additions
and
7 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,10 +1,23 @@ | ||
"""Exceptions related to the LTD Keeper. | ||
""" | ||
"""Exceptions related to the LTD Keeper.""" | ||
|
||
__all__ = ("KeeperError",) | ||
|
||
from typing import Optional | ||
|
||
from ..exceptions import ConveyorError | ||
|
||
|
||
class KeeperError(ConveyorError): | ||
"""Error raised because of issues using the LTD Keeper API.""" | ||
|
||
def __init__( | ||
self, | ||
message: str, | ||
status_code: Optional[int] = None, | ||
body: Optional[str] = None, | ||
): | ||
if status_code is not None: | ||
message = f"(LTD status code: {status_code})\n\n{message}" | ||
if body is not None: | ||
message = f"{body}\n\n{message}" | ||
super().__init__(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