<commit_before>import Ember from 'ember';
import RESTAdapter from 'ember-data/adapters/rest';
import codesForError from '../utils/codes-for-error';

const { get, computed, inject } = Ember;

export const namespace = 'v1';

export default RESTAdapter.extend({
  namespace,

  token: inject.service(),

  headers: computed('token.secret', function() {
    const token = this.get('token.secret');
    if (token) {
      return {
        'X-Nomad-Token': token,
      };
    }
  }),

  findAll() {
    return this._super(...arguments).catch(error => {
      const errorCodes = codesForError(error);

      const isNotAuthorized = errorCodes.includes('403');
      const isNotImplemented = errorCodes.includes('501');

      if (isNotAuthorized || isNotImplemented) {
        return [];
      }

      // Rethrow to be handled downstream
      throw error;
    });
  },<commit_msg>Stop gracefully handling findAll 403s in the adapter<commit_after>import Ember from 'ember';
import RESTAdapter from 'ember-data/adapters/rest';
import codesForError from '../utils/codes-for-error';

const { get, computed, inject } = Ember;

export const namespace = 'v1';

export default RESTAdapter.extend({
  namespace,

  token: inject.service(),

  headers: computed('token.secret', function() {
    const token = this.get('token.secret');
    if (token) {
      return {
        'X-Nomad-Token': token,
      };
    }
  }),

  findAll() {
    return this._super(...arguments).catch(error => {
      const errorCodes = codesForError(error);

      const isNotImplemented = errorCodes.includes('501');

      if (isNotImplemented) {
        return [];
      }

      // Rethrow to be handled downstream
      throw error;
    });
  },
{'fraction_non_alphanumeric': 0.1371061843640607, 'fraction_numerical': 0.008168028004667444, 'mean_word_length': 2.942528735632184, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5084930', 'n_tokens_mistral': 530, 'n_tokens_neox': 503, 'n_words': 125}