I frequently debug macros by writing them as functions that operate on
expressions, and then define the macro so it calls the function.
--Tim
On Wednesday, October 22, 2014 03:06:10 AM Ivar Nesje wrote:
> The problem is that the error from the macro evaluation is an error that
> gets raised when evaluating the source, so you need to put try outside the
> include of the file or use eval:
>
> try
> eval(:(@a))
> end
>
> You can also put the try block inside the macro.
>
> Ivar
>
> kl. 11:59:39 UTC+2 onsdag 22. oktober 2014 skrev Mauro følgende:
> > Is it possibly to catch an error happening during macro evaluation?
> >
> > Example:
> > ```
> > macro a()
> >
> > error("error in marco itself")
> >
> > end
> >
> > macro b()
> >
> > :(error("error in marco generated code"))
> >
> > end
> >
> > # works:
> > try
> >
> > @b
> >
> > end
> >
> > # still errors:
> > try
> >
> > @a
> >
> > end
> > ```
> >
> > How to `try` the error in `@a`?