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