Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change name/symbol of custom RaiseError class #17024

Merged
merged 6 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/services/medical_copays/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def connection
conn.request :json
conn.use :breakers
conn.use Faraday::Response::RaiseError
conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :json
conn.response :betamocks if mock_enabled?
conn.adapter Faraday.default_adapter
Expand Down
2 changes: 1 addition & 1 deletion docs/setup/betamocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def connection
conn.use :breakers
conn.request :json

conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :facility_parser
conn.response :facility_validator
conn.response :betamocks if Settings.locators.mock_gis
Expand Down
2 changes: 1 addition & 1 deletion lib/bb/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def connection
conn.response :betamocks if Settings.mhv.bb.mock
conn.response :bb_parser
conn.response :snakecase
conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :mhv_errors
conn.response :mhv_xml_html_errors
conn.response :json_parser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Middleware
module Response
class BackendUnhandledException < StandardError; end

class RaiseError < Faraday::Middleware
class RaiseCustomVAError < Faraday::Middleware
attr_reader :error_prefix, :body, :status

def initialize(app, options = {})
Expand Down Expand Up @@ -55,4 +55,4 @@ def response_values
end
end

Faraday::Response.register_middleware raise_error: Common::Client::Middleware::Response::RaiseError
Faraday::Response.register_middleware raise_custom_va_error: Common::Client::Middleware::Response::RaiseCustomVAError
6 changes: 3 additions & 3 deletions lib/debt_management_center/sharepoint/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def auth_connection
conn.request :url_encoded
conn.use :breakers
conn.use Faraday::Response::RaiseError
conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :json
conn.response :betamocks if mock_enabled?
conn.adapter Faraday.default_adapter
Expand All @@ -181,7 +181,7 @@ def sharepoint_connection
conn.request :json
conn.use :breakers
conn.use Faraday::Response::RaiseError
conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :json
conn.response :betamocks if mock_enabled?
conn.adapter Faraday.default_adapter
Expand All @@ -194,7 +194,7 @@ def sharepoint_file_connection
conn.request :url_encoded
conn.use :breakers
conn.use Faraday::Response::RaiseError
conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :json
conn.response :betamocks if mock_enabled?
conn.adapter Faraday.default_adapter
Expand Down
2 changes: 1 addition & 1 deletion lib/debt_management_center/vbs/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def connection
conn.request :json
conn.use :breakers
conn.use Faraday::Response::RaiseError
conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :json
conn.response :betamocks if mock_enabled?
conn.adapter Faraday.default_adapter
Expand Down
2 changes: 1 addition & 1 deletion lib/facilities/bulk_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def connection
conn.use :breakers
conn.request :json

conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :json_parser

conn.adapter Faraday.default_adapter
Expand Down
2 changes: 1 addition & 1 deletion lib/facilities/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def connection
# conn.request(:curl, ::Logger.new(STDOUT), :warn) unless Rails.env.production?
# conn.response(:logger, ::Logger.new(STDOUT), bodies: true) unless Rails.env.production?

conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :facility_parser
conn.response :facility_validator

Expand Down
2 changes: 1 addition & 1 deletion lib/facilities/drivetime_bands/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def connection
conn.use :breakers
conn.request :json

conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :betamocks if Settings.locators.mock_gis

conn.adapter Faraday.default_adapter
Expand Down
2 changes: 1 addition & 1 deletion lib/facilities/gis/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def connection
conn.use :breakers
conn.request :json

conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :facility_parser
conn.response :facility_validator
conn.response :betamocks if Settings.locators.mock_gis
Expand Down
2 changes: 1 addition & 1 deletion lib/facilities/gis/metadata_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def connection
conn.request :json

conn.response :betamocks if Settings.locators.mock_gis
conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name

conn.adapter Faraday.default_adapter
end
Expand Down
2 changes: 1 addition & 1 deletion lib/facilities/metadata/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def connection
Faraday.new(base_path, headers: base_request_headers, request: request_options) do |conn|
conn.use :breakers
conn.request :json
conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.adapter Faraday.default_adapter
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/gi/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def connection

# conn.response :logger, ::Logger.new(STDOUT), bodies: true
conn.response :snakecase
conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :gids_errors
conn.response :json_parser

Expand Down
2 changes: 1 addition & 1 deletion lib/lighthouse/facilities/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def connection
# conn.request(:curl, ::Logger.new(STDOUT), :warn) unless Rails.env.production?
# conn.response(:logger, ::Logger.new(STDOUT), bodies: true) unless Rails.env.production?

conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :lighthouse_facilities_errors

conn.adapter Faraday.default_adapter
Expand Down
2 changes: 1 addition & 1 deletion lib/medical_records/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def connection

# conn.response :betamocks if Settings.mhv.sm.mock
conn.response :snakecase
conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :mhv_errors
conn.response :mhv_xml_html_errors
conn.response :json_parser
Expand Down
2 changes: 1 addition & 1 deletion lib/medical_records/phr_mgr/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def connection
# conn.request(:curl, ::Logger.new(STDOUT), :warn) unless Rails.env.production?
# conn.response(:logger, ::Logger.new(STDOUT), bodies: true) unless Rails.env.production?

conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :mhv_errors
conn.response :mhv_xml_html_errors
conn.response :json_parser
Expand Down
2 changes: 1 addition & 1 deletion lib/mhv_ac/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def connection
# conn.response(:logger, ::Logger.new(STDOUT), bodies: true) unless Rails.env.production?

