various networking.js improvements

- cleaned up some messy if/else code, replaced with nicely readable switch/case
- catch JSON.parse errors
This commit is contained in:
jomo
2015-08-31 00:10:35 +02:00
parent ccc7314ea0
commit 3a61e15abf
2 changed files with 41 additions and 20 deletions

View File

@@ -1013,7 +1013,7 @@ describe("Crafatar", function() {
it("uuid should be rate limited", function(done) {
networking.get_profile(rid, id, function() {
networking.get_profile(rid, id, function(err, profile) {
assert.strictEqual(err, "TooManyRequests");
assert.strictEqual(err, "TooManyRequestsException");
assert.strictEqual(profile.error, "TooManyRequestsException");
done();
});