Changed the way exceptions are handled
This commit is contained in:
16
classes/exceptions.py
Normal file
16
classes/exceptions.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from typing import Any
|
||||
|
||||
|
||||
class SubmissionUnavailableError(Exception):
|
||||
pass
|
||||
|
||||
class SubmissionUploadError(Exception):
|
||||
def __init__(self, file_path: str, status_code: int, content: Any) -> None:
|
||||
self.status_code = status_code
|
||||
self.content = content
|
||||
super().__init__(f"Could not upload photo '{file_path}' due to HTTP {self.status_code}: {self.content}")
|
||||
|
||||
class SubmissionDuplicatesError(Exception):
|
||||
def __init__(self, file_path: str, duplicates: list) -> None:
|
||||
self.duplicates = duplicates
|
||||
super().__init__(f"Found duplicates of a photo '{file_path}': {self.duplicates}")
|
Reference in New Issue
Block a user