<commit_before>function addBasicAuth(xhr, login, password) {
  var auth = 'Basic ' + Base64.encode(login + ':' + password);
  xhr.setRequestHeader('Authorization', auth);
}

function onNoncriticalXHRError(xhr) {
  if (Abortarium.isAborted(xhr))
    return;

  var status;
  try {status = xhr.status} catch (e) {};

  // everything except timeout & service unavailable
  if (status != 503 && status != 504 && status > 0) {
    onUnexpectedXHRError.apply(this, arguments);
    throw new Error("xhr error is critical: " + status);
  }

  // TODO: implement some UI for that and maybe some request repeating
  // policy too
  console.log("failed non-critical request");
}

function onUnexpectedXHRError(xhr, xhrStatus, errMsg) {
  window.onUnexpectedXHRError = function () {}

  if (Abortarium.isAborted(xhr))
    return;

  // for manual interception
  if ('debuggerHook' in onUnexpectedXHRError) {
    onUnexpectedXHRError['debuggerHook'](xhr, xhrStatus, errMsg);
  }

  var status;
  try {status = xhr.status} catch (e) {};

  if (status == 401) {
    $.cookie('auth', null);
    return reloadApp();
  }

  if ('JSON' in window && 'sessionStorage' in window) {
    var self = this;<commit_msg>deleted unused handleNonCriticalError<commit_after>function addBasicAuth(xhr, login, password) {
  var auth = 'Basic ' + Base64.encode(login + ':' + password);
  xhr.setRequestHeader('Authorization', auth);
}

function onUnexpectedXHRError(xhr, xhrStatus, errMsg) {
  window.onUnexpectedXHRError = function () {}

  if (Abortarium.isAborted(xhr))
    return;

  // for manual interception
  if ('debuggerHook' in onUnexpectedXHRError) {
    onUnexpectedXHRError['debuggerHook'](xhr, xhrStatus, errMsg);
  }

  var status;
  try {status = xhr.status} catch (e) {};

  if (status == 401) {
    $.cookie('auth', null);
    return reloadApp();
  }

  if ('JSON' in window && 'sessionStorage' in window) {
    var self = this;
{'fraction_non_alphanumeric': 0.13695765812859384, 'fraction_numerical': 0.008886565603763722, 'mean_word_length': 4.010471204188482, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '345497', 'n_tokens_mistral': 669, 'n_tokens_neox': 624, 'n_words': 158}