Skip to content

Commit

Permalink
fix: underlying function exception was not being raised
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekMaggio committed May 30, 2024
1 parent 6e5411b commit 2e010fe
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,15 @@ async def track(self, func_to_track: Callable, state: RobotContextState, *args,
if inspect.iscoroutinefunction(func_to_track):
try:
result = await func_to_track(*args, **kwargs)
except Exception as e:
result = e
finally:
duration_end_time = perf_counter_ns()
else:
try:
result = func_to_track(*args, **kwargs)
except Exception as e:
result = e
finally:
duration_end_time = perf_counter_ns()

Expand All @@ -99,7 +103,11 @@ async def track(self, func_to_track: Callable, state: RobotContextState, *args,
state=state,
)
)
return result

if isinstance(result, Exception):
raise result
else:
return result



Expand Down

0 comments on commit 2e010fe

Please sign in to comment.