UX: Use the same 404 page for the `unknown` route and exception handler

This commit is contained in:
Robin Ward 2017-12-06 15:20:24 -05:00
parent e8d5d34755
commit cf3ea4f9bd
4 changed files with 13 additions and 0 deletions

View File

@ -32,6 +32,7 @@ export default Ember.Controller.extend({
if (this.get('thrown.jqTextStatus') === "timeout") return true;
return false;
}.property(),
isNotFound: Em.computed.equal('thrown.status', 404),
isForbidden: Em.computed.equal('thrown.status', 403),
isServer: Em.computed.gte('thrown.status', 500),

View File

@ -1,6 +1,7 @@
export default function() {
// Error page
this.route('exception', { path: '/exception' });
this.route('exception-unknown', { path: '/404' });
this.route('about', { path: '/about', resetNamespace: true });

View File

@ -83,6 +83,10 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
c.error(xhrOrErr);
}
if (xhrOrErr && xhrOrErr.status === 404) {
return this.transitionTo('exception-unknown');
}
exceptionController.setProperties({ lastTransition: transition, thrown: xhrOrErr });
this.intermediateTransitionTo('exception');

View File

@ -0,0 +1,7 @@
import UnknownRoute from 'discourse/routes/unknown';
export default UnknownRoute.extend({
renderTemplate() {
this.render('unknown');
}
});