ConfigFileNotFound exception + run-test script
Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
20
repo_cloner/lib/config_file_not_found_error.py
Normal file
20
repo_cloner/lib/config_file_not_found_error.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from pathlib import PosixPath
|
||||
import os
|
||||
|
||||
|
||||
class ConfigFileNotFoundError(OSError):
|
||||
|
||||
def __str__(self):
|
||||
if len(self.args) == 2:
|
||||
path: str = ""
|
||||
filename: str = ""
|
||||
if isinstance(self.args[0], PosixPath):
|
||||
path = str(PosixPath(self.args[0]))
|
||||
else:
|
||||
path = str(self.args[0])
|
||||
|
||||
filename = str(self.args[1])
|
||||
path = os.path.join(path, filename)
|
||||
return f"Config file does not exist: {path}"
|
||||
else:
|
||||
return super.__str__(self)
|
||||
Reference in New Issue
Block a user