<commit_before>import Ember from 'ember';

const { Controller, computed } = Ember;

export default Controller.extend({
  error: null,

  errorStr: computed('error', function() {
    return this.get('error').toString();
  }),

  errorCodes: computed('error', function() {
    const error = this.get('error');
    const codes = [error.code];

    if (error.errors) {
      error.errors.forEach(err => {
        codes.push(err.status);
      });
    }

    return codes
      .compact()
      .uniq()
      .map(code => '' + code);
  }),

  is404: computed('errorCodes.[]', function() {
    return this.get('errorCodes').includes('404');
  }),

  is500: computed('errorCodes.[]', function() {
    return this.get('errorCodes').includes('500');
  }),
});<commit_msg>Throw errors that cause a redirect to make debugging easier<commit_after>import Ember from 'ember';

const { Controller, computed, inject, run, observer } = Ember;

export default Controller.extend({
  config: inject.service(),

  error: null,

  errorStr: computed('error', function() {
    return this.get('error').toString();
  }),

  errorCodes: computed('error', function() {
    const error = this.get('error');
    const codes = [error.code];

    if (error.errors) {
      error.errors.forEach(err => {
        codes.push(err.status);
      });
    }

    return codes
      .compact()
      .uniq()
      .map(code => '' + code);
  }),

  is404: computed('errorCodes.[]', function() {
    return this.get('errorCodes').includes('404');
  }),

  is500: computed('errorCodes.[]', function() {
    return this.get('errorCodes').includes('500');
  }),

  throwError: observer('error', function() {
    if (this.get('config.isDev')) {
      run.next(() => {
        throw this.get('error');
      });
    }
  }),
});
{'fraction_non_alphanumeric': 0.18911335578002245, 'fraction_numerical': 0.013468013468013467, 'mean_word_length': 3.080091533180778, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7537585', 'n_tokens_mistral': 571, 'n_tokens_neox': 547, 'n_words': 116}