Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

FUNCT don't leak the internal exception wrapping in history entries

A better solution would be to create a proper ADT for history management
  • Loading branch information...
commit 920b515b04f0f25d61b956cdf2c553ff9becd217 1 parent 8e2cb95
@samuelrivas authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/moka_call_handler.erl
View
11 src/moka_call_handler.erl
@@ -121,7 +121,7 @@ handle_call({get_response, ExceptionTag, Args}, From, State) ->
moka_history:add_call(
State#state.history_server,
State#state.call_description,
- Args, Result),
+ Args, result_to_history(ExceptionTag, Result)),
gen_server:reply(From, Result)
end),
@@ -162,3 +162,12 @@ is_exception(_, _) -> false.
raise_exception({moka_exception, _Tag, Class, Reason, Stacktrace}) ->
erlang:raise(Class, Reason, Stacktrace).
+
+result_to_history(Tag, Result) ->
+ case is_exception(Tag, Result) of
+ true -> exception_to_history(Result);
+ false -> Result
+ end.
+
+exception_to_history({moka_exception, _Tag, Class, Reason, _Stacktrace}) ->
+ {exception, Class, Reason}.
Please sign in to comment.
Something went wrong with that request. Please try again.