Skip to content

Commit

Permalink
Example of what needs to be done
Browse files Browse the repository at this point in the history
  • Loading branch information
eva-vashkevich committed Oct 9, 2024
1 parent ab7308e commit 35d6867
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
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 @@ export default {
},
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 @@ -3,9 +3,7 @@
* @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
Expand Down Expand Up @@ -35,14 +33,17 @@ export const loadDebugger = (vueApp) => {
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 @@ installPlugins(vueApp);
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

0 comments on commit 35d6867

Please sign in to comment.