@@ -996,6 +996,8 @@ def remove(self, key: str, where=None, start=None, stop=None):
996
996
# the key is not a valid store, re-raising KeyError
997
997
raise
998
998
except Exception :
999
+ # In tests we get here with ClosedFileError, TypeError, and
1000
+ # _table_mod.NoSuchNodeError. TODO: Catch only these?
999
1001
1000
1002
if where is not None :
1001
1003
raise ValueError (
@@ -1806,8 +1808,7 @@ def convert(
1806
1808
# making an Index instance could throw a number of different errors
1807
1809
try :
1808
1810
self .values = Index (values , ** kwargs )
1809
- except Exception :
1810
-
1811
+ except ValueError :
1811
1812
# if the output freq is different that what we recorded,
1812
1813
# it should be None (see also 'doc example part 2')
1813
1814
if "freq" in kwargs :
@@ -4188,36 +4189,29 @@ def write_data_chunk(self, rows, indexes, mask, values):
4188
4189
if not np .prod (v .shape ):
4189
4190
return
4190
4191
4191
- try :
4192
- nrows = indexes [0 ].shape [0 ]
4193
- if nrows != len (rows ):
4194
- rows = np .empty (nrows , dtype = self .dtype )
4195
- names = self .dtype .names
4196
- nindexes = len (indexes )
4197
-
4198
- # indexes
4199
- for i , idx in enumerate (indexes ):
4200
- rows [names [i ]] = idx
4192
+ nrows = indexes [0 ].shape [0 ]
4193
+ if nrows != len (rows ):
4194
+ rows = np .empty (nrows , dtype = self .dtype )
4195
+ names = self .dtype .names
4196
+ nindexes = len (indexes )
4201
4197
4202
- # values
4203
- for i , v in enumerate (values ):
4204
- rows [names [i + nindexes ]] = v
4198
+ # indexes
4199
+ for i , idx in enumerate (indexes ):
4200
+ rows [names [i ]] = idx
4205
4201
4206
- # mask
4207
- if mask is not None :
4208
- m = ~ mask .ravel ().astype (bool , copy = False )
4209
- if not m .all ():
4210
- rows = rows [m ]
4202
+ # values
4203
+ for i , v in enumerate (values ):
4204
+ rows [names [i + nindexes ]] = v
4211
4205
4212
- except Exception as detail :
4213
- raise Exception (f"cannot create row-data -> { detail } " )
4206
+ # mask
4207
+ if mask is not None :
4208
+ m = ~ mask .ravel ().astype (bool , copy = False )
4209
+ if not m .all ():
4210
+ rows = rows [m ]
4214
4211
4215
- try :
4216
- if len (rows ):
4217
- self .table .append (rows )
4218
- self .table .flush ()
4219
- except Exception as detail :
4220
- raise TypeError (f"tables cannot write this data -> { detail } " )
4212
+ if len (rows ):
4213
+ self .table .append (rows )
4214
+ self .table .flush ()
4221
4215
4222
4216
def delete (
4223
4217
self ,
0 commit comments