Log global errors
Use the global error handler, window.onerror, to catch miscellaneous exceptions and pipe them into the debug log. Fixes #456 // FREEBIE
This commit is contained in:
parent
c1aada4f0f
commit
ae3a834b4c
2 changed files with 29 additions and 10 deletions
|
@ -33,5 +33,9 @@
|
||||||
}).fail(resolve);
|
}).fail(resolve);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window.onerror = function(message, script, line, col, error) {
|
||||||
|
console.log(error);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
35
js/index.js
35
js/index.js
|
@ -5,21 +5,36 @@
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
function logError(error) {
|
||||||
|
extension.windows.getBackground(function(bg) {
|
||||||
|
bg.console.log('index.html: ', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onerror = function(message, script, line, col, error) {
|
||||||
|
logError(error);
|
||||||
|
};
|
||||||
|
|
||||||
var view;
|
var view;
|
||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
extension.windows.getBackground(function(bg) {
|
extension.windows.getBackground(function(bg) {
|
||||||
extension.windows.getCurrent(function(appWindow) {
|
extension.windows.getCurrent(function(appWindow) {
|
||||||
if (view) { view.remove(); }
|
try {
|
||||||
var $body = bg.$('body',document).empty();
|
if (view) { view.remove(); }
|
||||||
view = new bg.Whisper.InboxView({appWindow: appWindow});
|
var $body = bg.$('body',document).empty();
|
||||||
view.$el.prependTo($body);
|
view = new bg.Whisper.InboxView({appWindow: appWindow});
|
||||||
window.openConversation = function(conversation) {
|
view.$el.prependTo($body);
|
||||||
if (conversation) {
|
window.openConversation = function(conversation) {
|
||||||
view.openConversation(null, conversation);
|
if (conversation) {
|
||||||
}
|
view.openConversation(null, conversation);
|
||||||
};
|
}
|
||||||
openConversation(bg.getOpenConversation());
|
};
|
||||||
|
openConversation(bg.getOpenConversation());
|
||||||
|
} catch (e) {
|
||||||
|
logError(e);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue