2017-08-22 10:53:26 +03:00
|
|
|
import Controller from '@ember/controller';
|
|
|
|
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
|
|
|
|
|
|
|
export default Controller.extend({
|
|
|
|
|
|
|
|
stack: false,
|
2018-01-11 20:43:23 +03:00
|
|
|
error: readOnly('model'),
|
2015-10-28 14:36:45 +03:00
|
|
|
|
2018-01-11 01:57:43 +03:00
|
|
|
code: computed('error.status', function () {
|
|
|
|
return this.get('error.status') > 200 ? this.get('error.status') : 500;
|
2014-07-30 05:57:19 +04:00
|
|
|
}),
|
2015-10-28 14:36:45 +03:00
|
|
|
|
2018-01-11 01:57:43 +03:00
|
|
|
message: computed('error.statusText', function () {
|
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';
|
2015-10-28 14:36:45 +03:00
|
|
|
})
|
2014-06-24 03:52:10 +04:00
|
|
|
});
|