Class: Beekeeper::TrapApiExceptions

Inherits:
Object
  • Object
show all
Defined in:
lib/beekeeper/trap_api_exceptions.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ TrapApiExceptions

Returns a new instance of TrapApiExceptions.



11
12
13
# File 'lib/beekeeper/trap_api_exceptions.rb', line 11

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/beekeeper/trap_api_exceptions.rb', line 15

def call(env)
  request = ActionDispatch::Request.new env
  @app.call(env)
rescue StandardError => e
  # if request.path_info.include? '/api'
    render_json_error(request, e)
  # else
  #   raise e
  # end
end