Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit ca1e838

Browse files
committed
catch another exception regarding classifier loading
1 parent 3b73146 commit ca1e838

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/documents/classifier.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,19 @@ def load_classifier():
3434
try:
3535
classifier.load()
3636

37-
except (EOFError, IncompatibleClassifierVersionError) as e:
37+
except (EOFError,
38+
IncompatibleClassifierVersionError,
39+
pickle.UnpicklingError):
3840
# there's something wrong with the model file.
3941
logger.exception(
4042
f"Unrecoverable error while loading document "
4143
f"classification model, deleting model file."
4244
)
4345
os.unlink(settings.MODEL_FILE)
4446
classifier = None
45-
except OSError as e:
46-
logger.error(
47-
f"Error while loading document classification model: {str(e)}"
47+
except OSError:
48+
logger.exception(
49+
f"Error while loading document classification model"
4850
)
4951
classifier = None
5052

0 commit comments

Comments
 (0)