Skip to content

Commit

Permalink
refactor(pacer.email): tweak logger.error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
grossir committed Jan 9, 2025
1 parent f5e6bb3 commit 93c4d4b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions juriscraper/pacer/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,19 +610,18 @@ def _parse_bankruptcy_short_description(self, subject: str) -> str:
chapter_regex = r"Chapter[- ]?(7|9|11|13)"
if self.court_id in ["nhb"]:
subject = re.sub(chapter_regex, " ", subject, 1)
else:
if len(re.findall(chapter_regex, subject)) > 1:
logger.error(
"Trying to parse a RECAP email with more than 1 'Chapter...' string"
)
elif len(re.findall(chapter_regex, subject)) > 1:
logger.error(
"Trying to parse a RECAP email with more than 1 'Chapter...' string"
)

subject = subject.strip(" ;:,- ")
# some courts use "Re: {case name}"
short_description = re.sub("( Re$)|(^Re:? )", "", subject)

if self.court_id not in self.bankruptcy_courts_with_tests:
logger.error(
"Parsing a RECAP email from a court %s without tests",
"Parsing a RECAP email from court %s without tests",
self.court_id,
)

Expand Down

0 comments on commit 93c4d4b

Please sign in to comment.