diff --git a/classes/CSteamGroup.js b/classes/CSteamGroup.js
index cf02563..517fdc3 100644
--- a/classes/CSteamGroup.js
+++ b/classes/CSteamGroup.js
@@ -18,9 +18,7 @@ SteamCommunity.prototype.getSteamGroup = function(id, callback) {
return;
}
- if(body.match(/
Sorry!<\/h1>/)) {
- var match = body.match(/(.+)<\/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);
});
};
diff --git a/index.js b/index.js
index b7ad936..30c7718 100644
--- a/index.js
+++ b/index.js
@@ -120,4 +120,14 @@ function generateSessionID() {
return Math.floor(Math.random() * 1000000000);
};
+SteamCommunity.prototype._checkCommunityError = function(html, callback) {
+ if(html.match(/Sorry!<\/h1>/)) {
+ var match = html.match(/(.+)<\/h3>/);
+ callback(match ? match[1] : "Unknown error occurred");
+ return true;
+ }
+
+ return false;
+};
+
require('./classes/CSteamGroup.js');