我有这样的代码:
try {
var client = new Steam.SteamClient();
client.logOn(credentials);
} catch(err) {
console.log(err);
return;
}
但仍无法发现错误:
MacBook-Pro:steam $ node test.js
\events.js:85
throw er; // Unhandled 'error' event
^
Error: Logon fail: 63
at SteamClient.handlers.(anonymous function) (/Users/Sites/steam/node_modules/steam/lib/handlers/user.js:178:11)
at SteamClient._netMsgReceived (/Users/Sites/steam/node_modules/steam/lib/steam_client.js:106:26)
at SteamClient.handlers.(anonymous function) (/Users/Sites/steam/node_modules/steam/lib/steam_client.js:192:10)
at SteamClient._netMsgReceived (/Users/Sites/steam/node_modules/steam/lib/steam_client.js:106:26)
at Connection.emit (events.js:107:17)
at Connection._readPacket (/Users/Sites/steam/node_modules/steam/lib/connection.js:50:8)
at Connection.emit (events.js:104:17)
at emitReadable_ (_stream_readable.js:424:10)
at emitReadable (_stream_readable.js:418:7)
at readableAddChunk (_stream_readable.js:174:11)
问题是我有一个acc列表,需要授权那些,这是好的。但是在这个错误程序关闭。
答案 0 :(得分:2)
错误通过Steam客户端的事件传递,而不是通过例外传递。
试试这个:
var client = new Steam.SteamClient();
client.logOn(credentials);
client.on('error', function(err) {
console.error('An error happened!');
console.error(err);
});
更多here。