Skip to content

Commit 88ebe03

Browse files
committed
Replace dbf Exception with ShapefileException
1 parent 3c58ae9 commit 88ebe03

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/shapefile.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ def __init__(
979979
shp: Union[_NoShpSentinel, Optional[BinaryFileT]] = _NoShpSentinel(),
980980
shx: Optional[BinaryFileT] = None,
981981
dbf: Optional[BinaryFileT] = None,
982-
**kwargs, # pylint: disable=unused-argument
982+
**kwargs, # pylint: disable=unused-argument
983983
):
984984
self.shp = None
985985
self.shx = None
@@ -1078,7 +1078,7 @@ def __init__(
10781078
# Close and delete the temporary zipfile
10791079
try:
10801080
zipfileobj.close()
1081-
except:
1081+
except Exception:
10821082
pass
10831083
# Try to load shapefile
10841084
if self.shp or self.dbf:
@@ -1886,7 +1886,9 @@ def iterRecords(
18861886
if self.numRecords is None:
18871887
self.__dbfHeader()
18881888
if not isinstance(self.numRecords, int):
1889-
raise Exception("Error when reading number of Records in dbf file header")
1889+
raise ShapefileException(
1890+
"Error when reading number of Records in dbf file header"
1891+
)
18901892
f = self.__getFileObj(self.dbf)
18911893
start = self.__restrictIndex(start)
18921894
if stop is None:

0 commit comments

Comments
 (0)