mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-25 09:03:12 +03:00
Handle errors thrown during app boot
closes https://github.com/TryGhost/Ghost/issues/9394 - add `application-error.hbs` template so that we show an error screen for errors during app boot - track the application route loading state so that we can fall back to the default error handling for errors that usually only show an alert
This commit is contained in:
parent
08630c5913
commit
7b62c03438
@ -82,8 +82,13 @@ export default Route.extend(ApplicationRouteMixin, ShortcutsRoute, {
|
||||
settingsPromise,
|
||||
privateConfigPromise,
|
||||
tourPromise
|
||||
]);
|
||||
]).then((results) => {
|
||||
this._appLoaded = true;
|
||||
return results;
|
||||
});
|
||||
}
|
||||
|
||||
this._appLoaded = true;
|
||||
},
|
||||
|
||||
actions: {
|
||||
@ -180,7 +185,10 @@ export default Route.extend(ApplicationRouteMixin, ShortcutsRoute, {
|
||||
}
|
||||
|
||||
this.get('upgradeStatus').requireUpgrade();
|
||||
return false;
|
||||
|
||||
if (this._appLoaded) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isMaintenanceError(error)) {
|
||||
@ -189,7 +197,10 @@ export default Route.extend(ApplicationRouteMixin, ShortcutsRoute, {
|
||||
}
|
||||
|
||||
this.get('upgradeStatus').maintenanceAlert();
|
||||
return false;
|
||||
|
||||
if (this._appLoaded) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isAjaxError(error) || error && error.payload && isEmberArray(error.payload.errors)) {
|
||||
|
15
ghost/admin/app/templates/application-error.hbs
Normal file
15
ghost/admin/app/templates/application-error.hbs
Normal file
@ -0,0 +1,15 @@
|
||||
<div class="gh-view">
|
||||
<section class="error-content error-404 js-error-container">
|
||||
<section class="error-details">
|
||||
<img class="error-ghost" src="assets/img/404-ghost@2x.png" srcset="assets/img/404-ghost.png 1x, assets/img/404-ghost@2x.png 2x" />
|
||||
<section class="error-message">
|
||||
<h1 class="error-code">{{model.code}}</h1>
|
||||
<h2 class="error-description">
|
||||
{{or model.payload.errors.firstObject.message model.message}}
|
||||
</h2>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
{{ember-load-remover}}
|
Loading…
Reference in New Issue
Block a user