Baseline: tree as shared
This commit is contained in:
1679 files changed
+1024562
No files matched your search
@@ -0,0 +1,29 @@
|
||||
def func2() raises -> None:
|
||||
raise Error("Intentional error")
|
||||
|
||||
|
||||
def func1() raises -> None:
|
||||
func2()
|
||||
|
||||
|
||||
def main() raises:
|
||||
try:
|
||||
func1()
|
||||
except e:
|
||||
print(e)
|
||||
print("-" * 20)
|
||||
var stack_trace = e.get_stack_trace()
|
||||
if stack_trace:
|
||||
print(stack_trace.value())
|
||||
else:
|
||||
print("No stack trace available")
|
||||
```
|
||||
|
||||
When you compile with debug symbols and run with stack trace generation enabled:
|
||||
|
||||
```sh
|
||||
mojo build --debug-level full stacktrace_error_capture.mojo
|
||||
```
|
||||
|
||||
```sh
|
||||
MODULAR_DEBUG=stack-trace-on-error ./stacktrace_error_capture
|
||||
Reference in new issue
Block a user