airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata-django-portal] 03/05: AIRAVATA-2727 AIRAVATA-2638 Vue global error handler
Date Fri, 17 Aug 2018 19:35:59 GMT
This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git

commit 5e6f01f13aec1cccc84174577443a09ca7ce4a23
Author: Marcus Christie <machrist@iu.edu>
AuthorDate: Fri Aug 17 15:21:11 2018 -0400

    AIRAVATA-2727 AIRAVATA-2638 Vue global error handler
---
 .../apps/admin/static/django_airavata_admin/src/main.js  |  3 +--
 .../apps/api/static/django_airavata_api/js/index.js      |  4 ++--
 .../common}/js/errors/GlobalErrorHandler.js              | 16 +++++++++++++---
 django_airavata/static/common/js/index.js                |  6 ++++++
 4 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/main.js b/django_airavata/apps/admin/static/django_airavata_admin/src/main.js
index 46e5ecc..28c151e 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/main.js
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/main.js
@@ -11,8 +11,7 @@ import ComputeResourcePreferenceDashboard from './components/dashboards/ComputeR
 import BootstrapVue from 'bootstrap-vue'
 import 'bootstrap-vue/dist/bootstrap-vue.css'
 
-import { components } from 'django-airavata-common-ui'
-import { errors } from 'django-airavata-api'
+import { components, errors } from 'django-airavata-common-ui'
 
 import router from './router';
 import store from './store/store';
diff --git a/django_airavata/apps/api/static/django_airavata_api/js/index.js b/django_airavata/apps/api/static/django_airavata_api/js/index.js
index ba494bc..2d3aaf4 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/index.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/index.js
@@ -1,5 +1,5 @@
-import GlobalErrorHandler from './errors/GlobalErrorHandler'
 import UnhandledError from './errors/UnhandledError'
+import UnhandledErrorDispatcher from './errors/UnhandledErrorDispatcher'
 import UnhandledErrorDisplayList from './errors/UnhandledErrorDisplayList'
 
 import ApplicationInterfaceDefinition from './models/ApplicationInterfaceDefinition'
@@ -45,8 +45,8 @@ import FetchUtils from './utils/FetchUtils'
 import PaginationIterator from './utils/PaginationIterator'
 
 exports.errors = {
-    GlobalErrorHandler,
     UnhandledError,
+    UnhandledErrorDispatcher,
     UnhandledErrorDisplayList,
 }
 
diff --git a/django_airavata/apps/api/static/django_airavata_api/js/errors/GlobalErrorHandler.js
b/django_airavata/static/common/js/errors/GlobalErrorHandler.js
similarity index 50%
rename from django_airavata/apps/api/static/django_airavata_api/js/errors/GlobalErrorHandler.js
rename to django_airavata/static/common/js/errors/GlobalErrorHandler.js
index 02b5278..a3b3f19 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/errors/GlobalErrorHandler.js
+++ b/django_airavata/static/common/js/errors/GlobalErrorHandler.js
@@ -1,16 +1,17 @@
-// import StackTrace from 'stacktrace-js'
 
-import UnhandledErrorDispatcher from './UnhandledErrorDispatcher'
+import Vue from 'vue'
+import { errors } from 'django-airavata-api'
 
 class GlobalErrorHandler {
 
     init() {
         console.log("Initializing GlobalErrorHandler...");
         window.onerror = this.handleGlobalError;
+        Vue.config.errorHandler = this.vueGlobalErrorHandler;
     }
 
     handleGlobalError(msg, url, lineNo, columnNo, error) {
-        UnhandledErrorDispatcher.reportError({
+        errors.UnhandledErrorDispatcher.reportError({
             message: msg,
             error: error,
             details: {
@@ -22,6 +23,15 @@ class GlobalErrorHandler {
 
         return false;
     }
+
+    vueGlobalErrorHandler(err, vm, info) {
+        console.log("Vue Global Error Handler", err, vm, info);
+        errors.UnhandledErrorDispatcher.reportError({
+            message: err.message,
+            error: err,
+            details: info,
+        });
+    }
 }
 
 export default new GlobalErrorHandler()
diff --git a/django_airavata/static/common/js/index.js b/django_airavata/static/common/js/index.js
index 28a2cfa..30b0672 100644
--- a/django_airavata/static/common/js/index.js
+++ b/django_airavata/static/common/js/index.js
@@ -5,6 +5,8 @@ import NotificationsDisplay from './components/NotificationsDisplay.vue'
 import Pager from './components/Pager.vue'
 import ShareButton from './components/ShareButton.vue'
 
+import GlobalErrorHandler from './errors/GlobalErrorHandler'
+
 import ListLayout from './layouts/ListLayout.vue'
 
 import * as utils from './utils'
@@ -18,6 +20,10 @@ exports.components = {
     ShareButton,
 }
 
+exports.errors = {
+    GlobalErrorHandler,
+}
+
 exports.layouts = {
     ListLayout,
 }


Mime
View raw message