<commit_before>App.HandlesSubmissionEvents = Ember.Mixin.create(
  Ember.Evented,
{

  handleSubmissionSuccess: function (resolve, data) {
    console.log('[HandlesSubmissionEvents success]', arguments);
    this.get('store').pushPayload(data);
    resolve(data);
  }.on('submissionSuccess'),

  handleSubmissionError: function (reject, jqXHR) {
    console.log('[HandlesSubmissionEvents error]', arguments);
    if (jqXHR.status === 401) {
      reject({ errors: [ 'Please try again.' ], unauthorized: true });
    } else {
      var errors = JSON.parse(jqXHR.responseText).errors || [];
      reject({ errors: errors });
    }
  }.on('submissionError')

});<commit_msg>Ajax error handling: no Rollbar error on 401 or 422, temp hack to allow handleSubmissionEvents to work with ajaxError return value<commit_after>App.HandlesSubmissionEvents = Ember.Mixin.create(
  Ember.Evented,
{

  handleSubmissionSuccess: function (resolve, response) {
    console.log('[HandlesSubmissionEvents success]', arguments);
    this.get('store').pushPayload(response);
    resolve(response);
  }.on('submissionSuccess'),

  handleSubmissionError: function (reject, response) {
    console.log('[HandlesSubmissionEvents error]', arguments);
    if (response.status === 401 || response.http_status === 401) { // TEMPORARY HACK @see RESTAdapter.ajaxError
      reject({ errors: [ 'Please try again.' ], unauthorized: true });
    } else {
      var errors = JSON.parse(jqXHR.responseText).errors || [];
      reject({ errors: errors });
    }
  }.on('submissionError')

});
{'fraction_non_alphanumeric': 0.14543114543114544, 'fraction_numerical': 0.009652509652509652, 'mean_word_length': 4.362068965517241, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5886025', 'n_tokens_mistral': 484, 'n_tokens_neox': 452, 'n_words': 102}