[erlang-questions] terminate Cowboy

Frans Schneider schneider@REDACTED
Thu Jul 31 14:08:52 CEST 2014


Hi list,

I have a problem with stopping Cowboy from a gen_server. I use trap exit.
This is the code.

terminate(_Reason, _State) ->
     error_logger:info_msg("Cowboy was here"),
     try
         Rv = cowboy:stop_listener(xmlrpc_http_listener),
         %Rv = 1 / 0,
         error_logger:info_msg("Cowboy terminate Rv ~p", [Rv])
     catch
         _:_ -> error_logger:info_msg("Cowboy CRASH")
     end,
     ok.

I get the message "Cowboy was here" and nothing else. When I replace the 
"cowboy:stop_listener" with the division by 0, the cowboy CRASH shows 
up. Maybe that's because the compiler already detected the error?

Could somebody explain this behaviour?

Thanks,

Frans









More information about the erlang-questions mailing list