Creates a status in the canonical error space with the specified absl::StatusCode and error message. If code == absl::StatusCode::kOk, msg is ignored and an object identical to an OK status is constructed.
Declared in <absl/status/status.h>
Status(
absl::StatusCode code,
std::string_view msg,
absl::SourceLocation loc = SourceLocation::current());
The msg string must be in UTF-8. The implementation may complain (e.g., by printing a warning) if it is not.
The loc is the SourceLocation of the callsite. It will be stored in the Status iff code != absl::StatusCode::kOk and !msg.empty().
| Name | Description |
|---|---|
| code | The canonical error code for the status. |
| msg | The UTF-8 error message. |
| loc | The source location of the callsite. |