conn.response :snakecase
conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :mhv_errors
conn.response :mhv_xml_html_errors
conn.response :json_parser
Expand Down
2 changes: 1 addition & 1 deletion lib/pagerduty/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def connection
conn.use :breakers
conn.request :json

conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :json_parser

conn.adapter Faraday.default_adapter
Expand Down
2 changes: 1 addition & 1 deletion lib/rx/middleware/response/rx_raise_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module Rx
module Middleware
module Response
class RxRaiseError < Common::Client::Middleware::Response::RaiseError
class RxRaiseError < Common::Client::Middleware::Response::RaiseCustomVAError
private

def service_i18n_key
Expand Down
2 changes: 1 addition & 1 deletion lib/sm/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def connection
conn.response :betamocks if Settings.mhv.sm.mock
conn.response :sm_parser
conn.response :snakecase
conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :mhv_errors
conn.response :mhv_xml_html_errors
conn.response :json_parser
Expand Down
2 changes: 1 addition & 1 deletion modules/check_in/app/services/check_in/map/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def appointments(token:, patient_icn:, query_params:)
def connection
Faraday.new(url:) do |conn|
conn.use :breakers
conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :betamocks if mock_enabled?

conn.adapter Faraday.default_adapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def connection
# conn.request(:curl, ::Logger.new(STDOUT), :warn) unless Rails.env.production?
# conn.response(:logger, ::Logger.new(STDOUT), bodies: true) unless Rails.env.production?

conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :betamocks if mock_enabled?

conn.adapter Faraday.default_adapter
Expand Down
2 changes: 1 addition & 1 deletion modules/check_in/app/services/travel_claim/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def submit_claim_v2(token, opts)
def connection(server_url:)
Faraday.new(url: server_url) do |conn|
conn.use :breakers
conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :betamocks if mock_enabled?

conn.adapter Faraday.default_adapter
Expand Down
2 changes: 1 addition & 1 deletion modules/check_in/app/services/v2/chip/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def delete(token:)
def connection
Faraday.new(url:) do |conn|
conn.use :breakers
conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :betamocks if mock_enabled?

conn.adapter Faraday.default_adapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def connection
# conn.request(:curl, ::Logger.new(STDOUT), :warn) unless Rails.env.production?
# conn.response(:logger, ::Logger.new(STDOUT), bodies: true) unless Rails.env.production?

# conn.response :raise_error, error_prefix: service_name
# conn.response :raise_custom_va_error, error_prefix: service_name

conn.adapter Faraday.default_adapter
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def connection
# conn.request(:curl, ::Logger.new(STDOUT), :warn) unless Rails.env.production?
# conn.response(:logger, ::Logger.new(STDOUT), bodies: true) unless Rails.env.production?

conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :lighthouse_facilities_errors

conn.adapter Faraday.default_adapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def connection
# conn.request(:curl, ::Logger.new(STDOUT), :warn) unless Rails.env.production?
# conn.response(:logger, ::Logger.new(STDOUT), bodies: true) unless Rails.env.production?

conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name

conn.adapter Faraday.default_adapter
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def connection
# conn.request(:curl, ::Logger.new(STDOUT), :warn) unless Rails.env.production?
# conn.response(:logger, ::Logger.new(STDOUT), bodies: true) unless Rails.env.production?

conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.use FacilitiesApi::V1::PPMS::Middleware::PPMSParser

conn.adapter Faraday.default_adapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def connection
# conn.request(:curl, ::Logger.new(STDOUT), :warn) unless Rails.env.production?
# conn.response(:logger, ::Logger.new(STDOUT), bodies: true) unless Rails.env.production?

conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.response :lighthouse_facilities_errors

conn.adapter Faraday.default_adapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def connection
# conn.request(:curl, ::Logger.new(STDOUT), :warn) unless Rails.env.production?
# conn.response(:logger, ::Logger.new(STDOUT), bodies: true) unless Rails.env.production?

conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name

conn.adapter Faraday.default_adapter
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def connection
# conn.request(:curl, ::Logger.new(STDOUT), :warn) unless Rails.env.production?
# conn.response(:logger, ::Logger.new(STDOUT), bodies: true) unless Rails.env.production?

conn.response :raise_error, error_prefix: service_name
conn.response :raise_custom_va_error, error_prefix: service_name
conn.use FacilitiesApi::V2::PPMS::Middleware::PPMSParser

conn.adapter Faraday.default_adapter
Expand Down
2 changes: 1 addition & 1 deletion modules/travel_pay/app/services/travel_pay/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def connection(server_url:)

Faraday.new(url: server_url) do |conn|
conn.use :breakers
conn.response :raise_error, error_prefix: service_name, include_request: true
conn.response :raise_custom_va_error, error_prefix: service_name, include_request: true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kjduensing I'm including you (as a data point, not to cast blame) as an example of why this poorly named class is confusing. Can I assume that when I next update the default value of include_request to false, you'll want me to add raise_error, include_request: true to the new chain? I'll keep you in the loop on that PR.

Note: To be clear, the current inclusion of include_request: true, isn't actually doing anything, as it's a default option of the Faraday class, not our class

conn.response :betamocks if mock_enabled?
conn.response :json
conn.request :json
Expand Down
Loading