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

Adds specific errors for connection timeout and failure #483

Closed
wants to merge 2 commits into from

Conversation

Maimer
Copy link

@Maimer Maimer commented Jan 16, 2024

This should be backwards compatible with the existing code as the new errors inherit from ApiError and maintain the same string signature of the previous errors.

Addresses the following issue: #428

@phoenixy1

@Maimer
Copy link
Author

Maimer commented Jan 22, 2024

@phoenixy1 thoughts on this?

@phoenixy1
Copy link

Thanks or the PR! I'm not really a rubyist -- I'll ask around internally for review but I would also appreciate opinions on this change from others users of this library. Cc: @kyledcline @ctlevi @enriquez @pradyumna2905 @bdewater

@bdewater
Copy link

+1 to this, it’s easier and idiomatic to rescue a specific subclass rather than matching on a string message.

Copy link

@pdx91 pdx91 left a comment

Choose a reason for hiding this comment

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

Yep, this makes sense to me. Backward compatible too! 👍

@phoenixy1
Copy link

ok, sounds like the people approve! I'll put this into the queue to work on -- hopefully we can get it in for the next clib release.

@phoenixy1
Copy link

@Maimer I tried importing this upstream but the test suite will not run with this change and generates the following error:

/usr/src/app/lib/plaid/api_client.rb:26:in `<class:ApiClient>': uninitialized constant Plaid::ApiClient::ApiError (NameError)

Can you fix whatever it's missing (or give instructions on the fix it needs, if it's not part of the published clib)? Thanks!

Comment on lines +26 to +28
class ApiTimeoutError < ApiError; end
class ApiConnectionFailedError < ApiError; end

Choose a reason for hiding this comment

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

Re #483 (comment), I believe it's a namespace issue

Suggested change
class ApiTimeoutError < ApiError; end
class ApiConnectionFailedError < ApiError; end
class ApiTimeoutError < Plaid::ApiError; end
class ApiConnectionFailedError < Plaid::ApiError; end

Or may need to be ::Plaid

Copy link
Author

Choose a reason for hiding this comment

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

I believe it's a loading issue, which is only present in the tests. The namespace should work without needing to be explicit.

Choose a reason for hiding this comment

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

I did try changing the namespace as suggested here but now get the error:

/usr/src/app/lib/plaid/api_client.rb:26:in `<class:ApiClient>': uninitialized constant Plaid::ApiError (NameError)

If you can figure out the solution that would be great. If not, things have been a little hectic this week (performance review season, family emergency) but I can also ask some people who actually know Ruby to take a look sometime next week.

Copy link
Author

Choose a reason for hiding this comment

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

I did try changing the namespace as suggested here but now get the error:

/usr/src/app/lib/plaid/api_client.rb:26:in `<class:ApiClient>': uninitialized constant Plaid::ApiError (NameError)

If you can figure out the solution that would be great. If not, things have been a little hectic this week (performance review season, family emergency) but I can also ask some people who actually know Ruby to take a look sometime next week.

@phoenixy1 Apologies as I had meant to take a look at this sooner. I have pushed what I believe to be a working solution to the NameError. I believe that the test suite could be cleaned up a bit more and be made more conventional. However, I have not setup the test suite to run entirely on my machine. I did get the specific test I wrote to pass when run on its own. It would be nice if this test suite were either easier to run locally, or had a public facing CI run that I could use to verify my work. If that were the case I could spend some time standardizing the way this all works and make it easier to make changes going forward. How are the tests currently run and changes verified internally? All I see is the build step waiting in CircleCI. Would it be possibe to make that build public?

Choose a reason for hiding this comment

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

Thanks! I tried this and the tests pass with these changes; I've submitted a fix for upstream.

I don't have a ton of insight into CI for this repo -- honestly, I don't have access to CircleCI either and typically run the tests locally using our internal makefile, which builds the libraries using the Docker images provided by OpenApiTools and then runs the tests. Anyway, I can pass the request along to the team that does run it!

Copy link
Author

Choose a reason for hiding this comment

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

Thanks! I tried this and the tests pass with these changes; I've submitted a fix for upstream.

I don't have a ton of insight into CI for this repo -- honestly, I don't have access to CircleCI either and typically run the tests locally using our internal makefile, which builds the libraries using the Docker images provided by OpenApiTools and then runs the tests. Anyway, I can pass the request along to the team that does run it!

Awesome, glad it worked out and will be in the next release!

Thanks for passing along the CI request. At my company (AppFolio) we also use CircleCI and all of our open source repos have publicly available CI.

@Maimer
Copy link
Author

Maimer commented Jan 27, 2024

@Maimer I tried importing this upstream but the test suite will not run with this change and generates the following error:

/usr/src/app/lib/plaid/api_client.rb:26:in `<class:ApiClient>': uninitialized constant Plaid::ApiClient::ApiError (NameError)

Can you fix whatever it's missing (or give instructions on the fix it needs, if it's not part of the published clib)? Thanks!

I'll take a look at this and hopefully have a fix for you soon.

@Maimer Maimer force-pushed the add_specific_api_errors branch from e428f62 to 8652bc1 Compare February 20, 2024 17:52
This should be backwards compatible with the existing code as
the new errors inherit from ApiError and maintain the same
string signature of the previous errors
Require default gems for test suite
Fix `MiniTest` namespace issue
@Maimer Maimer force-pushed the add_specific_api_errors branch from 8652bc1 to 5286788 Compare February 20, 2024 17:54
@phoenixy1
Copy link

This has been merged into upstream and should be released with the next scheduled ruby client library release!

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.

5 participants