<commit_before>'use strict';

angular
  .module('anguHttpInterceptor', [])
  .provider('anguHttpInterceptor', httpInterceptorProvider)
  .config(anguHttpInterceptorConfiguration)

function httpInterceptorProvider() {

  // 4xx error codes
  this.badRequest = null;
  this.unauthorized = null;
  this.paymentRequired = null;
  this.forbidden = null;
  this.notFound = null;
  this.methodNotAllowed = null;

  // 5xx error codes
  this.internalServerError = null;
  this.notImplemented = null;
  this.badGatewayProxyError = null;
  this.serviceUnavailable = null;
  this.gatewayTimeout = null;
  this.httpVersionNotSupported = null;

  this.$get = httpInterceptor;
}

function httpInterceptor($q, $injector) {
  var ctx = this;
  return {
    responseError: responseError
  };

  function responseError(response) {
    switch(response.status) {
      case 400:
        ctx.badRequest && $injector.invoke(ctx.badRequest);
        break;
      case 401:
        ctx.unauthorized && $injector.invoke(ctx.unauthorized);
        break;
      case 402:
        ctx.paymentRequired && $injector.invoke(ctx.paymentRequired);
        break;
      case 403:
        ctx.forbidden && $injector.invoke(ctx.forbidden);
        break;
      case 404:
        ctx.notFound && $injector.invoke(ctx.notFound);
        break;
      case 405:
        ctx.methodNotAllowed && $injector.invoke(ctx.methodNotAllowed);
        break;
      case 500:
        ctx.internalServerError && $injector.invoke(ctx.internalServerError);
        break;
      case 501:
        ctx.notImplemented && $injector.invoke(ctx.notImplemented);
        break;
      case 502:
        ctx.badGatewayProxyError && $injector.invoke(ctx.badGatewayProxyError);
        break;
      case 503:
        ctx.serviceUnavailable && $injector.invoke(ctx.serviceUnavailable);
        break;
      case 504:
        ctx.gatewayTimeout && $injector.invoke(ctx.gatewayTimeout);
        break;
      case 505:
        ctx.httpVersionNotSupported && $injector.invoke(ctx.httpVersionNotSupported);
        break;
    }

    return $q.reject(response);
  }
}

function anguHttpInterceptorConfiguration($httpProvider) {
  $httpProvider.interceptors.push('anguHttpInterceptor');
}<commit_msg>get function enclosed in a Closure<commit_after>function init() {
  'use strict';
  angular
    .module('anguHttpInterceptor', [])
    .provider('anguHttpInterceptor', httpInterceptorProvider)
    .config(anguHttpInterceptorConfiguration)

  function httpInterceptorProvider() {

    // 4xx error codes
    this.badRequest = null;
    this.unauthorized = null;
    this.paymentRequired = null;
    this.forbidden = null;
    this.notFound = null;
    this.methodNotAllowed = null;

    // 5xx error codes
    this.internalServerError = null;
    this.notImplemented = null;
    this.badGatewayProxyError = null;
    this.serviceUnavailable = null;
    this.gatewayTimeout = null;
    this.httpVersionNotSupported = null;

    this.$get = httpInterceptor;
  }

  function httpInterceptor($q, $injector) {
    var ctx = this;
    return {
      responseError: responseError
    };

    function responseError(response) {
      switch(response.status) {
        case 400:
          ctx.badRequest && $injector.invoke(ctx.badRequest);
          break;
        case 401:
          ctx.unauthorized && $injector.invoke(ctx.unauthorized);
          break;
        case 402:
          ctx.paymentRequired && $injector.invoke(ctx.paymentRequired);
          break;
        case 403:
          ctx.forbidden && $injector.invoke(ctx.forbidden);
          break;
        case 404:
          ctx.notFound && $injector.invoke(ctx.notFound);
          break;
        case 405:
          ctx.methodNotAllowed && $injector.invoke(ctx.methodNotAllowed);
          break;
        case 500:
          ctx.internalServerError && $injector.invoke(ctx.internalServerError);
          break;
        case 501:
          ctx.notImplemented && $injector.invoke(ctx.notImplemented);
          break;
        case 502:
          ctx.badGatewayProxyError && $injector.invoke(ctx.badGatewayProxyError);
          break;
        case 503:
          ctx.serviceUnavailable && $injector.invoke(ctx.serviceUnavailable);
          break;
        case 504:
          ctx.gatewayTimeout && $injector.invoke(ctx.gatewayTimeout);
          break;
        case 505:
          ctx.httpVersionNotSupported && $injector.invoke(ctx.httpVersionNotSupported);
          break;
      }

      return $q.reject(response);
    }
  }

  function anguHttpInterceptorConfiguration($httpProvider) {
    $httpProvider.interceptors.push('anguHttpInterceptor');
  }
}
init();
{'fraction_non_alphanumeric': 0.10611278519156263, 'fraction_numerical': 0.016358157554885924, 'mean_word_length': 2.6764240506329116, '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': '5805088', 'n_tokens_mistral': 1413, 'n_tokens_neox': 1336, 'n_words': 244}