From 92a826fdfc15a81b5e29fb7cd24c8ee8969ad97d Mon Sep 17 00:00:00 2001 From: sunxilin Date: Tue, 26 Nov 2024 14:36:14 +0800 Subject: [PATCH] fix: catch exception in async python extensions --- .../python/interface/ten/async_extension.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/core/src/ten_runtime/binding/python/interface/ten/async_extension.py b/core/src/ten_runtime/binding/python/interface/ten/async_extension.py index 51de3090e..cebbc88c7 100644 --- a/core/src/ten_runtime/binding/python/interface/ten/async_extension.py +++ b/core/src/ten_runtime/binding/python/interface/ten/async_extension.py @@ -131,43 +131,43 @@ async def _wrapper_on_config(self, async_ten_env: AsyncTenEnv): try: await self.on_configure(async_ten_env) except Exception as e: - _exit_on_exception(async_ten_env, e) + self._exit_on_exception(async_ten_env, e) async def _wrapper_on_init(self, async_ten_env: AsyncTenEnv): try: await self.on_init(async_ten_env) except Exception as e: - _exit_on_exception(async_ten_env, e) + self._exit_on_exception(async_ten_env, e) async def _wrapper_on_start(self, async_ten_env: AsyncTenEnv): try: await self.on_start(async_ten_env) except Exception as e: - _exit_on_exception(async_ten_env, e) + self._exit_on_exception(async_ten_env, e) async def _wrapper_on_stop(self, async_ten_env: AsyncTenEnv): try: await self.on_stop(async_ten_env) except Exception as e: - _exit_on_exception(async_ten_env, e) + self._exit_on_exception(async_ten_env, e) async def _wrapper_on_deinit(self, async_ten_env: AsyncTenEnv): try: await self.on_deinit(async_ten_env) except Exception as e: - _exit_on_exception(async_ten_env, e) + self._exit_on_exception(async_ten_env, e) async def _wrapper_on_cmd(self, async_ten_env: AsyncTenEnv, cmd: Cmd): try: await self.on_cmd(async_ten_env, cmd) except Exception as e: - _exit_on_exception(async_ten_env, e) + self._exit_on_exception(async_ten_env, e) async def _wrapper_on_data(self, async_ten_env: AsyncTenEnv, data: Data): try: await self.on_data(async_ten_env, data) except Exception as e: - _exit_on_exception(async_ten_env, e) + self._exit_on_exception(async_ten_env, e) async def _wrapper_on_video_frame( self, async_ten_env: AsyncTenEnv, video_frame: VideoFrame @@ -175,7 +175,7 @@ async def _wrapper_on_video_frame( try: await self.on_video_frame(async_ten_env, video_frame) except Exception as e: - _exit_on_exception(async_ten_env, e) + self._exit_on_exception(async_ten_env, e) async def _wrapper_on_audio_frame( self, async_ten_env: AsyncTenEnv, audio_frame: AudioFrame @@ -183,7 +183,7 @@ async def _wrapper_on_audio_frame( try: await self.on_audio_frame(async_ten_env, audio_frame) except Exception as e: - _exit_on_exception(async_ten_env, e) + self._exit_on_exception(async_ten_env, e) def _exit_on_exception(self, async_ten_env: AsyncTenEnv, e: Exception): traceback_info = traceback.format_exc()