summaryrefslogtreecommitdiffstats
path: root/src/ct_helper_error_h.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/ct_helper_error_h.erl')
-rw-r--r--src/ct_helper_error_h.erl36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/ct_helper_error_h.erl b/src/ct_helper_error_h.erl
index 2cf88c8..3a2f9ea 100644
--- a/src/ct_helper_error_h.erl
+++ b/src/ct_helper_error_h.erl
@@ -58,11 +58,22 @@ handle_event({error_report, _, {_, crash_report,
State) ->
{ok, State};
%% Ignore emulator reports that are a duplicate of what Ranch gives us.
-%%
-%% The emulator always sends strings for errors, which makes it very
-%% difficult to extract the information we need, hence the regexps.
+handle_event(Event = {error, GL, {emulator, "Error in process ~p" ++ _, Args}}, State)
+ when node(GL) =:= node(), is_list(Args) ->
+ [Pid, _Node, {_Error, [{Mod, Fun, Arity, _}|_]}] = Args,
+ Crash = {Pid, Mod, Fun, Arity},
+ case lists:member(Crash, State) of
+ true ->
+ {ok, lists:delete(Crash, State)};
+ false ->
+ write_event(Event),
+ {ok, State}
+ end;
+%% The emulator always sends strings for errors in older OTP versions,
+%% which makes it very difficult to extract the information we need,
+%% hence the regexps.
handle_event(Event = {error, GL, {emulator, _, Msg}}, State)
- when node(GL) =:= node() ->
+ when node(GL) =:= node(), is_list(Msg) ->
Result = re:run(Msg,
"Error in process ([^\s]+).+? with exit value: "
".+?{stacktrace,\\[{([^,]+),([^,]+),(.+)",
@@ -118,6 +129,23 @@ handle_event(Event = {error, GL,
write_event(Event),
{ok, State}
end;
+%% Cowboy 2.13+: error coming from Cowboy.
+handle_event(Event = {error, GL,
+ {_, "Ranch listener" ++ _, [_, _, _, Pid, {_, [{M, F, A, _}|_]}|_]}},
+ State) when node(GL) =:= node() ->
+ A2 = if is_list(A) -> length(A); true -> A end,
+ Crash = {Pid, M, F, A2},
+ case lists:member(Crash, State) of
+ true ->
+ {ok, lists:delete(Crash, State)};
+ false ->
+ write_event(Event),
+ {ok, State}
+ end;
+handle_event(Event = {error, GL,
+ {_, "Ranch listener" ++ _, [_, _, _, _Pid, ct_helper_ignore|_]}},
+ State) when node(GL) =:= node() ->
+ {ok, State};
%% Cowboy 1.0.
handle_event(Event = {error, GL,
{_, "Ranch listener" ++ _, [_, _, _, Pid, {cowboy_handler, [_, _, _,