Ghost/ghost/admin/app/controllers/error.js
Gabriel Csapo d51f2bcf23 [chore] migrate to eslint@8 and run --fix (#2256)
closes https://github.com/TryGhost/Admin/pull/2107

- updated related babel dependencies
- bumped eslint
- ran `yarn lint:js --fix`
- added eslint ignore comments for some required non-camel-case properties
2022-02-10 10:41:36 +00:00

27 lines
698 B
JavaScript

import Controller from '@ember/controller';
import classic from 'ember-classic-decorator';
import {computed} from '@ember/object';
import {readOnly} from '@ember/object/computed';
@classic
export default class ErrorController extends Controller {
stack = false;
@readOnly('model')
error;
@computed('error.status')
get code() {
return this.get('error.status') > 200 ? this.get('error.status') : 500;
}
@computed('error.statusText')
get message() {
if (this.code === 404) {
return 'Page not found';
}
return this.get('error.statusText') !== 'error' ? this.get('error.statusText') : 'Internal Server Error';
}
}