Skip to content

Commit

Permalink
improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
dlubom committed Jul 24, 2024
1 parent 6c648d1 commit ae50c20
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions iata_code_fetcher/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ def process_and_save_data(code_type: CodeType) -> None:
with open(file_path, "a", encoding="UTF-8") as file:
for item in result:
file.write(json.dumps(item) + "\n")
except (ValueError, RequestException) as e:
logging.error("Error for %s: %s", code, e)
except RequestException as e:
logging.error("For %s: %s", code, e)
except ValueError as e:
logging.warn("For %s, %s", code, e)

processed += 1
if processed % REPORT_FREQUENCY == 0:
Expand Down

0 comments on commit ae50c20

Please sign in to comment.