File tree 3 files changed +7
-7
lines changed
3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -192,7 +192,7 @@ class InvalidIndexError(GribInternalError):
192
192
193
193
194
194
class InvalidGribError (GribInternalError ):
195
- """Invalid grib id."""
195
+ """Invalid GRIB id."""
196
196
197
197
198
198
class InvalidFileError (GribInternalError ):
Original file line number Diff line number Diff line change @@ -162,13 +162,13 @@ def wrapper(*args):
162
162
def get_handle (msgid ):
163
163
h = ffi .cast ("grib_handle*" , msgid )
164
164
if h == ffi .NULL :
165
- raise errors .InvalidGribError (f"get_handle: Bad message ID { msgid } " )
165
+ raise errors .NullHandleError (f"get_handle: Bad message ID { msgid } " )
166
166
return h
167
167
168
168
169
169
def put_handle (handle ):
170
170
if handle == ffi .NULL :
171
- raise errors .InvalidGribError (f"put_handle: Bad message ID { handle } " )
171
+ raise errors .NullHandleError (f"put_handle: Bad message ID { handle } " )
172
172
return int (ffi .cast ("size_t" , handle ))
173
173
174
174
@@ -1137,7 +1137,7 @@ def grib_clone(msgid_src):
1137
1137
h_src = get_handle (msgid_src )
1138
1138
h_dest = lib .grib_handle_clone (h_src )
1139
1139
if h_dest == ffi .NULL :
1140
- raise errors .InvalidGribError ("clone failed" )
1140
+ raise errors .MessageInvalidError ("clone failed" )
1141
1141
return put_handle (h_dest )
1142
1142
1143
1143
@@ -2381,7 +2381,7 @@ def grib_new_from_message(message):
2381
2381
message = message .encode (ENC )
2382
2382
h = lib .grib_handle_new_from_message_copy (ffi .NULL , message , len (message ))
2383
2383
if h == ffi .NULL :
2384
- raise errors .InvalidGribError ("new_from_message failed" )
2384
+ raise errors .MessageInvalidError ("new_from_message failed" )
2385
2385
return put_handle (h )
2386
2386
2387
2387
Original file line number Diff line number Diff line change @@ -84,8 +84,8 @@ def test_codes_get_native_type():
84
84
assert eccodes .codes_get_native_type (gid , "referenceValue" ) is float
85
85
assert eccodes .codes_get_native_type (gid , "stepType" ) is str
86
86
assert eccodes .codes_get_native_type (gid , "section_1" ) is None
87
- with pytest .raises (eccodes .InvalidGribError ):
88
- eccodes .codes_get_native_type (0 , "aKey" )
87
+ with pytest .raises (eccodes .NullHandleError ):
88
+ eccodes .codes_get_native_type (0 , "aKey" ) # NULL handle
89
89
90
90
91
91
def test_new_from_file ():
You can’t perform that action at this time.
0 commit comments