Sha256: 67689fad3b6cd5a80f61c5265a38eef16162e58a4f9d98aff9df0aa3e1a75833

Contents?: true

Size: 891 Bytes

Versions: 17

Compression:

Stored size: 891 Bytes

Contents

# frozen_string_literal: true

module EIVO
  class ApplicationController < ::ActionController::API
    include EIVO::Concerns::Exception
    include EIVO::Concerns::Rendering

    # doesn't work
    # rescue_from ::ActiveRecord::RecordNotFound, with: :render_not_found
    # rescue_from ::ActionController::ParameterMissing, with: :render_parameter_missing
    # rescue_from ::StandardError, with: :render_internal_server_error

    def process_action(*args)
      begin
        super
      rescue ::ActiveRecord::RecordNotFound => e
        render_not_found(e)
      rescue ::ActionController::ParameterMissing => e
        render_parameter_missing(e)
      rescue ::StandardError => e
        if Rails.env.development? || Rails.env.test?
          raise e
        else
          ::Raven.capture_exception(e)
        end

        render_internal_server_error(e)
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
eivo-rails-api-0.1.14 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.1.13 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.1.12 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.1.11 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.1.10 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.1.9 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.1.8 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.1.7 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.1.6 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.1.5 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.1.4 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.1.3 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.1.2 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.1.1 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.1.0 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.0.9 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.0.8 app/controllers/eivo/application_controller.rb