2017-08-22 10:53:26 +03:00
|
|
|
import Controller from '@ember/controller';
|
2022-02-01 12:34:03 +03:00
|
|
|
import classic from 'ember-classic-decorator';
|
2017-08-22 10:53:26 +03:00
|
|
|
import {computed} from '@ember/object';
|
2018-01-11 01:57:43 +03:00
|
|
|
import {readOnly} from '@ember/object/computed';
|
2015-10-28 14:36:45 +03:00
|
|
|
|
2022-02-01 12:34:03 +03:00
|
|
|
@classic
|
|
|
|
export default class ErrorController extends Controller {
|
|
|
|
stack = false;
|
2015-10-28 14:36:45 +03:00
|
|
|
|
2022-02-01 12:34:03 +03:00
|
|
|
@readOnly('model')
|
2022-02-10 13:41:36 +03:00
|
|
|
error;
|
2015-10-28 14:36:45 +03:00
|
|
|
|
2022-02-01 12:34:03 +03:00
|
|
|
@computed('error.status')
|
|
|
|
get code() {
|
2018-01-11 01:57:43 +03:00
|
|
|
return this.get('error.status') > 200 ? this.get('error.status') : 500;
|
2022-02-01 12:34:03 +03:00
|
|
|
}
|
2015-10-28 14:36:45 +03:00
|
|
|
|
2022-02-01 12:34:03 +03:00
|
|
|
@computed('error.statusText')
|
|
|
|
get message() {
|
2019-03-06 16:53:54 +03:00
|
|
|
if (this.code === 404) {
|
2015-06-08 13:13:42 +03:00
|
|
|
return 'Page not found';
|
2014-06-24 03:52:10 +04:00
|
|
|
}
|
|
|
|
|
2018-01-11 01:57:43 +03:00
|
|
|
return this.get('error.statusText') !== 'error' ? this.get('error.statusText') : 'Internal Server Error';
|
2022-02-01 12:34:03 +03:00
|
|
|
}
|
|
|
|
}
|