Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proc throwPair(value: int) =
- if (value mod 2) != 0:
- echo "Passed for ", value
- else:
- raise newException(ArithmeticError, "Bad value")
- template ignoreArithmetic(body: stmt): stmt {.immediate.} =
- try: body
- except ArithmeticError: discard
- template ignoreArithmeticAndLog(body: stmt): stmt {.immediate.} =
- try: body
- except ArithmeticError:
- echo "Did ignore arithmetic error!"
- proc tester() =
- for f in 0..10:
- ignoreArithmeticAndLog:
- throwPair f
- tester()
Add Comment
Please, Sign In to add comment