Skip to content

Commit

Permalink
Improve dashboard loading error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed May 13, 2020
1 parent 533b481 commit 5d7bb01
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/plugins/dashboard/public/application/legacy_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { createDashboardEditUrl, DashboardConstants } from '../dashboard_constan
import {
createKbnUrlStateStorage,
redirectWhenMissing,
InvalidJSONProperty,
SavedObjectNotFound,
} from '../../../kibana_utils/public';
import { DashboardListing, EMPTY_FILTER } from './listing/dashboard_listing';
Expand Down Expand Up @@ -206,13 +205,6 @@ export function initDashboardApp(app, deps) {
return savedDashboard;
})
.catch(error => {
// A corrupt dashboard was detected (e.g. with invalid JSON properties)
if (error instanceof InvalidJSONProperty) {
deps.core.notifications.toasts.addDanger(error.message);
history.push(DashboardConstants.LANDING_PAGE_PATH);
return;
}

// Preserve BWC of v5.3.0 links for new, unsaved dashboards.
// See https://github.com/elastic/kibana/issues/10951 for more context.
if (error instanceof SavedObjectNotFound && id === 'create') {
Expand All @@ -230,7 +222,9 @@ export function initDashboardApp(app, deps) {
);
return new Promise(() => {});
} else {
throw error;
// E.g. a corrupt dashboard was detected (e.g. with invalid JSON properties)
deps.core.notifications.toasts.addDanger(error.message);
history.push(DashboardConstants.LANDING_PAGE_PATH);
}
})
.catch(
Expand Down

0 comments on commit 5d7bb01

Please sign in to comment.