diff options
author | Raimo Niskanen <[email protected]> | 2017-02-22 15:19:08 +0100 |
---|---|---|
committer | Raimo Niskanen <[email protected]> | 2017-02-22 15:24:57 +0100 |
commit | 2f5f4ea9afccb7d8c82bdeb56440b1e43d9f34d0 (patch) | |
tree | c9fb07856d7e827e1f1f179fa6aa7abcb0b275ab /lib | |
parent | c3d724283257d5520714cd62d7377077c16e63aa (diff) | |
download | otp-2f5f4ea9afccb7d8c82bdeb56440b1e43d9f34d0.tar.gz otp-2f5f4ea9afccb7d8c82bdeb56440b1e43d9f34d0.tar.bz2 otp-2f5f4ea9afccb7d8c82bdeb56440b1e43d9f34d0.zip |
Stop pampering with stacktraces
Diffstat (limited to 'lib')
-rw-r--r-- | lib/stdlib/src/gen_statem.erl | 50 |
1 files changed, 1 insertions, 49 deletions
diff --git a/lib/stdlib/src/gen_statem.erl b/lib/stdlib/src/gen_statem.erl index fa14808f9a..d7e8504564 100644 --- a/lib/stdlib/src/gen_statem.erl +++ b/lib/stdlib/src/gen_statem.erl @@ -1161,19 +1161,6 @@ call_callback_mode(#{module := Module} = S) -> catch CallbackMode -> callback_mode_result(S, CallbackMode); - error:undef -> - %% Process undef to check for the simple mistake - %% of calling a nonexistent state function - %% to make the undef more precise - case erlang:get_stacktrace() of - [{Module,callback_mode,[]=Args,_} - |Stacktrace] -> - {error, - {undef_callback,{Module,callback_mode,Args}}, - Stacktrace}; - Stacktrace -> - {error,undef,Stacktrace} - end; Class:Reason -> {Class,Reason,erlang:get_stacktrace()} end. @@ -1231,7 +1218,7 @@ call_state_function( try case CallbackMode of state_functions -> - erlang:apply(Module, State, [Type,Content,Data]); + Module:State(Type, Content, Data); handle_event_function -> Module:handle_event(Type, Content, State, Data) end @@ -1241,41 +1228,6 @@ call_state_function( catch Result -> {ok,Result,S}; - error:badarg -> - case erlang:get_stacktrace() of - [{erlang,apply, - [Module,State,[Type,Content,Data]=Args], - _} - |Stacktrace] - when CallbackMode =:= state_functions -> - %% We get here e.g if apply fails - %% due to State not being an atom - {error, - {undef_state_function,{Module,State,Args}}, - Stacktrace}; - Stacktrace -> - {error,badarg,Stacktrace} - end; - error:undef -> - %% Process undef to check for the simple mistake - %% of calling a nonexistent state function - %% to make the undef more precise - case erlang:get_stacktrace() of - [{Module,State,[Type,Content,Data]=Args,_} - |Stacktrace] - when CallbackMode =:= state_functions -> - {error, - {undef_state_function,{Module,State,Args}}, - Stacktrace}; - [{Module,handle_event,[Type,Content,State,Data]=Args,_} - |Stacktrace] - when CallbackMode =:= handle_event_function -> - {error, - {undef_state_function,{Module,handle_event,Args}}, - Stacktrace}; - Stacktrace -> - {error,undef,Stacktrace} - end; Class:Reason -> {Class,Reason,erlang:get_stacktrace()} end. |