Skip to content

Commit 41592d8

Browse files
committed
fix traceback handling
1 parent e2c745f commit 41592d8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pymongo/asynchronous/srv_resolver.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ async def _resolve_uri(self, encapsulate_errors: bool) -> resolver.Answer:
124124
# Else, raise all errors as ConfigurationError.
125125
import traceback
126126

127-
raise ConfigurationError(traceback.format_exception(exc)) from exc
127+
raise ConfigurationError(
128+
traceback.format_exception(type(exc), exc, exc.__traceback__)
129+
) from exc
128130
return results
129131

130132
async def _get_srv_response_and_hosts(

pymongo/synchronous/srv_resolver.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ def _resolve_uri(self, encapsulate_errors: bool) -> resolver.Answer:
124124
# Else, raise all errors as ConfigurationError.
125125
import traceback
126126

127-
raise ConfigurationError(traceback.format_exception(exc)) from exc
127+
raise ConfigurationError(
128+
traceback.format_exception(type(exc), exc, exc.__traceback__)
129+
) from exc
128130
return results
129131

130132
def _get_srv_response_and_hosts(

0 commit comments

Comments
 (0)