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 | 177b3662213163dec7facb1a917442c5cb8275b1 (patch) | |
| tree | af004cbf58976689a9b8bdad29e04752cc4b257f /src | |
| parent | 024d9f37395e29ced6ae469dc780868938798c27 (diff) | |
| download | rabbitmq-server-git-177b3662213163dec7facb1a917442c5cb8275b1.tar.gz | |
refactored code
Diffstat (limited to 'src')
| -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 77b5dec049..dc02cd2888 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; |
