-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to catch HyMacroExpansionError
?
#802
Comments
I'm not sure you can catch this. Macro expansion happens at compile time, while try/catch at runtime. By the time Hy gets to the |
The reason is that macros get expanded before the program is run. Therefore, the exception occurs before the program even begins. |
Thanks. Looking forward better debugging support for macros. #741 |
You could build your own defmacro that works inside a try/catch if you were so inclined. |
Tried:
(import [hy.errors [HyMacroExpansionError]])
HyTypeError
,TypeError
andException
All failed.
Example:
1-5
all fails with throwingHyMacroExpansionError
:Tested on hy 0.10.1 (Python 2.7.6) and hy commit 42983d1 (Python Python 3.4.0)
The text was updated successfully, but these errors were encountered: