try... after and clean-up
Joel Reymont
joelr1@REDACTED
Thu Jan 5 15:10:36 CET 2006
I'm basically looking to improve the error handling in the following
code:
run(Args)
when is_record(Args, bot_args) ->
Bot = #bot {
poker_server = Args#bot_args.host,
dispatchers = [{"script",
Args#bot_args.script,
Args#bot_args.script_args
}],
log = Args#bot_args.log,
ignored = Args#bot_args.ignored,
lobby_bot = Args#bot_args.lobby_bot
},
Bot1 = notrace(Bot, [cl_ssl_handshake_data,
srv_ssl_handshake_data,
srv_update_hint_text,
cl_handshake,
srv_handshake,
srv_news]),
case catch(util:connect_script_server()) of
UtilSock when is_port(UtilSock) ->
Bot2 = Bot1#bot {
util_sock = UtilSock
},
case catch(util:connect(Bot2,
[lobby_con_wrap(),
lobby_handle_wrap(),
connected])) of
Bot3 when is_record(Bot3, bot) ->
case catch(run(Bot3, handle(Bot3, handshake))) of
ok ->
ok;
X ->
util:error(Bot3, X)
end;
X ->
util:error(Bot2, X)
end;
X ->
util:error(Bot1, X)
end.
--
http://wagerlabs.com/
More information about the erlang-questions
mailing list