From acfed2d5d71fe7741ce31cbd8a153de85e916fe7 Mon Sep 17 00:00:00 2001 From: Chyi Pin Lim Date: Tue, 8 Nov 2016 09:38:07 -0700 Subject: [PATCH] Prevent getAll looping indefinitely when error occurs Return when calling the callback when an error occurs. Prevent retrieving of next page (which will fail again). A simple scenario would be an Invalid API token. --- lib/Pipedrive.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Pipedrive.js b/lib/Pipedrive.js index 7737ce3c..89159b92 100644 --- a/lib/Pipedrive.js +++ b/lib/Pipedrive.js @@ -191,7 +191,7 @@ THE SOFTWARE. limit: perPage }, function(err, models) { if (err) { - callback(err); + return callback(err); } else { collection = collection.concat(models); if (models.length < perPage) {