You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2012/08/20 17:15:24 UTC

[2/4] js commit: [android] Simplify error cases of callback.js

[android] Simplify error cases of callback.js


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/ff0fd30e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/ff0fd30e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/ff0fd30e

Branch: refs/heads/master
Commit: ff0fd30e7f8c3c837d218f35161a57a86fd71fc6
Parents: daf2cab
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon Aug 20 11:10:53 2012 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Aug 20 11:10:53 2012 -0400

----------------------------------------------------------------------
 lib/android/plugin/android/callback.js |   22 +++++-----------------
 1 files changed, 5 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/ff0fd30e/lib/android/plugin/android/callback.js
----------------------------------------------------------------------
diff --git a/lib/android/plugin/android/callback.js b/lib/android/plugin/android/callback.js
index d17c5ab..4a5b7bf 100644
--- a/lib/android/plugin/android/callback.js
+++ b/lib/android/plugin/android/callback.js
@@ -37,24 +37,12 @@ module.exports = {
                     setTimeout(callback, 10);
                 }
 
-                // If security error
-                else if (xmlhttp.status === 403) {
-                    console.log("JSCallback Error: Invalid token.  Stopping callbacks.");
-                }
-
-                // If server is stopping
-                else if (xmlhttp.status === 503) {
-                    console.log("JSCallback Server Closed: Stopping callbacks.");
-                }
-
-                // If request wasn't GET
-                else if (xmlhttp.status === 400) {
-                    console.log("JSCallback Error: Bad request.  Stopping callbacks.");
-                }
-
-                // If error, revert to polling
+                // 0 == Page is unloading.
+                // 400 == Bad request.
+                // 403 == invalid token.
+                // 503 == server stopped.
                 else {
-                    console.log("JSCallback Error: Request failed.");
+                    console.log("JSCallback Error: Request failed with status " + xmlhttp.status);
                     exec.setNativeToJsBridgeMode(exec.nativeToJsModes.POLLING);
                 }
             }