error handling
This commit is contained in:
parent
bdaacc0b5a
commit
becfa584c9
2 changed files with 11 additions and 2 deletions
|
|
@ -32,7 +32,13 @@ class DirectoryHandler:
|
|||
config_parser = configparser.ConfigParser()
|
||||
config_parser.read(path)
|
||||
|
||||
if not "raincloud" in config_parser:
|
||||
raise RaincloudIOException(
|
||||
f"Malformed configuration file in directory '{directory}'"
|
||||
)
|
||||
|
||||
parsed_config = dict(config_parser["raincloud"])
|
||||
|
||||
config["hashed_password"] = (
|
||||
parsed_config["hashed_password"]
|
||||
if "hashed_password" in parsed_config
|
||||
|
|
@ -50,7 +56,7 @@ class DirectoryHandler:
|
|||
return config
|
||||
|
||||
else:
|
||||
raise RaincloudIOException("No raincloud directory")
|
||||
raise RaincloudIOException(f"No raincloud directory '{directory}'")
|
||||
|
||||
def get_files(self, directory):
|
||||
"""Get files from directory."""
|
||||
|
|
|
|||
|
|
@ -104,7 +104,10 @@ def create_app(base_path, cloud_name="raincloud"):
|
|||
abort(403)
|
||||
|
||||
except RaincloudIOException as e:
|
||||
print(e)
|
||||
print(f"RaincloudIOException: {e}")
|
||||
abort(404)
|
||||
except Exception as e:
|
||||
print(f"Unhandled exception: {e}")
|
||||
abort(404)
|
||||
|
||||
return app
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue