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,
|
settingsPromise,
|
||||||
privateConfigPromise,
|
privateConfigPromise,
|
||||||
tourPromise
|
tourPromise
|
||||||
]);
|
]).then((results) => {
|
||||||
|
this._appLoaded = true;
|
||||||
|
return results;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._appLoaded = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -180,8 +185,11 @@ export default Route.extend(ApplicationRouteMixin, ShortcutsRoute, {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.get('upgradeStatus').requireUpgrade();
|
this.get('upgradeStatus').requireUpgrade();
|
||||||
|
|
||||||
|
if (this._appLoaded) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isMaintenanceError(error)) {
|
if (isMaintenanceError(error)) {
|
||||||
if (transition) {
|
if (transition) {
|
||||||
|
@ -189,8 +197,11 @@ export default Route.extend(ApplicationRouteMixin, ShortcutsRoute, {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.get('upgradeStatus').maintenanceAlert();
|
this.get('upgradeStatus').maintenanceAlert();
|
||||||
|
|
||||||
|
if (this._appLoaded) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isAjaxError(error) || error && error.payload && isEmberArray(error.payload.errors)) {
|
if (isAjaxError(error) || error && error.payload && isEmberArray(error.payload.errors)) {
|
||||||
this.get('notifications').showAPIError(error);
|
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