+
+
diff --git a/NzbDrone.Web/_backboneApp/CassetteConfiguration.cs b/NzbDrone.Web/_backboneApp/CassetteConfiguration.cs
index 0d2b54258..32c71a0cd 100644
--- a/NzbDrone.Web/_backboneApp/CassetteConfiguration.cs
+++ b/NzbDrone.Web/_backboneApp/CassetteConfiguration.cs
@@ -31,6 +31,7 @@ namespace NzbDrone.Web.Backbone.NzbDrone
bundles.Add(NZBDRONE, new[]{
APP_PATH + "\\AddSeries\\AddSeriesLayout.js",
+ APP_PATH + "\\Shared\\ErrorView.js",
});
diff --git a/NzbDrone.Web/_backboneApp/Content/base.css b/NzbDrone.Web/_backboneApp/Content/base.css
index 8d07034b3..bae5d5793 100644
--- a/NzbDrone.Web/_backboneApp/Content/base.css
+++ b/NzbDrone.Web/_backboneApp/Content/base.css
@@ -58,3 +58,12 @@ body {
text-align: center;
padding: 30px;
}
+
+
+#error-region .alert {
+ margin: 10px;
+}
+
+#error-region .alert .icon-warning-sign {
+ padding-right: 10px;
+}
diff --git a/NzbDrone.Web/_backboneApp/Shared/ErrorModel.js b/NzbDrone.Web/_backboneApp/Shared/ErrorModel.js
new file mode 100644
index 000000000..96cbfa33e
--- /dev/null
+++ b/NzbDrone.Web/_backboneApp/Shared/ErrorModel.js
@@ -0,0 +1,16 @@
+///
+
+NzbDrone.Shared.ErrorCollection = Backbone.Collection.extend({
+
+ model: NzbDrone.Shared.ErrorModel,
+
+});
+
+
+NzbDrone.Shared.ErrorModel = Backbone.Model.extend({
+
+ defaults: {
+ "title": "NO_TITLE",
+ "message": "NO_MESSAGE",
+ }
+});
diff --git a/NzbDrone.Web/_backboneApp/Shared/ErrorTemplate.html b/NzbDrone.Web/_backboneApp/Shared/ErrorTemplate.html
new file mode 100644
index 000000000..c5a581e88
--- /dev/null
+++ b/NzbDrone.Web/_backboneApp/Shared/ErrorTemplate.html
@@ -0,0 +1,4 @@
+
+///
+
+NzbDrone.Shared.ErrorItemView = Backbone.Marionette.ItemView.extend({
+ template: "Shared/ErrorTemplate",
+});
+
+NzbDrone.Shared.ErrorView = Backbone.Marionette.CollectionView.extend({
+
+ itemView: NzbDrone.Shared.ErrorItemView,
+
+ initialize: function () {
+
+ this.collection = new NzbDrone.Shared.ErrorCollection();
+ this.listenTo(this.collection, 'reset', this.render);
+ },
+});
+
+
+
+NzbDrone.addInitializer(function (options) {
+
+ console.log("initializing error handler");
+
+ NzbDrone.Shared.ErrorView.instance = new NzbDrone.Shared.ErrorView();
+
+ NzbDrone.errorRegion.show(NzbDrone.Shared.ErrorView.instance);
+
+});
+
+
+window.onerror = function (msg, url, line) {
+
+ var errorView = NzbDrone.Shared.ErrorView.instance;
+
+ if (errorView) {
+ var model = new NzbDrone.Shared.ErrorModel();
+
+ var a = document.createElement('a');
+ a.href = url;
+
+ model.set('title', a.pathname.split('/').pop() + " : " + line);
+ model.set('message', msg);
+ errorView.collection.add(model);
+ } else {
+ alert("Error: " + msg + "\nurl: " + url + "\nline #: " + line);
+ }
+
+ var suppressErrorAlert = false;
+ // If you return true, then error alerts (like in older versions of
+ // Internet Explorer) will be suppressed.
+ return suppressErrorAlert;
+};
+
+$(document).ajaxError(function (event, XMLHttpRequest, ajaxOptionsa) {
+
+ var errorView = NzbDrone.Shared.ErrorView.instance;
+
+ var model = new NzbDrone.Shared.ErrorModel();
+ model.set('title', ajaxOptionsa.url + " : " + XMLHttpRequest.statusText);
+ model.set('message', XMLHttpRequest.responseText);
+ errorView.collection.add(model);
+
+ var suppressErrorAlert = false;
+ // If you return true, then error alerts (like in older versions of
+ // Internet Explorer) will be suppressed.
+ return suppressErrorAlert;
+});
\ No newline at end of file
diff --git a/NzbDrone.Web/_backboneApp/app.js b/NzbDrone.Web/_backboneApp/app.js
index 7b59464c9..ac7d8c2a4 100644
--- a/NzbDrone.Web/_backboneApp/app.js
+++ b/NzbDrone.Web/_backboneApp/app.js
@@ -10,7 +10,7 @@
///
///
///
-///
+///
if (typeof console == "undefined") {
window.console = { log: function () { } };
@@ -74,6 +74,7 @@ NzbDrone.addInitializer(function (options) {
NzbDrone.addRegions({
mainRegion: "#main-region",
+ errorRegion: "#error-region",
});
NzbDrone.Router = new NzbDrone.Router();
diff --git a/NzbDrone.Web/_backboneApp/errorHandler.js b/NzbDrone.Web/_backboneApp/errorHandler.js
deleted file mode 100644
index 955a67e8d..000000000
--- a/NzbDrone.Web/_backboneApp/errorHandler.js
+++ /dev/null
@@ -1,15 +0,0 @@
-///
-
-window.onerror = function (msg, url, line) {
- alert("Error: " + msg + "\nurl: " + url + "\nline #: " + line);
-
-
- var suppressErrorAlert = false;
- // If you return true, then error alerts (like in older versions of
- // Internet Explorer) will be suppressed.
- return suppressErrorAlert;
-};
-
-$(document).ajaxSuccess(function (event, XMLHttpRequest, ajaxOptionsa) {
- console.log(ajaxOptionsa);
-});
\ No newline at end of file
diff --git a/NzbDrone.Web/_backboneApp/nzbdrone.logging.js b/NzbDrone.Web/_backboneApp/nzbdrone.logging.js
new file mode 100644
index 000000000..69069ac09
--- /dev/null
+++ b/NzbDrone.Web/_backboneApp/nzbdrone.logging.js
@@ -0,0 +1,3 @@
+$(document).ajaxSuccess(function (event, XMLHttpRequest, ajaxOptionsa) {
+ console.log(ajaxOptionsa);
+});
\ No newline at end of file
+
+ {{title}} {{message}}
+
diff --git a/NzbDrone.Web/_backboneApp/Shared/ErrorView.js b/NzbDrone.Web/_backboneApp/Shared/ErrorView.js
new file mode 100644
index 000000000..95b999341
--- /dev/null
+++ b/NzbDrone.Web/_backboneApp/Shared/ErrorView.js
@@ -0,0 +1,68 @@
+///