Skip to content

Commit

Permalink
Raise FileNotFoundError if dictionary files don't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
myleott committed Jan 22, 2018
1 parent fa50849 commit dcbf5e7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fairseq/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ def load(f):
try:
with open(f, 'r', encoding='utf-8') as fd:
return Dictionary.load(fd)
except FileNotFoundError as fnfe:
raise fnfe
except:
raise Exception("Incorrect encoding detected in {}, please "
"rebuild the dataset".format(f))
Expand Down

0 comments on commit dcbf5e7

Please sign in to comment.