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

Throw more granular exception on ImageAnnotatorClient.close() #2216

Closed
gguuss opened this issue Jul 6, 2017 · 4 comments
Closed

Throw more granular exception on ImageAnnotatorClient.close() #2216

gguuss opened this issue Jul 6, 2017 · 4 comments
Assignees
Labels
api: vision Issues related to the Cloud Vision API. 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

@gguuss
Copy link
Contributor

gguuss commented Jul 6, 2017

Currently, the image annotator client can throw the generic "Exception" on close. I found this while making the update to close the image annotator client in the vision sample.

@michaelbausor
Copy link
Contributor

I think this may be unavoidable, because the AutoCloseable interface throws Exception: https://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html#close()

@michaelbausor michaelbausor added api: vision Issues related to the Cloud Vision API. 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. labels Jul 6, 2017
@gguuss
Copy link
Contributor Author

gguuss commented Jul 10, 2017

I see, it sounds like they "strongly encourage implementations to throw more specific exceptions" but it's not clear how they expect you to implement this.

@michaelbausor
Copy link
Contributor

Yes, it isn't clear what we could do. One possibility would be to use a list of Closeable instead of Autocloseable. But I would be worried that at some future point, we would want to add an Autocloseable and need to change it back.

I am closing this for now, but if you want to discuss possibly switching to Closeable or some other option, please reopen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vision Issues related to the Cloud Vision API. 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

2 participants