Skip to content

Commit 80abad7

Browse files
committed
Error handling: Use JSON for bundling multiple ConnectionError instances
All `ConnectionError` instances that have been collected will be serialized into JSON now.
1 parent 7cd0086 commit 80abad7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/crate/client/connection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
# However, if you have executed another commercial license agreement
1919
# with Crate these terms will supersede the license and you may use the
2020
# software solely pursuant to the terms of the relevant commercial agreement.
21+
import json
2122

2223
from verlib2 import Version
2324
from verlib2.packaging.version import InvalidVersion
@@ -216,7 +217,7 @@ def _lowest_server_version(self):
216217
if not lowest or version < lowest:
217218
lowest = version
218219
if connection_errors and len(connection_errors) == server_count:
219-
raise ConnectionError(str(connection_errors))
220+
raise ConnectionError(json.dumps(list(map(str, connection_errors))))
220221
return lowest or Version("0.0.0")
221222

222223
def __repr__(self):

0 commit comments

Comments
 (0)