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

Conversation

ryan-mcneil
Copy link
Contributor

Summary

  • In preparation for monkeypatching the Faraday gem, in which we are changing the default value of the Faraday::Response::RaiseError option include_request to false, we need to Change the name of the custom RaiseError class for a couple of reasons:
  • By having our RaiseError class registered as :raise_error, it can be confusing for devs as that is the syntax for the Faraday::Response::RaiseError class. In some cases our custom class has clearly been confused for the standard
  • In many cases we use BOTH RaiseError classes (which I think is problematic, but will be tackled later):
          conn.use Faraday::Response::RaiseError
          conn.response :raise_error, error_prefix: service_name

To be able to use some of the extended options of the Faraday class (include_request and potential future options), we need to change from the explicit (former) to the more concise (latter) syntax. With the current custom class's naming convention, these would conflict. This will allow us to do something like the following, when necessary:

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

Related issue(s)

Testing done

  • Test suite is passing after class change

What areas of the site does it impact?

  • Affects use of middleware going forward. Included documentation is updated, and a message will be sent out to #vfs-all-teams

@ryan-mcneil ryan-mcneil requested review from a team as code owners June 5, 2024 22:58
@ryan-mcneil ryan-mcneil requested a review from Tonksthebear June 5, 2024 22:58
@va-vsp-bot
Copy link
Collaborator

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: lib/common/client/middleware/response/raise_custom_va_error.rb

@va-vfs-bot va-vfs-bot temporarily deployed to rm-rename-raise-error-class/main/main June 5, 2024 23:00 Inactive
@@ -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

@ryan-mcneil ryan-mcneil requested review from a team as code owners June 6, 2024 20:12
@va-vsp-bot
Copy link
Collaborator

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: lib/common/client/configuration/rest.rb

@va-vfs-bot va-vfs-bot temporarily deployed to rm-rename-raise-error-class/main/main June 6, 2024 20:19 Inactive
@ryan-mcneil ryan-mcneil requested a review from a team as a code owner June 6, 2024 21:42
@va-vsp-bot
Copy link
Collaborator

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: lib/common/client/middleware/response/raise_custom_va_error.rb

@va-vfs-bot va-vfs-bot temporarily deployed to rm-rename-raise-error-class/main/main June 6, 2024 21:51 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to rm-rename-raise-error-class/main/main June 6, 2024 22:01 Inactive
Copy link
Contributor

@rmtolmach rmtolmach left a comment

Choose a reason for hiding this comment

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

Name changes LGTM. After deploy, are you able to validate that this is working as designed? Check Datadog logs or something?

@ryan-mcneil ryan-mcneil merged commit 045d864 into master Jun 7, 2024
19 checks passed
@ryan-mcneil ryan-mcneil deleted the rm-rename-raise-error-class branch June 7, 2024 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants