diff options
author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-08-31 17:42:24 +0100 |
---|---|---|
committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-08-31 17:42:24 +0100 |
commit | 6c77ceb9a5ef691ad21f3d5c3162e0e4d1f220fa (patch) | |
tree | af004cbf58976689a9b8bdad29e04752cc4b257f | |
parent | 788151237065fbd3faf03cad3877eaab65a25c36 (diff) | |
download | rabbitmq-server-6c77ceb9a5ef691ad21f3d5c3162e0e4d1f220fa.tar.gz |
refactored code
-rw-r--r-- | src/gen_server2.erl | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/gen_server2.erl b/src/gen_server2.erl index 77b5dec0..dc02cd28 100644 --- a/src/gen_server2.erl +++ b/src/gen_server2.erl @@ -1103,19 +1103,17 @@ function_exported_or_default(Mod, Fun, Ar, Default) -> case erlang:function_exported(Mod, Fun, Ar) of true -> case Ar of 2 -> fun (Msg, GS2State = #gs2_state { state = State }) -> - try - Mod:Fun(Msg, State) - catch - Reason -> - terminate(Reason, Msg, GS2State) + case catch Mod:Fun(Msg, State) of + Res when is_integer(Res) -> Res; + Err -> + handle_common_termination(Err, Msg, GS2State) end end; 3 -> fun (Msg, From, GS2State = #gs2_state { state = State }) -> - try - Mod:Fun(Msg, From, State) - catch - Reason -> - terminate(Reason, Msg, GS2State) + case catch Mod:Fun(Msg, From, State) of + Res when is_integer(Res) -> Res; + Err -> + handle_common_termination(Err, Msg, GS2State) end end end; |