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

Implement an ErrorTransport #1529

Merged
merged 5 commits into from
Oct 30, 2018
Merged

Implement an ErrorTransport #1529

merged 5 commits into from
Oct 30, 2018

Conversation

jandom
Copy link
Contributor

@jandom jandom commented Oct 24, 2018

When using AwsAuthV4 transport, it is possible that the user provides incorrect credentials.

This means that the Guzzle client will get a 403 from AWS.

By default Guzzle silently ignores all exceptions and stores them in $response->setTransferInfo()

This feature allows a downstream client/library to handle them however.

Currently, FOSElastica does nothing to process 403 or other errors that come back from ruflin/Elastica (transferInfo is never used).

This causes a problem because 403 are silently ignored and the progress bar appears to be moving unhindered ;-)

This PR is a pre-requisite for unit tests that will accompany this fix on FOSElastica

@jandom
Copy link
Contributor Author

jandom commented Oct 24, 2018

Once this is done, it'll be possible to make FOSElasticaBundle handle non-200 errors from ruflin/Elastica and test that behavior properly

@ruflin
Copy link
Owner

ruflin commented Oct 24, 2018

@jandom Thanks for opening this, will try to have a look soon.

Could you add a changelog entry and a bit more details to the PR description on why this is needed and how it works.

@jandom
Copy link
Contributor Author

jandom commented Oct 24, 2018

@ruflin done – updated this PR text and the changelog

@Destroy666x
Copy link

Destroy666x commented Oct 25, 2018

Thanks for PR. What about codes other than 403?

@jandom
Copy link
Contributor Author

jandom commented Oct 25, 2018

@Destroy666x agreed completely, however that would require a more generic class for mocking different types of codes – do you want to contribute to the PR?

@Destroy666x
Copy link

Unfortunately not in the nearest future

@jandom
Copy link
Contributor Author

jandom commented Oct 25, 2018

@ruflin is anything else needed to merge this PR?

@jandom
Copy link
Contributor Author

jandom commented Oct 28, 2018

@ruflin updated the PR and made the NullTransport more generic and testable

@Destroy666x added the support for non-403 error codes that you've requested

Matching PR FOSElasticaBundle in https://github.com/FriendsOfSymfony/FOSElasticaBundle/pull/1465/files

Copy link
Owner

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

Will merge it as I can't see at the moment how it should break other things. Left one comment where any input is welcome.

@@ -93,6 +94,7 @@ public function exec(Request $request, array $params)
[
'request_header' => $request->getMethod(),
'http_code' => $res->getStatusCode(),
'body' => $responseBody,
Copy link
Owner

Choose a reason for hiding this comment

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

I'm looking at this line and wondering if it could have any other side effects. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ruflin unlikely but your heart is in the right place: nothing apart from tests was accessing the array passed to 'setTransportInfo'

@ruflin ruflin merged commit d6f1475 into ruflin:master Oct 30, 2018
ruflin pushed a commit that referenced this pull request Jan 21, 2019
When using AwsAuthV4 transport, it is possible that the user provides incorrect credentials.

This means that the Guzzle client will get a 403 from AWS.

By default Guzzle silently ignores all exceptions and stores them in `$response->setTransferInfo()`

This feature allows a downstream client/library to handle them however.

Currently, FOSElastica does nothing to process 403 or other errors that come back from ruflin/Elastica (transferInfo is never used).

This causes a problem because 403 are silently ignored and the progress bar appears to be moving unhindered ;-)

This PR is a pre-requisite for unit tests that will accompany this fix on FOSElastica
# Conflicts:
#	test/Elastica/Transport/NullTransportTest.php
@jandom jandom mentioned this pull request Jan 22, 2019
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.

3 participants