Add macro error help trace for the users #1319
Unanswered
BrucePerens
asked this question in
Feature requests & Ideas
Replies: 1 comment 1 reply
-
@BrucePerens I think you're on to something here. Even if it's not as heavy as your example, adding in little comments can help a ton when we can't catch it ourselves. Here's an example of a simple comment in a macro that was just added to Lucky: #1321 I don't know how Crystal chooses how much to show in the error output vs the output with |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
One of the most difficult things about the Lucky Framework for me is that my programming errors often show up in the middle of macro code instead of where I wrote them. I found that I can add help for the programmer in my macros, which is shown in the error report from --error-trace and does not add space in the compiled code. Here is some sample macro code to demonstrate what I'm doing:
When I test the code with a deliberately-injected error, I get this output from
crystal build --error-trace
. The "target method" lines would not apply to Lucky most of the time, but the information for that comes from The ASTNode and@type
. Every ASTNode includesASTNode#filename
andASTNode#line_number
, you don't strictly have to pass __FILE__ and __LINE__.The progam containing this is at https://github.com/BrucePerens/delegate
Beta Was this translation helpful? Give feedback.
All reactions