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

Conversation

Projects
None yet
3 participants
@jandom
Contributor

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

This comment has been minimized.

Contributor

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

This comment has been minimized.

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

This comment has been minimized.

Contributor

jandom commented Oct 24, 2018

@ruflin done – updated this PR text and the changelog

@Destroy666x

This comment has been minimized.

Destroy666x commented Oct 25, 2018

Thanks for PR. What about codes other than 403?

@jandom

This comment has been minimized.

Contributor

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

This comment has been minimized.

Destroy666x commented Oct 25, 2018

Unfortunately not in the nearest future

@jandom

This comment has been minimized.

Contributor

jandom commented Oct 25, 2018

@ruflin is anything else needed to merge this PR?

@jandom

This comment has been minimized.

Contributor

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

@ruflin

ruflin approved these changes Oct 30, 2018

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,

This comment has been minimized.

@ruflin

ruflin Oct 30, 2018

Owner

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

This comment has been minimized.

@jandom

jandom Oct 30, 2018

Contributor

@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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment