Skip to content

Commit

Permalink
We probably don't care if the hook was stopped
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonVides committed Jan 12, 2022
1 parent 3bf8282 commit 84b267f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/gen_hook.erl
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ run_hook([Handler | Ls], Acc, Params, Key) ->
{ok, NewAcc} ->
run_hook(Ls, NewAcc, Params, Key);
{stop, NewAcc} ->
{stop, NewAcc};
{ok, NewAcc};
Other ->
?MODULE:error_running_hook(Other, Handler, Acc, Params, Key),
run_hook(Ls, Acc, Params, Key)
Expand Down
2 changes: 1 addition & 1 deletion test/gen_hook_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ run_fold_stops_when_handler_returns_stop(_) ->
?assertEqual(ok, gen_hook:add_handlers(HookHandlers)),
%% run the hook
N = ((0 + 3) * 2), %% 6
?assertEqual({stop, N}, gen_hook:run_fold(calculate, ?HOOK_TAG1, 0, #{n => 2})),
?assertEqual({ok, N}, gen_hook:run_fold(calculate, ?HOOK_TAG1, 0, #{n => 2})),
%% check hook handlers execution sequence
Self = self(),
?assertEqual([{Self,
Expand Down

0 comments on commit 84b267f

Please sign in to comment.