Merge pull request #3798 from riking/patch-6
FIX: :( page was never showing the URL
This commit is contained in:
commit
cc0f76e60a
|
@ -31,6 +31,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),
|
||||
isUnknown: Em.computed.none('isNetwork', 'isServer'),
|
||||
|
@ -50,6 +51,8 @@ export default Ember.Controller.extend({
|
|||
return I18n.t('errors.reasons.network');
|
||||
} else if (this.get('isServer')) {
|
||||
return I18n.t('errors.reasons.server');
|
||||
} else if (this.get('isNotFound')) {
|
||||
return I18n.t('errors.reasons.not_found');
|
||||
} else if (this.get('isForbidden')) {
|
||||
return I18n.t('errors.reasons.forbidden');
|
||||
} else {
|
||||
|
@ -65,6 +68,8 @@ export default Ember.Controller.extend({
|
|||
return I18n.t('errors.desc.network_fixed');
|
||||
} else if (this.get('isNetwork')) {
|
||||
return I18n.t('errors.desc.network');
|
||||
} else if (this.get('isNotFound')) {
|
||||
return I18n.t('errors.desc.not_found');
|
||||
} else if (this.get('isServer')) {
|
||||
return I18n.t('errors.desc.server', { status: this.get('thrown.status') + " " + this.get('thrown.statusText') });
|
||||
} else {
|
||||
|
|
|
@ -60,30 +60,24 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
|
|||
},
|
||||
|
||||
error(err, transition) {
|
||||
if (err.status === 404) {
|
||||
// 404
|
||||
this.transitionTo('unknown');
|
||||
return;
|
||||
let xhr = {};
|
||||
if (err.jqXHR) {
|
||||
xhr = err.jqXHR;
|
||||
}
|
||||
|
||||
const exceptionController = this.controllerFor('exception'),
|
||||
stack = err.stack;
|
||||
const xhrOrErr = err.jqXHR ? xhr : err;
|
||||
|
||||
// If we have a stack call `toString` on it. It gives us a better
|
||||
// stack trace since `console.error` uses the stack track of this
|
||||
// error callback rather than the original error.
|
||||
let errorString = err.toString();
|
||||
if (stack) { errorString = stack.toString(); }
|
||||
|
||||
if (err.statusText) { errorString = err.statusText; }
|
||||
const exceptionController = this.controllerFor('exception');
|
||||
|
||||
const c = window.console;
|
||||
if (c && c.error) {
|
||||
c.error(errorString);
|
||||
c.error(xhrOrErr);
|
||||
}
|
||||
exceptionController.setProperties({ lastTransition: transition, thrown: err });
|
||||
|
||||
exceptionController.setProperties({ lastTransition: transition, thrown: xhrOrErr });
|
||||
|
||||
this.intermediateTransitionTo('exception');
|
||||
return true;
|
||||
},
|
||||
|
||||
showLogin: unlessReadOnly('handleShowLogin'),
|
||||
|
|
|
@ -684,11 +684,13 @@ en:
|
|||
server: "Server Error"
|
||||
forbidden: "Access Denied"
|
||||
unknown: "Error"
|
||||
not_found: "Page Not Found"
|
||||
desc:
|
||||
network: "Please check your connection."
|
||||
network_fixed: "Looks like it's back."
|
||||
server: "Error code: {{status}}"
|
||||
forbidden: "You're not allowed to view that."
|
||||
not_found: "Oops, the application tried to load a URL that doesn't exist."
|
||||
unknown: "Something went wrong."
|
||||
buttons:
|
||||
back: "Go Back"
|
||||
|
|
Loading…
Reference in New Issue