mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 01:44:37 +00:00
* nimStackTraceOverride: enable stack traces in exceptions This is a two-step stack trace collection scheme, because re-raised exceptions will collect multiple stack traces but use them rarely, when printing info about an uncaught exception, so it makes sense to only do the cheap stack unwinding all the time and the relatively expensive debugging information collection on-demand. `asyncfutures` implements its own `$` proc for printing `seq[StackTraceEntry]`, so we have to add the debugging info there, just like we do for the private `$` proc in `system/excpt`. * cleaned up PR #15284 Co-authored-by: Ștefan Talpalaru <stefantalpalaru@yahoo.com>
19 lines
359 B
Nim
19 lines
359 B
Nim
discard """
|
|
cmd: "nim c -d:nimStacktraceOverride $file"
|
|
output: '''begin
|
|
Traceback (most recent call last, using override)
|
|
Error: unhandled exception: stack trace produced [ValueError]
|
|
'''
|
|
exitcode: 1
|
|
"""
|
|
|
|
import asyncfutures
|
|
|
|
proc main =
|
|
echo "begin"
|
|
if true:
|
|
raise newException(ValueError, "stack trace produced")
|
|
echo "unreachable"
|
|
|
|
main()
|