Skip to content

Commit

Permalink
Merge pull request #6 from nox/let-errors-through
Browse files Browse the repository at this point in the history
Let error markers through parse_transform:do/5
  • Loading branch information
uwiger committed Apr 24, 2012
2 parents 0ec1da7 + 11f137a commit 216531d
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions src/parse_trans.erl
Expand Up @@ -309,23 +309,19 @@ depth_first(Fun, Acc, Forms, Options) when is_function(Fun, 4) ->
do(fun do_depth_first/4, Fun, Acc, Forms, Options). do(fun do_depth_first/4, Fun, Acc, Forms, Options).


do(Transform, Fun, Acc, Forms, Options) -> do(Transform, Fun, Acc, Forms, Options) ->
case [E || {error,_} = E <- Forms] of Context = initial_context(Forms, Options),
[_|_] -> {error, []}; File = Context#context.file,
[] -> try Transform(Fun, Acc, Forms, Context) of
Context = initial_context(Forms, Options), {NewForms, _} = Result when is_list(NewForms) ->
File = Context#context.file, optionally_pretty_print(NewForms, Options, Context),
try Transform(Fun, Acc, Forms, Context) of Result
{NewForms, _} = Result when is_list(NewForms) -> catch
optionally_pretty_print(NewForms, Options, Context), error:Reason ->
Result {error,
catch [{File, [{?DUMMY_LINE, ?MODULE,
error:Reason -> {Reason, erlang:get_stacktrace()}}]}]};
{error, throw:{error, Ln, What} ->
[{File, [{?DUMMY_LINE, ?MODULE, {error, [{error, {Ln, ?MODULE, What}}]}
{Reason, erlang:get_stacktrace()}}]}]};
throw:{error, Ln, What} ->
{error, [{error, {Ln, ?MODULE, What}}]}
end
end. end.


-spec top(function(), forms(), list()) -> -spec top(function(), forms(), list()) ->
Expand Down

0 comments on commit 216531d

Please sign in to comment.