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

Improve error messages in StorageExceptions #861

Open
lbergelson opened this issue Mar 15, 2022 · 3 comments
Open

Improve error messages in StorageExceptions #861

lbergelson opened this issue Mar 15, 2022 · 3 comments
Assignees
Labels
api: storage Issues related to the googleapis/java-storage-nio API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@lbergelson
Copy link
Contributor

I know that the messages in StorageExceptions come from some storage service that isn't part of this project, but I'm not sure where to make this request otherwise.

Is your feature request related to a problem? Please describe.
StorageExceptions are always extremely vague about the exact details of what caused the problem. They don't include the specific strings that were invalid. This can make debugging tricky when there are multiple potential connections that could have failed, or if something in the user code that generates a Path is generating incorrect ones.

For example, they'll include information like the following:

{
  "code" : 404,
  "errors" : [ {
    "domain" : "global",
    "message" : "The specified bucket does not exist.",
    "reason" : "notFound"
  } 

It would be much more useful if in this case they included what the bucket name was.

Describe the solution you'd like
Include the specific problem in the message.
For instance if the bad bucket name was "bucketImisspelled"

{
  "code" : 404,
  "errors" : [ {
    "domain" : "global",
    "message" : "The specified bucket does not exist. (bucketImisspelled)"
    "reason" : "notFound"
  } ],

Describe alternatives you've considered
Other options would be to include an additional "details" field if the message has to always be the same.

@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/java-storage-nio API. label Mar 15, 2022
@BrennaEpp BrennaEpp added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. priority: p3 Desirable enhancement or fix. May not be included in next release. labels Mar 16, 2022
@BenWhitehead
Copy link
Collaborator

Unfortunately, may error messages come from varying locations each with differing access to specific parts of context which many be necessary to provide various specific hints as you've called out here. Additionally, there are some categories of request parameters which are classified as not to be included in errors. (We've add bugs in the past where some of these classified parameters were included and we had to patch things to remove them).

I know there are various efforts to improve error messages for GCS so I'll share this with those folks, but I can't provide any timeline as to when these improvements may happen.

@lbergelson
Copy link
Contributor Author

Yeah, I figured it was probably like that. It's been bugging me though so I figured I'd ask and at least try to get it on the radar. One possibility might be to wrap and rethrow some of them from within the NIO library, because the calling code probably knows the information in most cases.

@lbergelson
Copy link
Contributor Author

It actually might make sense to wrap the storage exceptions into IOExceptions in many places anyway. The typical Files methods all throw IOException and code tends to assume that that's what you'll get if there's an exception. Our codebase for instance handles IOExceptions differently than most other exceptions because they are typically caused by something in the Users environment instead of a bug on our end. We have to add extra handling for StorageExceptions as well. Any code that tries to work around or retry IOExceptions, or fall back to other cases ALSO has to be modified to understand storage exceptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/java-storage-nio API. priority: p3 Desirable enhancement or 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