Skip to content

Commit 7b4712c

Browse files
committed
RDBC-893 Fix parsing of errors inside RequestExecutor._handle_unsuccessful_response
1 parent f784b6e commit 7b4712c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ravendb/http/request_executor.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import os
88
from concurrent.futures import ThreadPoolExecutor, Future, FIRST_COMPLETED, wait, ALL_COMPLETED
99
import uuid
10+
from json import JSONDecodeError
1011
from threading import Timer, Semaphore, Lock
1112

1213
import requests
@@ -1103,9 +1104,13 @@ def _handle_unsuccessful_response(
11031104
return True
11041105
else:
11051106
command.on_response_failure(response)
1106-
raise RuntimeError(
1107-
json.loads(response.text).get("Message", "Missing message")
1108-
) # todo: Exception dispatcher
1107+
try: # todo: exception dispatcher
1108+
raise RuntimeError(
1109+
json.loads(response.text).get("Message", "Missing message")
1110+
)
1111+
except JSONDecodeError as e:
1112+
raise RuntimeError(
1113+
f"Failed to parse response: {response.text}") from e
11091114

11101115
return False
11111116

0 commit comments

Comments
 (0)