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

Http errors on executeMediaAndDownloadTo fail to throw GoogleJsonResponseException #783

Closed
wonderfly opened this issue Jan 10, 2015 · 5 comments
Assignees
Labels
imported priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@wonderfly
Copy link
Contributor

From d...@google.com on May 16, 2013 14:31:54

Version of google-api-java-client (e.g. 1.15.0-rc)? @Head as of 20130516 Java environment (e.g. Java 6, Android 2.3, App Engine)? Java7 Describe the problem. Http errors (such as 404) during "get" requests which use the executeMediaAndDownloadTo method fail to throw the expected GoogleJsonResponseException, instead throwing a plain HttpResponseException. For example,

try {
gcs.objects().get("nonexistent-foo", "nonexistent-bar").executeMediaAndDownloadTo(out);
} catch (GoogleJsonResponseException e) {
// Expected.
assertEquals(404, e.getStatusCode())
}

will fail to catch any exception, instead leaking a plain HttpResponseException with status code 404.

Related methods, such as execute() and executeMedia() both correctly throw GoogleJsonResponseException. How would you expect it to be fixed? The HttpMediaDownloader should include logic similar to the enclosing AbstractGoogleClientRequest.buildHttpRequest, which sets up an HttpResponseInterceptor to allow throwing custom exceptions.

Original issue: http://code.google.com/p/google-api-java-client/issues/detail?id=782

@wonderfly wonderfly added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. imported priority: p2 Moderately-important priority. Fix may not be included in next release. Component-HTTP labels Jan 10, 2015
@wonderfly wonderfly self-assigned this Jan 10, 2015
@wonderfly
Copy link
Contributor Author

From pele...@google.com on May 17, 2013 05:40:15

Status: Accepted
Owner: pele...@google.com
Labels: Milestone-Version1.16.0

@wonderfly
Copy link
Contributor Author

From yan...@google.com on June 10, 2013 06:30:00

Labels: Component-HTTP

@wonderfly
Copy link
Contributor Author

From yan...@google.com on June 21, 2013 07:08:27

Labels: -Milestone-Version1.16.0 Milestone-Version1.17.0

@wonderfly
Copy link
Contributor Author

From pele...@google.com on July 28, 2013 23:07:36

Labels: -Milestone-Version1.17.0 Milestone-Version1.18.0

@wonderfly
Copy link
Contributor Author

From yan...@google.com on September 27, 2013 05:06:48

Labels: -Milestone-Version1.18.0

@wonderfly wonderfly removed their assignment May 19, 2016
@mattwhisenhunt mattwhisenhunt added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Feb 6, 2018
@JustinBeckwith JustinBeckwith self-assigned this Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants