Skip to content

Commit db60f81

Browse files
Fix: exception order
1 parent 390be5f commit db60f81

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/a2a/utils/telemetry.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,17 +163,17 @@ async def async_wrapper(*args, **kwargs) -> Any:
163163
span.set_status(StatusCode.OK)
164164
return result
165165

166-
except Exception as e:
167-
exception = e
168-
span.record_exception(e)
169-
span.set_status(StatusCode.ERROR, description=str(e))
170-
raise
171166
# asyncio.CancelledError extends from BaseException
172167
except asyncio.CancelledError as ce:
173-
exception = ce
168+
exception = None
174169
logger.debug(f'CancelledError in span {actual_span_name}')
175170
span.record_exception(ce)
176171
raise
172+
except Exception as e:
173+
exception = e
174+
span.record_exception(e)
175+
span.set_status(StatusCode.ERROR, description=str(e))
176+
raise
177177
finally:
178178
if attribute_extractor:
179179
try:

0 commit comments

Comments
 (0)