From a458264bc5f00a3a987f68d719c6d37f5693d067 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 28 Oct 2025 19:09:09 +0100 Subject: [PATCH] fix: improve resilience in strategy wrapper --- freqtrade/strategy/strategy_wrapper.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/freqtrade/strategy/strategy_wrapper.py b/freqtrade/strategy/strategy_wrapper.py index 4daca2b21..22f6279cf 100644 --- a/freqtrade/strategy/strategy_wrapper.py +++ b/freqtrade/strategy/strategy_wrapper.py @@ -16,13 +16,15 @@ F = TypeVar("F", bound=Callable[..., Any]) def __format_traceback(error: Exception) -> str: """Format the traceback of an exception into a formatted string.""" tb = error.__traceback__ - while tb: - if tb.tb_frame.f_code.co_filename == __file__: - # Skip frames from this file - tb = tb.tb_next - continue - return f"{tb.tb_frame.f_code.co_qualname}:{tb.tb_lineno}" - + try: + while tb: + if tb.tb_frame.f_code.co_filename == __file__: + # Skip frames from this file + tb = tb.tb_next + continue + return f"{tb.tb_frame.f_code.co_qualname}:{tb.tb_lineno}" + except Exception: + return "" return ""