16 lines
379 B
Python
16 lines
379 B
Python
|
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}'
|