Detect when we aren't logged in and should be

This commit is contained in:
Alexander Corn 2016-03-05 18:58:39 -05:00
parent 840e9548ed
commit 593ed6b9ef

View File

@ -97,9 +97,17 @@ SteamCommunity.prototype._checkHttpError = function(err, response, callback) {
};
SteamCommunity.prototype._checkCommunityError = function(html, callback) {
var err;
if(html && html.match(/<h1>Sorry!<\/h1>/)) {
var match = html.match(/<h3>(.+)<\/h3>/);
var err = new Error(match ? match[1] : "Unknown error occurred");
err = new Error(match ? match[1] : "Unknown error occurred");
callback(err);
return err;
}
if (html && html.match(/g_steamID = false;/) && html.match(/<h1>Sign In<\/h1>/)) {
err = new Error("Not Logged In");
callback(err);
return err;
}