repo-cloner/repo_cloner/lib/config_file_not_found_error.py
Václav Valíček 7293289a1a
Extend ConfigFileNotFoundError
Signed-off-by: Václav Valíček <valicek1994@gmail.com>
2022-06-26 01:15:44 +02:00

23 lines
484 B
Python

from pathlib import PosixPath
import os
class ConfigFileNotFoundError(OSError):
def __str__(self):
if len(self.args) in [1, 2]:
path: str = ""
if isinstance(self.args[0], PosixPath):
path = str(PosixPath(self.args[0]))
else:
path = str(self.args[0])
if len(self.args) == 2:
filename: str = ""
filename = str(self.args[1])
path = os.path.join(path, filename)
return f"Config file does not exist: {path}"
else:
return super.__str__(self)