Skip to content

Commit e025e36

Browse files
committed
ensure create_troubleshooting does not loop inefinitely
1 parent 79b26a5 commit e025e36

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/service-library/src/servicelib/logging_errors.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ def _collect_causes(exc: BaseException) -> str:
3636
seen.add(id(current))
3737
causes.append(f"[{type(current).__name__}]'{current}'")
3838
current = getattr(current, "__cause__", None)
39+
if len(causes) > 10: # Prevent excessive chains
40+
causes.append("[... truncated]")
41+
break
3942
return " <- ".join(causes)
4043

4144
debug_data = json_dumps(

0 commit comments

Comments
 (0)