-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
Nim Version
Nim Compiler Version 2.3.1 [Linux: amd64]
Compiled at 2025-07-07
Copyright (c) 2006-2025 by Andreas Rumpf
git hash: fbdc9a4c19aafc25937aaa51f5c1f01084094688
active boot switches: -d:release
Description
proc foo() =
try:
try:
raise newException(Exception, "1")
except:
echo "EXCEPT1: ", getCurrentExceptionMsg()
return # Prevents exception clearing
# raise newException(Exception, "2") # also prevents clearing
finally:
echo "FINALLY: ", getCurrentExceptionMsg()
except:
echo "EXCEPT2:", getCurrentExceptionMsg()
finally:
echo "FINALLY2: ", getCurrentExceptionMsg()
echo "LAST: ", getCurrentExceptionMsg()
foo()
Current Output
EXCEPT1: 1
FINALLY1: 1
FINALLY2: 1
Expected Output
EXCEPT1: 1
FINALLY1:
FINALLY2:
Known Workarounds
No response
Additional Information
While playing with closureiter transformation I realized I'm not accounting for this case, so I went to see how it's handled in regular code, and it turned out it isn't.
Metadata
Metadata
Assignees
Labels
No labels