File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change 84
84
)
85
85
ERROR_RESPONSE_INVALID_ID = merge (VALID_ERROR_RESPONSE , {"id" : b"invalid" })
86
86
87
- ERROR_RESPONSE_INVALID_CODE = merge (VALID_ERROR_RESPONSE , {"error" : {"code" : "-32601" }})
87
+ ERROR_RESPONSE_INVALID_CODE = merge (
88
+ VALID_ERROR_RESPONSE , {"error" : {"code" : "-32601" , "message" : "" }}
89
+ )
88
90
ERROR_RESPONSE_INVALID_MISSING_CODE = merge (
89
91
VALID_ERROR_RESPONSE , {"error" : {"message" : "msg" }}
90
92
)
Original file line number Diff line number Diff line change @@ -204,6 +204,13 @@ def _validate_response(
204
204
"JSON-RPC 2.0 specification." ,
205
205
)
206
206
207
+ # errors must include a message
208
+ error_message = error .get ("message" )
209
+ if not isinstance (error_message , str ):
210
+ _raise_bad_response_format (
211
+ response , 'error["message"] is required and must be a string value.'
212
+ )
213
+
207
214
# errors must include an integer code
208
215
code = error .get ("code" )
209
216
if not isinstance (code , int ):
@@ -220,15 +227,7 @@ def _validate_response(
220
227
"currently enabled."
221
228
),
222
229
)
223
-
224
- # errors must include a message
225
- error_message = error .get ("message" )
226
- if not isinstance (error_message , str ):
227
- _raise_bad_response_format (
228
- response , 'error["message"] is required and must be a string value.'
229
- )
230
-
231
- if any (
230
+ elif any (
232
231
# parse specific timeout messages
233
232
timeout_str in error_message .lower ()
234
233
for timeout_str in KNOWN_REQUEST_TIMEOUT_MESSAGING
You can’t perform that action at this time.
0 commit comments