Skip to content

Commit 5e6e10e

Browse files
committed
✨ Dump latest crash into .wake dir on debugger attach
1 parent b204053 commit 5e6e10e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

wake/development/globals.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
import rich.traceback
2222
import rich_click
23-
from rich import print as rich_print
2423
from ipdb.__main__ import _init_pdb
24+
from rich import print as rich_print
2525

2626
from wake.config import WakeConfig
2727
from wake.core import get_logger
@@ -124,6 +124,11 @@ def attach_debugger(
124124
assert e is not None
125125
assert tb is not None
126126

127+
config = get_config()
128+
tb_lines = traceback.format_exception(e_type, e, tb)
129+
(config.project_root_path / ".wake").mkdir(parents=True, exist_ok=True)
130+
(config.project_root_path / ".wake" / "crash.txt").write_text("".join(tb_lines))
131+
127132
rich_tb = rich.traceback.Traceback.from_exception(e_type, e, tb)
128133
console.print(rich_tb)
129134

0 commit comments

Comments
 (0)