diff --git a/tests/lib/screenshot-testing/support/test-environment.js b/tests/lib/screenshot-testing/support/test-environment.js
index <HASH>..<HASH> 100644
--- a/tests/lib/screenshot-testing/support/test-environment.js
+++ b/tests/lib/screenshot-testing/support/test-environment.js
@@ -66,11 +66,13 @@ TestingEnvironment.prototype._call = function (params, done) {
             try {
                 response = JSON.parse(response);
             } catch (e) {
-                throw new Error("Unable to parse JSON response: " + response);
+                done(new Error("Unable to parse JSON response: " + response));
+                return;
             }
 
             if (response.result == "error") {
-                throw new Error("API returned error: " + response.message);
+                done(new Error("API returned error: " + response.message));
+                return;
             }
         }
Refs #<I>, pass along errors to callback in testEnvironment Piwik API/Controller calls.