replaces logger.error with logger.exception to get stack trace

This commit is contained in:
Mose Müller 2024-12-20 10:35:13 +01:00
parent 2bcc6b9660
commit 3c99f3fe04
3 changed files with 3 additions and 4 deletions

View File

@ -258,7 +258,7 @@ class Server:
except asyncio.CancelledError: except asyncio.CancelledError:
logger.debug("Cancelled '%s' server.", server_name) logger.debug("Cancelled '%s' server.", server_name)
except Exception as e: except Exception as e:
logger.error("Unexpected exception: %s", e) logger.exception("Unexpected exception: %s", e)
async def __cancel_tasks(self) -> None: async def __cancel_tasks(self) -> None:
for task in asyncio.all_tasks(self._loop): for task in asyncio.all_tasks(self._loop):

View File

@ -111,8 +111,7 @@ class Task(pydase.data_service.data_service.DataService, Generic[R]):
exception = task.exception() exception = task.exception()
if exception is not None: if exception is not None:
# Handle the exception, or you can re-raise it. logger.exception(
logger.error(
"Task '%s' encountered an exception: %s: %s", "Task '%s' encountered an exception: %s: %s",
self._func_name, self._func_name,
type(exception).__name__, type(exception).__name__,

View File

@ -393,7 +393,7 @@ def set_nested_value_by_path(
current_dict, path_parts[-1], allow_append=True current_dict, path_parts[-1], allow_append=True
) )
except (SerializationPathError, KeyError) as e: except (SerializationPathError, KeyError) as e:
logger.error("Error occured trying to change %a: %s", path, e) logger.exception("Error occured trying to change %a: %s", path, e)
return return
if next_level_serialized_object["type"] == "method": # state change of task if next_level_serialized_object["type"] == "method": # state change of task