Last active
May 22, 2019 16:22
-
-
Save jrfondren/de4ab3f935e55a4fd9c44f8fb81a145b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type | |
Error1 = object of Exception | |
Error2 = object of Exception | |
proc t1(error: ref Exception) = | |
raise error | |
try: | |
t1(newException(Error1, "foo")) | |
except Error1: | |
echo "got error1" | |
except Exception as e: | |
if e of Error1: | |
echo "got error1 as exception" | |
else: | |
echo "what?" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# as above | |
got error1 | |
# with `except Error2` instead for the first handler: | |
got error1 as exception |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment