-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
render errors as json for api requests
- Loading branch information
1 parent
fcb973b
commit ca5b6d8
Showing
3 changed files
with
18 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
class ApiErrorsController < ApplicationController | ||
skip_before_action :set_locale | ||
skip_before_action :store_user_location! | ||
def show | ||
exception = request.env["action_dispatch.exception"] | ||
status_code = ActionDispatch::ExceptionWrapper.new(request.env, exception).status_code | ||
request_id = request.env["action_dispatch.request_id"] | ||
render json: { error_code: status_code, request_id: request_id, contact_url: Rails.application.routes.url_helpers.contact_url(contactRecipient: 'wst', requestId: request_id)}, status: status_code | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters