Skip to content

Commit 14cf511

Browse files
author
Mike Dirolf
committed
add GridFSError as base exception class for gridfs errors
1 parent 08eb763 commit 14cf511

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

gridfs/errors.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,16 @@
1414

1515
"""Exceptions raised by the :mod:`gridfs` package"""
1616

17-
class CorruptGridFile(Exception):
17+
from pymongo.errors import PyMongoError
18+
19+
20+
class GridFSError(PyMongoError):
21+
"""Base class for all GridFS exceptions.
22+
23+
.. versionadded:: 1.4+
24+
"""
25+
26+
class CorruptGridFile(GridFSError):
1827
"""Raised when a :class:`~gridfs.grid_file.GridFile` instance is
1928
malformed.
2029
"""

pymongo/objectid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
try:
2121
import hashlib
2222
_md5func = hashlib.md5
23-
except: # for Python < 2.5
23+
except ImportError: # for Python < 2.5
2424
import md5
2525
_md5func = md5.new
2626
import os

0 commit comments

Comments
 (0)