Skip to content

Commit

Permalink
polish: print full tracebacks on parse error
Browse files Browse the repository at this point in the history
  • Loading branch information
neilsong committed Oct 22, 2024
1 parent 36dce44 commit 30813ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion data
Submodule data updated from c491b2 to bba57b
8 changes: 5 additions & 3 deletions ferry/crawler/classes/parse.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import re
import traceback
import warnings
from pathlib import Path
from tqdm import tqdm
from typing import cast, Any, TypedDict
from typing import Any, TypedDict, cast

import ujson
from unidecode import unidecode
from bs4 import BeautifulSoup, MarkupResemblesLocatorWarning, ResultSet, Tag
from tqdm import tqdm
from unidecode import unidecode

from ferry.crawler.cache import load_cache_json, save_cache_json

Expand Down Expand Up @@ -711,6 +712,7 @@ def parse_courses(
parsed_course_info.append(extract_course_info(x, season, fysem_courses))
except Exception as e:
print(f"Error parsing course {x['code']} in season {season}: {e}")
traceback.print_exc()

save_cache_json(data_dir / "parsed_courses" / f"{season}.json", parsed_course_info)

Expand Down

0 comments on commit 30813ea

Please sign in to comment.