mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-03-23 21:50:10 +08:00
Moved checking for Steam Community errors to main SteamCommunity
This commit is contained in:
parent
0f16f11668
commit
b1e31b32fe
@ -18,9 +18,7 @@ SteamCommunity.prototype.getSteamGroup = function(id, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(body.match(/<h1>Sorry!<\/h1>/)) {
|
||||
var match = body.match(/<h3>(.+)<\/h3>/);
|
||||
callback(match ? match[1] : "Unknown error occurred");
|
||||
if(self._checkCommunityError(body, callback)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -110,6 +108,10 @@ CSteamGroup.prototype.postAnnouncement = function(headline, content, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Handle Community errors
|
||||
if(self._community._checkCommunityError(body, callback)) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback(null);
|
||||
});
|
||||
};
|
||||
|
10
index.js
10
index.js
@ -120,4 +120,14 @@ function generateSessionID() {
|
||||
return Math.floor(Math.random() * 1000000000);
|
||||
};
|
||||
|
||||
SteamCommunity.prototype._checkCommunityError = function(html, callback) {
|
||||
if(html.match(/<h1>Sorry!<\/h1>/)) {
|
||||
var match = html.match(/<h3>(.+)<\/h3>/);
|
||||
callback(match ? match[1] : "Unknown error occurred");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
require('./classes/CSteamGroup.js');
|
||||
|
Loading…
Reference in New Issue
Block a user