Explorar el Código

don't throw strings

jomo hace 9 años
padre
commit
9cdca6acda
Se han modificado 2 ficheros con 2 adiciones y 2 borrados
  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:
         // this shouldn't usually happen, but occasionally does
         // forcing error so it's not cached
-        error = error || "TooManyRequestsException";
+        error = error || new Error("TooManyRequestsException");
         break;
       default:
         if (!error) {

+ 1 - 1
test/test.js

@@ -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, "TooManyRequestsException");
+                assert.strictEqual(err.message, "TooManyRequestsException");
                 assert.strictEqual(profile.error, "TooManyRequestsException");
                 done();
               });