Răsfoiți Sursa

don't throw strings

jomo 9 ani în urmă
părinte
comite
9cdca6acda
2 a modificat fișierele cu 2 adăugiri și 2 ștergeri
  1. 1 1
      lib/networking.js
  2. 1 1
      test/test.js

+ 1 - 1
lib/networking.js

@@ -96,7 +96,7 @@ exp.get_from_options = function(rid, url, options, callback) {
       case 429:
       case 429:
         // this shouldn't usually happen, but occasionally does
         // this shouldn't usually happen, but occasionally does
         // forcing error so it's not cached
         // forcing error so it's not cached
-        error = error || "TooManyRequestsException";
+        error = error || new Error("TooManyRequestsException");
         break;
         break;
       default:
       default:
         if (!error) {
         if (!error) {

+ 1 - 1
test/test.js

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