video_downloader_service/src/core/result.py

17 lines
406 B
Python
Raw Normal View History

2023-08-24 16:45:55 +03:00
from enum import Enum
class ResultTypeEnum(Enum):
EXCEPTION = "Error"
DONE = "Done"
EXIST = "Exist"
2023-08-24 16:45:55 +03:00
class Result:
def __init__(self, result_type: ResultTypeEnum, value: Exception | bool = None):
2023-08-24 16:45:55 +03:00
self.result_type = result_type
self.value = value
def __repr__(self):
return f'Result: {self.result_type.value}. Traceback: {self.value if self.value else None}'