Stay organized with collections Save and categorize content based on your preferences.
Represents success or an error with info about the error.
This class is typically used to indicate whether or not a function or other operation completed successfully. Success is indicated by an "OK" status. OK statuses will have .
code()
==
StatusCode::kOk
and .
ok()
== true
, with all other properties having empty values. All OK statuses are equal. Any non-OK Status
is considered an error. Users can inspect the error using the member functions, or they can simply stream the Status
object, and it will print itself in some human readable way (the streamed format may change over time and you should not depend on the specific format of a streamed Status
object remaining unchanged).
This is a regular value type that can be copied, moved, compared for equality, and streamed.
Constructors Status(Status const &)Copy construction and assignment.
Parameter Name Description
Status const &
Move construction and assignment.
Parameter Name Description
Status &&
Default constructor, initializes to StatusCode::kOk
.
Construct from a status code, message and (optional) error info.
Operators operator=(Status const &)Copy construction and assignment.
Parameter Name Description
Status const &
Status &
operator=(Status &&)
Move construction and assignment.
Parameter Name Description
Status &&
Status &
Functions ok() const
Returns true if the status code is StatusCode::kOk
.
bool
code() const
Returns the status code.
Returns Type DescriptionStatusCode
message() const
Returns the message associated with the status.
This is always empty if code()
is StatusCode::kOk
.
std::string const &
error_info() const
Returns the additional error info associated with the status.
This is always a default-constructed error info if code()
is StatusCode::kOk
.
ErrorInfo const &
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-14 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[[["The provided content is a documentation page for the `Status` class in the Google Cloud C++ library, specifically version 2.28.0, which is used to represent the outcome of an operation, indicating either success or an error."],["The `Status` class indicates success with an \"OK\" status, which is characterized by `StatusCode::kOk`, an empty message, an empty error info, and `ok()` returning `true`, and it is a regular value type that can be copied, moved, compared, and streamed."],["Non-OK `Status` objects represent errors, and users can access error information through member functions or by streaming the `Status` object."],["The page provides links to different versions of the documentation, ranging from the latest release candidate 2.37.0-rc down to version 2.10.1, all of which correspond to the `Status` class."],["The `Status` object can be constructed in a number of ways, namely default construction that defaults to `StatusCode::kOk`, Copy construction and assignment, Move construction and assignment, or a custom construction that takes a `StatusCode`, a message, and `ErrorInfo`."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4