mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: :( page was never showing the URL
This commit is contained in:
parent
af7f00099f
commit
e36c0966d0
@ -31,6 +31,7 @@ export default Ember.Controller.extend({
|
|||||||
if (this.get('thrown.jqTextStatus') === "timeout") return true;
|
if (this.get('thrown.jqTextStatus') === "timeout") return true;
|
||||||
return false;
|
return false;
|
||||||
}.property(),
|
}.property(),
|
||||||
|
isNotFound: Em.computed.equal('thrown.status', 404),
|
||||||
isForbidden: Em.computed.equal('thrown.status', 403),
|
isForbidden: Em.computed.equal('thrown.status', 403),
|
||||||
isServer: Em.computed.gte('thrown.status', 500),
|
isServer: Em.computed.gte('thrown.status', 500),
|
||||||
isUnknown: Em.computed.none('isNetwork', 'isServer'),
|
isUnknown: Em.computed.none('isNetwork', 'isServer'),
|
||||||
@ -50,6 +51,8 @@ export default Ember.Controller.extend({
|
|||||||
return I18n.t('errors.reasons.network');
|
return I18n.t('errors.reasons.network');
|
||||||
} else if (this.get('isServer')) {
|
} else if (this.get('isServer')) {
|
||||||
return I18n.t('errors.reasons.server');
|
return I18n.t('errors.reasons.server');
|
||||||
|
} else if (this.get('isNotFound')) {
|
||||||
|
return I18n.t('errors.reasons.not_found');
|
||||||
} else if (this.get('isForbidden')) {
|
} else if (this.get('isForbidden')) {
|
||||||
return I18n.t('errors.reasons.forbidden');
|
return I18n.t('errors.reasons.forbidden');
|
||||||
} else {
|
} else {
|
||||||
@ -65,6 +68,8 @@ export default Ember.Controller.extend({
|
|||||||
return I18n.t('errors.desc.network_fixed');
|
return I18n.t('errors.desc.network_fixed');
|
||||||
} else if (this.get('isNetwork')) {
|
} else if (this.get('isNetwork')) {
|
||||||
return I18n.t('errors.desc.network');
|
return I18n.t('errors.desc.network');
|
||||||
|
} else if (this.get('isNotFound')) {
|
||||||
|
return I18n.t('errors.desc.not_found');
|
||||||
} else if (this.get('isServer')) {
|
} else if (this.get('isServer')) {
|
||||||
return I18n.t('errors.desc.server', { status: this.get('thrown.status') + " " + this.get('thrown.statusText') });
|
return I18n.t('errors.desc.server', { status: this.get('thrown.status') + " " + this.get('thrown.statusText') });
|
||||||
} else {
|
} else {
|
||||||
|
@ -60,30 +60,24 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
error(err, transition) {
|
error(err, transition) {
|
||||||
if (err.status === 404) {
|
let xhr = {};
|
||||||
// 404
|
if (err.jqXHR) {
|
||||||
this.transitionTo('unknown');
|
xhr = err.jqXHR;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const exceptionController = this.controllerFor('exception'),
|
const xhrOrErr = err.jqXHR ? xhr : err;
|
||||||
stack = err.stack;
|
|
||||||
|
|
||||||
// If we have a stack call `toString` on it. It gives us a better
|
const exceptionController = this.controllerFor('exception');
|
||||||
// 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 c = window.console;
|
const c = window.console;
|
||||||
if (c && c.error) {
|
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');
|
this.intermediateTransitionTo('exception');
|
||||||
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
showLogin: unlessReadOnly('handleShowLogin'),
|
showLogin: unlessReadOnly('handleShowLogin'),
|
||||||
|
@ -684,11 +684,13 @@ en:
|
|||||||
server: "Server Error"
|
server: "Server Error"
|
||||||
forbidden: "Access Denied"
|
forbidden: "Access Denied"
|
||||||
unknown: "Error"
|
unknown: "Error"
|
||||||
|
not_found: "Page Not Found"
|
||||||
desc:
|
desc:
|
||||||
network: "Please check your connection."
|
network: "Please check your connection."
|
||||||
network_fixed: "Looks like it's back."
|
network_fixed: "Looks like it's back."
|
||||||
server: "Error code: {{status}}"
|
server: "Error code: {{status}}"
|
||||||
forbidden: "You're not allowed to view that."
|
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."
|
unknown: "Something went wrong."
|
||||||
buttons:
|
buttons:
|
||||||
back: "Go Back"
|
back: "Go Back"
|
||||||
|
Loading…
Reference in New Issue
Block a user