diff options
| author | Rusty Wagner <rusty.wagner@gmail.com> | 2025-08-01 17:02:14 -0400 |
|---|---|---|
| committer | Rusty Wagner <rusty.wagner@gmail.com> | 2025-08-01 20:56:33 -0400 |
| commit | 15c635b873105eda2861430d062ea3f6bdfe9d9b (patch) | |
| tree | f5b17f7aa1388660992e233b3711654aad0cfb0c /python/typeprinter.py | |
| parent | 24fef31b14b89198185e5edc39ab7e6a7ef2e9ba (diff) | |
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
Diffstat (limited to 'python/typeprinter.py')
| -rw-r--r-- | python/typeprinter.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/python/typeprinter.py b/python/typeprinter.py index 20c1f829..be885c07 100644 --- a/python/typeprinter.py +++ b/python/typeprinter.py @@ -36,7 +36,7 @@ from . import types from . import function as _function from . import binaryview from . import typecontainer -from .log import log_error +from .log import log_error_for_exception from .enums import TokenEscapingType @@ -128,7 +128,7 @@ class TypePrinter(metaclass=_TypePrinterMetaclass): return True except: - log_error(traceback.format_exc()) + log_error_for_exception("Unhandled Python exception in TypePrinter._get_type_tokens") return False def _get_type_tokens_before_name(self, ctxt, type, platform, base_confidence, parent_type, escaping, result, result_count): @@ -149,7 +149,7 @@ class TypePrinter(metaclass=_TypePrinterMetaclass): return True except: - log_error(traceback.format_exc()) + log_error_for_exception("Unhandled Python exception in TypePrinter._get_type_tokens_before_name") return False def _get_type_tokens_after_name(self, ctxt, type, platform, base_confidence, parent_type, escaping, result, result_count): @@ -170,7 +170,7 @@ class TypePrinter(metaclass=_TypePrinterMetaclass): return True except: - log_error(traceback.format_exc()) + log_error_for_exception("Unhandled Python exception in TypePrinter._get_type_tokens_after_name") return False def _get_type_string(self, ctxt, type, platform, name, escaping, result): @@ -186,7 +186,7 @@ class TypePrinter(metaclass=_TypePrinterMetaclass): result[0] = TypePrinter._cached_string return True except: - log_error(traceback.format_exc()) + log_error_for_exception("Unhandled Python exception in TypePrinter._get_type_string") return False def _get_type_string_before_name(self, ctxt, type, platform, escaping, result): @@ -202,7 +202,7 @@ class TypePrinter(metaclass=_TypePrinterMetaclass): result[0] = TypePrinter._cached_string return True except: - log_error(traceback.format_exc()) + log_error_for_exception("Unhandled Python exception in TypePrinter._get_type_string_before_name") return False def _get_type_string_after_name(self, ctxt, type, platform, escaping, result): @@ -218,7 +218,7 @@ class TypePrinter(metaclass=_TypePrinterMetaclass): result[0] = TypePrinter._cached_string return True except: - log_error(traceback.format_exc()) + log_error_for_exception("Unhandled Python exception in TypePrinter._get_type_string_after_name") return False def _get_type_lines(self, ctxt, type, container, name, padding_cols, collapsed, escaping, result, result_count): @@ -237,7 +237,7 @@ class TypePrinter(metaclass=_TypePrinterMetaclass): return True except: - log_error(traceback.format_exc()) + log_error_for_exception("Unhandled Python exception in TypePrinter._get_type_lines") return False def _print_all_types(self, ctxt, names, types_, type_count, data, padding_cols, escaping, result): @@ -258,7 +258,7 @@ class TypePrinter(metaclass=_TypePrinterMetaclass): result[0] = TypePrinter._cached_string return True except: - log_error(traceback.format_exc()) + log_error_for_exception("Unhandled Python exception in TypePrinter._print_all_types") return False def _free_tokens(self, ctxt, tokens, count): @@ -266,7 +266,7 @@ class TypePrinter(metaclass=_TypePrinterMetaclass): TypePrinter._cached_tokens = None return True except: - log_error(traceback.format_exc()) + log_error_for_exception("Unhandled Python exception in TypePrinter._free_tokens") return False def _free_string(self, ctxt, string): @@ -274,7 +274,7 @@ class TypePrinter(metaclass=_TypePrinterMetaclass): TypePrinter._cached_string = None return True except: - log_error(traceback.format_exc()) + log_error_for_exception("Unhandled Python exception in TypePrinter._free_string") return False def _free_lines(self, ctxt, lines, count): @@ -285,7 +285,7 @@ class TypePrinter(metaclass=_TypePrinterMetaclass): TypePrinter._cached_lines = None return True except: - log_error(traceback.format_exc()) + log_error_for_exception("Unhandled Python exception in TypePrinter._free_lines") return False def _default_print_all_types(self, types_: List[Tuple[types.QualifiedNameType, types.Type]], data: binaryview.BinaryView, padding_cols = 64, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) -> str: |
