Sha256: f5ceb5dc344b2a73050721362c008a023993fcc721277c9e36f1c0c2336d2955

Contents?: true

Size: 912 Bytes

Versions: 3

Compression:

Stored size: 912 Bytes

Contents

# frozen_string_literal: true

module EIVO
  class ApplicationController < ::ActionController::API

    include EIVO::Concerns::Exception
    include EIVO::Concerns::Rendering
    include EIVO::Concerns::Pagination

    # 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?
          raise e
        else
          ::Raven.capture_exception(e)
        end
        render_internal_server_error(e)
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
eivo-rails-api-0.0.4 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.0.3 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.0.2 app/controllers/eivo/application_controller.rb