Skip to content
Browse files

Fail more explicitly when /dump or /orientation fails

  • Loading branch information...
1 parent 4a40198 commit b8484cb73b2a3bd6486b2c97fbf6d899cf2e88ad @moredip moredip committed
Showing with 15 additions and 2 deletions.
  1. +1 −0 README.md
  2. +6 −1 bundle/js/controller.coffee
  3. +8 −1 bundle/js/controller.js
View
1 README.md
@@ -17,6 +17,7 @@ open http://localhost:9292
## TODO
+- populate engine list from API call
- Mouse over ersatz to highlight view in hierarchy
- history of selectors
View
7 bundle/js/controller.coffee
@@ -104,7 +104,7 @@ define ['frank'],(frank)->
reload = ->
deferable = $.Deferred()
- $.when( frank.fetchViewHeirarchy(), frank.fetchOrientation() ).done ([rawHeir,],orientation)->
+ $.when( frank.fetchViewHeirarchy(), frank.fetchOrientation() ).done( ([rawHeir,],orientation)->
deviceFamily = guessAtDeviceFamilyBasedOnViewDump(rawHeir)
treeView.model.resetViewHeir(rawHeir)
@@ -115,6 +115,11 @@ define ['frank'],(frank)->
ersatzView.render()
deferable.resolve()
+ ).fail( (args...)->
+ toastController.showToastMessage('encountered an error while talking to Frank')
+ window.alert( "Ruh roh. Encountered an error while talking to Frank.\nSee the javascript console for all the details" )
+ console.log( "Failed while talking to Frank.", args )
+ )
deferable.promise()
View
9 bundle/js/controller.js
@@ -1,5 +1,6 @@
(function() {
- var RELOAD_INTERVAL, guessAtDeviceFamilyBasedOnViewDump;
+ var RELOAD_INTERVAL, guessAtDeviceFamilyBasedOnViewDump,
+ __slice = [].slice;
RELOAD_INTERVAL = 500;
@@ -125,6 +126,12 @@
accessibleViewsView.collection.reset(accessibleViews);
ersatzView.render();
return deferable.resolve();
+ }).fail(function() {
+ var args;
+ args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ toastController.showToastMessage('encountered an error while talking to Frank');
+ window.alert("Ruh roh. Encountered an error while talking to Frank.\nSee the javascript console for all the details");
+ return console.log("Failed while talking to Frank.", args);
});
return deferable.promise();
};

0 comments on commit b8484cb

Please sign in to comment.
Something went wrong with that request. Please try again.