Skip to content

Commit

Permalink
🎨 Show errors again
Browse files Browse the repository at this point in the history
On touchscreen devices we want to be shown the error, however
octoprint use try {} catch which prevented window.onerror from
triggering.

Therefor override the loglevel function and call
  • Loading branch information
Paul de Vries committed Sep 9, 2018
1 parent 4a73bb1 commit 4337928
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion octoprint_touchui/static/js/touchui.bootstrap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions octoprint_touchui/static/js/touchui.bundled.js
Original file line number Diff line number Diff line change
Expand Up @@ -651,10 +651,6 @@ TouchUI.prototype.core.init = function() {
// Send Touchscreen loading status
if (window.top.postMessage) {
window.top.postMessage("loading", "*");

$(window).on("error.touchui", function(event) {
window.top.postMessage([event.originalEvent.message, event.originalEvent.filename], "*");
});
}

// Attach id for TouchUI styling
Expand Down Expand Up @@ -2151,7 +2147,6 @@ TouchUI.prototype.DOM.move.sidebar = {

init: function() {
var tabbar = this.DOM.create.tabbar;

$(this.DOM.move.sidebar.items + ':not(' + this.DOM.move.sidebar.doNotMove + ')').each(function(ind, elm) {
var id = $(elm).attr('id');

Expand Down
2 changes: 1 addition & 1 deletion octoprint_touchui/templates/touchui_load_css.jinja2
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<link href="{{ plugin_touchui_cssPath }}?{{ plugin_touchui_timestamp }}" rel="stylesheet" id="touchui-css" media="screen">
<link href="{{ plugin_touchui_cssPath }}?{{ plugin_touchui_timestamp }}" rel="stylesheet" id="touchui-css" media="screen">
9 changes: 9 additions & 0 deletions source/js/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
!function() {

// Catch errors
if (window.log && window.log.error) {
var old = window.log.error;
window.log.error = function(plugin, msg) {
window.top.postMessage([msg, ''], "*");
old.apply(window.log, arguments);
}
}

var Touch = new TouchUI();
Touch.domLoading();

Expand Down
4 changes: 0 additions & 4 deletions source/js/core/_init.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ TouchUI.prototype.core.init = function() {
// Send Touchscreen loading status
if (window.top.postMessage) {
window.top.postMessage("loading", "*");

$(window).on("error.touchui", function(event) {
window.top.postMessage([event.originalEvent.message, event.originalEvent.filename], "*");
});
}

// Attach id for TouchUI styling
Expand Down
1 change: 0 additions & 1 deletion source/js/dom/move/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ TouchUI.prototype.DOM.move.sidebar = {

init: function() {
var tabbar = this.DOM.create.tabbar;

$(this.DOM.move.sidebar.items + ':not(' + this.DOM.move.sidebar.doNotMove + ')').each(function(ind, elm) {
var id = $(elm).attr('id');

Expand Down

0 comments on commit 4337928

Please sign in to comment.