mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05: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
2 changed files with 29 additions and 3 deletions
|
@ -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,8 +185,11 @@ export default Route.extend(ApplicationRouteMixin, ShortcutsRoute, {
|
|||
}
|
||||
|
||||
this.get('upgradeStatus').requireUpgrade();
|
||||
|
||||
if (this._appLoaded) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isMaintenanceError(error)) {
|
||||
if (transition) {
|
||||
|
@ -189,8 +197,11 @@ export default Route.extend(ApplicationRouteMixin, ShortcutsRoute, {
|
|||
}
|
||||
|
||||
this.get('upgradeStatus').maintenanceAlert();
|
||||
|
||||
if (this._appLoaded) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isAjaxError(error) || error && error.payload && isEmberArray(error.payload.errors)) {
|
||||
this.get('notifications').showAPIError(error);
|
||||
|
|
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…
Add table
Reference in a new issue