Files
Launcher/core_lib/common/exception.py
T

16 lines
611 B
Python
Raw Normal View History

from pathlib import Path
class LauncherException(Exception):
def __init__(self, message):
self.message = message
def __str__(self):
return self.message
class HashMismatchException(Exception):
def __init__(self, hash_name, got_hash, expected_hash, filepath: str | Path):
if type(filepath) == Path: filepath = Path(filepath).absolute().as_posix()
self.message = "File {} hash mismatch. Expected hash {}. Got hash {} ({})".format(filepath, got_hash,
expected_hash, hash_name)