From d6c9788771f7dcbd96408130bc4e10e6497bee60 Mon Sep 17 00:00:00 2001 From: mo khan Date: Sun, 26 Feb 2017 13:21:30 -0700 Subject: add custom error pages. --- app/controllers/api/errors_controller.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 app/controllers/api/errors_controller.rb (limited to 'app/controllers/api/errors_controller.rb') diff --git a/app/controllers/api/errors_controller.rb b/app/controllers/api/errors_controller.rb new file mode 100644 index 0000000..09a7f16 --- /dev/null +++ b/app/controllers/api/errors_controller.rb @@ -0,0 +1,12 @@ +class API::ErrorsController < Api::Controller + include Gaffe::Errors + skip_before_action :authenticate! + + layout false + + def show + output = { error: @rescue_response } + output.merge! exception: @exception.inspect, backtrace: @exception.backtrace.first(10) if Rails.env.development? || Rails.env.test? + render json: output, status: @status_code + end +end -- cgit v1.2.3