-
Notifications
You must be signed in to change notification settings - Fork 93
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
feat: allow for http adapter param #636
base: v3-v2021-02-25
Are you sure you want to change the base?
Conversation
saas786
commented
Sep 28, 2021
- Base client class now accepts Http Adapter object as param.
- Add http adapter interface.
This seems like a useful PR, I'd happily write a curl variant for my needs. What's missing for this to be merged? I could think of adding |
I have been using my fork with this PR. But in order to be merged into core, core needs to implement error handling using PSR I guess, that way, if I just merge this PR, it should work without issues. But with current implementation regarding error handling, this can break error handling, you will have to write your own error handlers. |
How does the proposed change affect error handling, though? Obviously any
other HTTP adapter would have to implement their own, but it wouldn't
"break" error handling. It just wouldn't improve it, and the adapters would
be on a "need to handle your own dirt" regime. Still better than no way to
plug an adapter, no?
…On Fri, 4 Mar 2022 at 14:00, saasfreelancer ***@***.***> wrote:
This seems like a useful PR, I'd happily write a curl variant for my
needs. What's missing for this to be merged? I could think of adding implements
HttpAdapterInterface to the HttpAdapter class definition, I guess, but is
that what's wrong here?
I have been using my fork with this PR.
But in order to be merged into core, core needs to implement error
handling using PSR I guess, that way, if I just merge this PR, it should
work without issues.
But with current implementation regarding error handling, this can break
error handling, you will have to write your own error handlers.
—
Reply to this email directly, view it on GitHub
<#636 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB3QELOBQUE5WG4CLYGYILTU6ICOPANCNFSM5E5L7P5Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
--
Adam "Sinus" Skawiński
|
I am not blaming somebody here... I might be wrong... But this doesn't work when I use Guzzle Client:
but only this work:
Because errors are not being thrown / handled by recurly, but rather by Guzzle now, so they are more like this:
|
(By the way: your PR won't merge cleanly anymore; there have been changes to the Base_Client constructor definition.) |
After incorporating your HttpAdapterInterface into my variant (a cURL adapter), I see what you meant with the exceptions. Well, yes, you'll probably have to catch the GuzzleHttp\Exception exceptions and throw them back at the "final" code. For simplicity's sake, I just went with a simple ConnectionError class that wraps any cURL error details if the connection fails entirely, but leaves it up to the Recurly lib to throw its exceptions if the connection succeeds but the response isn't valid. |
774dc86
to
f33fe4a
Compare
55e0726
to
f33fe4a
Compare
- Base client class now accepts Http Adapter object as param. - Add http adapter interface
f33fe4a
to
15c384d
Compare