From 15c635b873105eda2861430d062ea3f6bdfe9d9b Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Fri, 1 Aug 2025 17:02:14 -0400 Subject: Use log_error_for_exception in the Python API to pass tracebacks in the stack trace associated with log messages, instead of creating large mutli-line messages for every exception --- python/typearchive.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'python/typearchive.py') diff --git a/python/typearchive.py b/python/typearchive.py index bc2dea7a..0085fe10 100644 --- a/python/typearchive.py +++ b/python/typearchive.py @@ -771,25 +771,25 @@ class TypeArchiveNotificationCallbacks: try: self._notify.type_added(self._archive, core.pyNativeStr(id), _types.Type.create(handle=core.BNNewTypeReference(definition))) except: - log.log_error(traceback.format_exc()) + log.log_error_for_exception("Unhandled Python exception in TypeArchiveNotificationCallbacks._type_added") def _type_updated(self, ctxt, archive: ctypes.POINTER(core.BNTypeArchive), id: ctypes.c_char_p, old_definition: ctypes.POINTER(core.BNType), new_definition: ctypes.POINTER(core.BNType)) -> None: try: self._notify.type_updated(self._archive, core.pyNativeStr(id), _types.Type.create(handle=core.BNNewTypeReference(old_definition)), _types.Type.create(handle=core.BNNewTypeReference(new_definition))) except: - log.log_error(traceback.format_exc()) + log.log_error_for_exception("Unhandled Python exception in TypeArchiveNotificationCallbacks._type_updated") def _type_renamed(self, ctxt, archive: ctypes.POINTER(core.BNTypeArchive), id: ctypes.c_char_p, old_name: ctypes.POINTER(core.BNQualifiedName), new_name: ctypes.POINTER(core.BNQualifiedName)) -> None: try: self._notify.type_renamed(self._archive, core.pyNativeStr(id), _types.QualifiedName._from_core_struct(old_name.contents), _types.QualifiedName._from_core_struct(new_name.contents)) except: - log.log_error(traceback.format_exc()) + log.log_error_for_exception("Unhandled Python exception in TypeArchiveNotificationCallbacks._type_renamed") def _type_deleted(self, ctxt, archive: ctypes.POINTER(core.BNTypeArchive), id: ctypes.c_char_p, definition: ctypes.POINTER(core.BNType)) -> None: try: self._notify.type_deleted(self._archive, core.pyNativeStr(id), _types.Type.create(handle=core.BNNewTypeReference(definition))) except: - log.log_error(traceback.format_exc()) + log.log_error_for_exception("Unhandled Python exception in TypeArchiveNotificationCallbacks._type_deleted") @property def archive(self) -> 'TypeArchive': -- cgit v1.3.1