fix: catch ValueError instead of bare except in date parsing (#438)
The datetime.strptime() call can only raise ValueError on format mismatch. Bare except catches KeyboardInterrupt and SystemExit, which masks real errors. Co-authored-by: haosenwang1018 <haosenwang1018@users.noreply.github.com>
This commit is contained in:
parent
58f2de70fb
commit
f5b94d4b28
1 changed files with 1 additions and 1 deletions
|
|
@ -96,7 +96,7 @@ class LoComoDataset(BenchmarkDataset):
|
||||||
try:
|
try:
|
||||||
dt = datetime.strptime(date_string, "%I:%M %p on %d %B, %Y")
|
dt = datetime.strptime(date_string, "%I:%M %p on %d %B, %Y")
|
||||||
return dt.replace(tzinfo=timezone.utc)
|
return dt.replace(tzinfo=timezone.utc)
|
||||||
except:
|
except ValueError:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue