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/fileaccessor.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'python/fileaccessor.py') diff --git a/python/fileaccessor.py b/python/fileaccessor.py index bc7024d6..9bf0eb85 100644 --- a/python/fileaccessor.py +++ b/python/fileaccessor.py @@ -23,7 +23,7 @@ import ctypes # Binary Ninja components from . import _binaryninjacore as core -from .log import log_error +from .log import log_error_for_exception class FileAccessor: @@ -50,7 +50,7 @@ class FileAccessor: try: return self.get_length() except: - log_error(traceback.format_exc()) + log_error_for_exception("Unhandled Python exception in FileAccessor._get_length") return 0 def _read(self, ctxt, dest, offset, length): @@ -63,7 +63,7 @@ class FileAccessor: ctypes.memmove(dest, data, len(data)) return len(data) except: - log_error(traceback.format_exc()) + log_error_for_exception("Unhandled Python exception in FileAccessor._read") return 0 def _write(self, ctxt, offset, src, length): @@ -72,7 +72,7 @@ class FileAccessor: ctypes.memmove(data, src, length) return self.write(offset, data.raw) except: - log_error(traceback.format_exc()) + log_error_for_exception("Unhandled Python exception in FileAccessor._write") return 0 -- cgit v1.3.1