<commit_before>require 'jbuilder'

# config
app = Class.new(Rails::Application)
app.config.secret_token = '<KEY>'
app.config.session_store :cookie_store, :key => '_myapp_session'
app.config.active_support.deprecation = :log
app.config.eager_load = false

# Rais.root
app.config.root = File.dirname(__FILE__)
app.config.autoload_paths += ["#{app.config.root}/lib"] if ENV["CUSTOM_EXCEPTIONS_APP"]
Rails.backtrace_cleaner.remove_silencers!
app.initialize!

# routes
app.routes.draw do
  resources :users
end

# custom exception class
class CustomException < StandardError; end
class ForbiddenException < StandardError; end

Rambulance.setup do |config|
  config.layout_name = "error"
  config.rescue_responses = {
    'TypeError'       => :bad_request,
    'CustomException' => :not_found,
    'ForbiddenException' => :forbidden
  }
end

# controllers
class ApplicationController < ActionController::Base
  append_view_path "spec/fake_app/views"
  before_filter :bad_filter

  private

  def bad_filter
    raise "This is a bad filter."
  end
end
class UsersController < ApplicationController
  skip_filter :bad_filter, except: :show

  def index
    raise CustomException<commit_msg>Rails 5 does not know about before_filter any more<commit_after>require 'jbuilder'

# config
app = Class.new(Rails::Application)
app.config.secret_token = '<KEY>'
app.config.session_store :cookie_store, :key => '_myapp_session'
app.config.active_support.deprecation = :log
app.config.eager_load = false

# Rais.root
app.config.root = File.dirname(__FILE__)
app.config.autoload_paths += ["#{app.config.root}/lib"] if ENV["CUSTOM_EXCEPTIONS_APP"]
Rails.backtrace_cleaner.remove_silencers!
app.initialize!

# routes
app.routes.draw do
  resources :users
end

# custom exception class
class CustomException < StandardError; end
class ForbiddenException < StandardError; end

Rambulance.setup do |config|
  config.layout_name = "error"
  config.rescue_responses = {
    'TypeError'       => :bad_request,
    'CustomException' => :not_found,
    'ForbiddenException' => :forbidden
  }
end

# controllers
class ApplicationController < ActionController::Base
  append_view_path "spec/fake_app/views"
  if self.respond_to? :before_filter
    before_filter :bad_filter
  else
    before_action :bad_filter
  end

  private

  def bad_filter
    raise "This is a bad filter."
  end
end
class UsersController < ApplicationController
  skip_filter :bad_filter, except: :show

  def index
    raise CustomException
{'fraction_non_alphanumeric': 0.09907370116794201, 'fraction_numerical': 0.0004027386226339106, 'mean_word_length': 4.985542168674699, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '1975014', 'n_tokens_mistral': 801, 'n_tokens_neox': 795, 'n_words': 182}