Skip to content

Commit 003c5aa

Browse files
authored
Merge pull request #236 from poissoncorp/RDBC-893
RDBC-893 Fix parsing of errors inside RequestExecutor._handle_unsuccessful_response
2 parents f784b6e + 715ee03 commit 003c5aa

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ravendb/http/request_executor.py

Lines changed: 5 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,10 @@ 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(json.loads(response.text).get("Message", "Missing message"))
1109+
except JSONDecodeError as e:
1110+
raise RuntimeError(f"Failed to parse response: {response.text}") from e
11091111

11101112
return False
11111113

0 commit comments

Comments
 (0)