@@ -1059,7 +1059,10 @@ function client_i:start()
10591059 handler (self )
10601060 end
10611061 end , function (err )
1062- print (debug.traceback (err , 2 ))
1062+ if self .handle_error_func_ then
1063+ self .handle_error_func_ (err )
1064+ end
1065+ return err
10631066 end )
10641067 if not ok then
10651068 error (err )
@@ -1105,7 +1108,7 @@ function client_i:tick_resume_()
11051108 local ok , err = coroutine.resume (self .proto_coro_ )
11061109 if not ok then
11071110 self .proto_coro_ = nil
1108- error (err )
1111+ error (" proto coroutine: " .. err , 0 )
11091112 end
11101113 if self .proto_coro_ and coroutine.status (self .proto_coro_ ) == " dead" then
11111114 error (" proto coroutine terminated" )
@@ -1414,31 +1417,32 @@ end
14141417local function new (params )
14151418 local now = socket .gettime ()
14161419 return setmetatable ({
1417- host_ = params .host ,
1418- port_ = params .port ,
1419- secure_ = params .secure ,
1420- event_log_ = params .event_log ,
1421- backlog_ = params .backlog ,
1422- rx_ = buffer_list .new ({ limit = config .recvq_limit }),
1423- tx_ = buffer_list .new ({ limit = config .sendq_limit }),
1424- connecting_since_ = now ,
1425- last_ping_sent_at_ = now ,
1426- last_ping_received_at_ = now ,
1427- status_ = " ready" ,
1428- window_ = params .window ,
1429- profile_ = params .profile ,
1430- localcmd_ = params .localcmd ,
1431- initial_room_ = params .initial_room ,
1432- set_id_func_ = params .set_id_func ,
1433- get_id_func_ = params .get_id_func ,
1434- set_qa_func_ = params .set_qa_func ,
1435- get_qa_func_ = params .get_qa_func ,
1436- log_event_func_ = params .log_event_func ,
1437- should_reconnect_func_ = params .should_reconnect_func ,
1420+ host_ = params .host ,
1421+ port_ = params .port ,
1422+ secure_ = params .secure ,
1423+ event_log_ = params .event_log ,
1424+ backlog_ = params .backlog ,
1425+ rx_ = buffer_list .new ({ limit = config .recvq_limit }),
1426+ tx_ = buffer_list .new ({ limit = config .sendq_limit }),
1427+ connecting_since_ = now ,
1428+ last_ping_sent_at_ = now ,
1429+ last_ping_received_at_ = now ,
1430+ status_ = " ready" ,
1431+ window_ = params .window ,
1432+ profile_ = params .profile ,
1433+ localcmd_ = params .localcmd ,
1434+ initial_room_ = params .initial_room ,
1435+ set_id_func_ = params .set_id_func ,
1436+ get_id_func_ = params .get_id_func ,
1437+ set_qa_func_ = params .set_qa_func ,
1438+ get_qa_func_ = params .get_qa_func ,
1439+ log_event_func_ = params .log_event_func ,
1440+ handle_error_func_ = params .handle_error_func ,
1441+ should_reconnect_func_ = params .should_reconnect_func ,
14381442 should_not_reconnect_func_ = params .should_not_reconnect_func ,
1439- id_to_member = {},
1440- nick_colour_seed_ = 0 ,
1441- fps_sync_ = false ,
1443+ id_to_member = {},
1444+ nick_colour_seed_ = 0 ,
1445+ fps_sync_ = false ,
14421446 }, client_m )
14431447end
14441448
0 commit comments