Merge pull request #2696 from riking/errors

Fix "Server Error: [missing {{code}} value]" page
This commit is contained in:
Robin Ward 2014-08-26 11:14:57 -04:00
commit 105959c402
2 changed files with 7 additions and 5 deletions

View File

@ -41,6 +41,7 @@ export default ObjectController.extend({
if (this.get('thrown.jqTextStatus') === "timeout") return true;
return false;
}.property(),
isForbidden: Em.computed.equal('thrown.status', 403),
isServer: Em.computed.gte('thrown.status', 500),
isUnknown: Em.computed.none('isNetwork', 'isServer'),
@ -59,6 +60,8 @@ export default ObjectController.extend({
return I18n.t('errors.reasons.network');
} else if (this.get('isServer')) {
return I18n.t('errors.reasons.server');
} else if (this.get('isForbidden')) {
return I18n.t('errors.reasons.forbidden');
} else {
// TODO
return I18n.t('errors.reasons.unknown');
@ -73,7 +76,7 @@ export default ObjectController.extend({
} else if (this.get('isNetwork')) {
return I18n.t('errors.desc.network');
} else if (this.get('isServer')) {
return I18n.t('errors.desc.server', this.get('thrown.statusText'));
return I18n.t('errors.desc.server', { status: this.get('thrown.status') + " " + this.get('thrown.statusText') });
} else {
// TODO
return I18n.t('errors.desc.unknown');
@ -85,8 +88,6 @@ export default ObjectController.extend({
return [ButtonLoadPage];
} else if (this.get('isNetwork')) {
return [ButtonBackDim, ButtonTryAgain];
} else if (this.get('isServer')) {
return [ButtonBackBright];
} else {
return [ButtonBackBright, ButtonTryAgain];
}

View File

@ -506,12 +506,13 @@ en:
prev_page: "while trying to load"
reasons:
network: "Network Error"
server: "Server Error: {{code}}"
server: "Server Error"
forbidden: "Access Denied"
unknown: "Error"
desc:
network: "Please check your connection."
network_fixed: "Looks like it's back."
server: "Something went wrong."
server: "Error code: {{status}}"
unknown: "Something went wrong."
buttons:
back: "Go Back"