diff options
| author | mo khan <mo@mokhan.ca> | 2017-02-26 13:21:30 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2017-02-26 13:21:30 -0700 |
| commit | d6c9788771f7dcbd96408130bc4e10e6497bee60 (patch) | |
| tree | 1a511d58856b2792b0ccb782a06df7a4e2663c21 /app/controllers/api | |
| parent | 5780e2d66fa27dd40bf5d3b581c68285c3199213 (diff) | |
add custom error pages.
Diffstat (limited to 'app/controllers/api')
| -rw-r--r-- | app/controllers/api/errors_controller.rb | 12 |
1 files changed, 12 insertions, 0 deletions
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 |
