diff options
author | Loïc Hoguin <[email protected]> | 2023-12-04 16:23:12 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2023-12-04 16:23:12 +0100 |
commit | 040151ff7063747496020558c593f95f43408de2 (patch) | |
tree | c08540614d7d12b54030b7f805bd6e7fd17cbeeb /src/ct_helper_error_h.erl | |
parent | bf7acaf727ed7c5942fc1d9417de1d0c2825fac1 (diff) | |
download | ct_helper-040151ff7063747496020558c593f95f43408de2.tar.gz ct_helper-040151ff7063747496020558c593f95f43408de2.tar.bz2 ct_helper-040151ff7063747496020558c593f95f43408de2.zip |
Handle emulator errors properly for OTP-26+
Diffstat (limited to 'src/ct_helper_error_h.erl')
-rw-r--r-- | src/ct_helper_error_h.erl | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/ct_helper_error_h.erl b/src/ct_helper_error_h.erl index 2cf88c8..5d7cf02 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,\\[{([^,]+),([^,]+),(.+)", |