Skip to content

Commit

Permalink
refactor: improve exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
KarelZe committed Jan 7, 2024
1 parent 84654ea commit 478fe41
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions utils/dump_sessionstorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@


def process_db(filepath, output_path):
# Do some basic error handling

p = Path(filepath)
if not p.exists():
raise Exception("Given file path does not exists. Path: {}".format(filepath))
raise FileNotFoundError(f"Given file path does not exist. Path: {filepath}")

if not p.is_dir():
raise Exception("Given file path is not a folder. Path: {}".format(filepath))
raise NotADirectoryError(f"Given file path is not a folder. Path: {filepath}")

# convert the database to a python list with nested dictionaries
extracted_values = shared.parse_sessionstorage(p)
Expand Down

0 comments on commit 478fe41

Please sign in to comment.