video_downloader_service/src/core/result.py

16 lines
379 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"
class Result:
def __init__(self, result_type: ResultTypeEnum, value: Exception = None):
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}'