Skip to content

google/cloud/storage throws exceptions, contradicting the documentation #6933

@lgruen

Description

@lgruen

What component of google-cloud-cpp is this related to?
google/cloud/storage

Describe the bug
The google-cloud-storage documentation (https://googleapis.dev/cpp/google-cloud-storage/latest/) states:

This library never throws exceptions to signal error. In general, the library returns a StatusOr if an error is possible. Some functions return objects that already have an existing error handling mechanism, such as types derived from std::ostream where the application can check the state flags to determine if there was an error. In these cases no StatusOr wrapper is used.

I thought this means that checking the return values of client library calls is sufficient and that catch-clauses aren't required.

However, the google-cloud-storage library throws exceptions in a number of places (one concrete example is ThrowSetOptionError).

Expected behavior
Either the docs should state that exception handling is required or the library should never throw exceptions.

What version of google-cloud-cpp are you using?
1.29.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: storageIssues related to the Cloud Storage API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions