summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2023-03-22 13:14:30 +0000
committerRobert Newson <rnewson@apache.org>2023-03-22 13:14:46 +0000
commit200998bdfd215c545d84828e4532b58f59189a01 (patch)
treee49789f77303431827bc0d45fda0a579840d7094
parentbe5bea5c9841162436a3c072010ee57aca6174f3 (diff)
downloadcouchdb-more-couch-index-server-goop.tar.gz
capture original stack tracemore-couch-index-server-goop
-rw-r--r--src/couch_event/src/couch_event_listener_mfa.erl27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/couch_event/src/couch_event_listener_mfa.erl b/src/couch_event/src/couch_event_listener_mfa.erl
index b4cd9148a..e9b1fa47d 100644
--- a/src/couch_event/src/couch_event_listener_mfa.erl
+++ b/src/couch_event/src/couch_event_listener_mfa.erl
@@ -76,13 +76,26 @@ terminate(_Reason, _MFA) ->
ok.
handle_event(DbName, Event, #st{mod = Mod, func = Func, state = State} = St) ->
- case (catch Mod:Func(DbName, Event, State)) of
- {ok, NewState} ->
- {ok, St#st{state = NewState}};
- stop ->
- {stop, normal, St};
- Else ->
- erlang:error(Else)
+ try
+ case Mod:Func(DbName, Event, State) of
+ {ok, NewState} ->
+ {ok, St#st{state = NewState}};
+ stop ->
+ {stop, normal, St};
+ Else ->
+ couch_log:error("~p: else in handle_event for db ~p, event ~p, else ~p", [?MODULE, DbName, Event, Else]),
+ erlang:error(Else)
+ end
+ catch
+ error:Reason:Stack ->
+ couch_log:error("~p: error in handle_event for db ~p, event ~p, reason ~p, stack ~p", [?MODULE, DbName, Event, Reason, Stack]),
+ erlang:error(Reason);
+ exit:Reason:Stack ->
+ couch_log:error("~p: exit in handle_event for db ~p, event ~p, reason ~p, stack ~p", [?MODULE, DbName, Event, Reason, Stack]),
+ erlang:exit(Reason);
+ throw:Reason:Stack ->
+ couch_log:error("~p: throw in handle_event for db ~p, event ~p, reason ~p, stack ~p", [?MODULE, DbName, Event, Reason, Stack]),
+ erlang:throw(Reason)
end.
handle_cast(shutdown, St) ->