Sha256: d150227e37739eac2da7a53ed14e7bd8f9d567e467f0f5f207fd6f48199db1db

Contents?: true

Size: 892 Bytes

Versions: 2

Compression:

Stored size: 892 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

2 entries across 2 versions & 1 rubygems

Version Path
eivo-rails-api-0.0.7 app/controllers/eivo/application_controller.rb
eivo-rails-api-0.0.6 app/controllers/eivo/application_controller.rb