Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of what needs to be done #12198

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions shell/initialize/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
},

methods: {
handleError(error) {
window.$globalApp.$store.dispatch('loadingError', new Error(error), true);

Check warning on line 52 in shell/initialize/App.vue

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 6 spaces but found 8
},
refreshOnlineStatus() {
if (typeof window.navigator.onLine === 'undefined') {
// If the browser doesn't support connection status reports
Expand Down
9 changes: 5 additions & 4 deletions shell/initialize/entry-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@
* Add error handler debugging capabilities
* @param {*} vueApp Vue instance
*/
export const loadDebugger = (vueApp) => {

Check warning on line 5 in shell/initialize/entry-helpers.js

View workflow job for this annotation

GitHub Actions / lint

Block must not be padded by blank lines
const debug = process.env.dev;

if (debug) {

Check warning on line 6 in shell/initialize/entry-helpers.js

View workflow job for this annotation

GitHub Actions / lint

Trailing spaces not allowed
const defaultErrorHandler = vueApp.config.errorHandler;

Check warning on line 7 in shell/initialize/entry-helpers.js

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 2 spaces but found 4

vueApp.config.errorHandler = async(err, vm, info, ...rest) => {

Check warning on line 9 in shell/initialize/entry-helpers.js

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 2 spaces but found 4
// Call other handler if exist

Check warning on line 10 in shell/initialize/entry-helpers.js

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 4 spaces but found 6
let handled = null;

Check warning on line 11 in shell/initialize/entry-helpers.js

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 4 spaces but found 6

if (typeof defaultErrorHandler === 'function') {

Check warning on line 13 in shell/initialize/entry-helpers.js

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 4 spaces but found 6
handled = defaultErrorHandler(err, vm, info, ...rest);

Check warning on line 14 in shell/initialize/entry-helpers.js

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 6 spaces but found 8
}

Check warning on line 15 in shell/initialize/entry-helpers.js

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 4 spaces but found 6
if (handled === true) {
return handled;
}
Expand All @@ -35,14 +33,17 @@
return handled;
}

if (vm?._component?.methods?.handleError) {
vm._component.methods.handleError(err);
}

// Log to console
if (process.env.NODE_ENV !== 'production') {
console.error(err); // eslint-disable-line no-console
} else {
console.error(err.message || err); // eslint-disable-line no-console
}
};
}
};

/**
Expand Down
18 changes: 14 additions & 4 deletions shell/initialize/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,19 @@
if (!global.fetch) {
global.fetch = fetch;
}

loadDebugger(vueApp);
const errorHandler = vueApp.config.errorHandler || console.error; // eslint-disable-line no-console
const debug = process.env.dev;
if(debug){

Check failure on line 29 in shell/initialize/entry.js

View workflow job for this annotation

GitHub Actions / lint

Missing space before opening brace
loadDebugger(vueApp);
} else {
//Need to add some error handler for production
vueApp.config.errorHandler = async(err, vm, info, ...rest) => {
if (vm?._component?.methods?.handleError) {
vm._component.methods.handleError(err);
}
}
}

// Create and mount App
extendApp(vueApp).then((appPartials) => mountApp(appPartials, vueApp)).catch(errorHandler); // eslint-disable-line no-undef
extendApp(vueApp).then((appPartials) => mountApp(appPartials, vueApp)).catch((err) => {
return vueApp.config.errorHandler ? vueApp.config.errorHandler(err, vueApp) : console.error(err);
}); // eslint-disable-line no-undef
Loading