Status
is a thin, zero-cost abstraction around the pw_Status
enum. It initializes to pw::OkStatus()
by default and adds ok()
and str()
methods. Implicit conversions are permitted between pw_Status
and pw::Status
.
An OK status is created by the pw::OkStatus()
function or by the default Status
constructor. Non-OK Status
is created with a static member function that corresponds with the status code. Example:
}
static constexpr Status DataLoss()
Definition: status.h:316
◆ Aborted()
static constexpr Status pw::Status::Aborted |
( |
| ) |
|
|
inlinestaticconstexpr |
Operation aborted due to e.g. concurrency issue or failed transaction.
- Note
- In the Pigweed docs we refer to this code by its generic, canonical name (
ABORTED
). The C++ API for this code is Status::Aborted()
(or status.IsAborted()) and the C API is PW_STATUS_ABORTED
. See ABORTED for details on interacting with this status code in other languages.
◆ AlreadyExists()
static constexpr Status pw::Status::AlreadyExists |
( |
| ) |
|
|
inlinestaticconstexpr |
The entity that the caller requested to create is already present.
- Note
- In the Pigweed docs we refer to this code by its generic, canonical name (
ALREADY_EXISTS
). The C++ API for this code is Status::AlreadyExists()
(or status.IsAlreadyExists()) and the C API is PW_STATUS_ALREADY_EXISTS
. See ALREADY_EXISTS for details on interacting with this status code in other languages.
◆ Cancelled()
static constexpr Status pw::Status::Cancelled |
( |
| ) |
|
|
inlinestaticconstexpr |
Operation was cancelled, typically by the caller.
- Note
- In the Pigweed docs we refer to this code by its generic, canonical name (
CANCELLED
). The C++ API for this code is Status::Cancelled()
(or status.IsCancelled()) and the C API is PW_STATUS_CANCELLED
. See CANCELLED for details on interacting with this status code in other languages.
◆ code()
constexpr Code pw::Status::code |
( |
| ) |
const |
|
inlineconstexpr |
- Returns
- The
Status::Code
(pw_Status
) for this Status
.
◆ DataLoss()
static constexpr Status pw::Status::DataLoss |
( |
| ) |
|
|
inlinestaticconstexpr |
Unrecoverable data loss occurred while completing the requested operation.
- Note
- In the Pigweed docs we refer to this code by its generic, canonical name (
DATA_LOSS
). The C++ API for this code is Status::DataLoss()
(or status.IsDataLoss()) and the C API is PW_STATUS_DATA_LOSS
. See DATA_LOSS for details on interacting with this status code in other languages.
◆ DeadlineExceeded()
static constexpr Status pw::Status::DeadlineExceeded |
( |
| ) |
|
|
inlinestaticconstexpr |
Deadline passed before operation completed.
- Note
- In the Pigweed docs we refer to this code by its generic, canonical name (
DEADLINE_EXCEEDED
). The C++ API for this code is Status::DeadlineExceeded()
(or status.IsDeadlineExceeded()) and the C API is PW_STATUS_DEADLINE_EXCEEDED
. See DEADLINE_EXCEEDED for details on interacting with this status code in other languages.
◆ FailedPrecondition()
static constexpr Status pw::Status::FailedPrecondition |
( |
| ) |
|
|
inlinestaticconstexpr |
System isn’t in the required state; e.g. deleting a non-empty directory.
- Note
- In the Pigweed docs we refer to this code by its generic, canonical name (
FAILED_PRECONDITION
). The C++ API for this code is Status::FailedPrecondition()
(or status.IsFailedPrecondition()) and the C API is PW_STATUS_PERMISSION_DENIED
. See PERMISSION_DENIED for details on interacting with this status code in other languages.
◆ IgnoreError()
constexpr void pw::Status::IgnoreError |
( |
| ) |
const |
|
inlineconstexpr |
Ignores any errors.
This method does nothing except potentially suppress complaints from any tools that are checking that errors are not dropped on the floor.
◆ Internal()
static constexpr Status pw::Status::Internal |
( |
| ) |
|
|
inlinestaticconstexpr |
Internal error occurred; e.g. system invariants were violated.
- Note
- In the Pigweed docs we refer to this code by its generic, canonical name (
INTERNAL
). The C++ API for this code is Status::Internal()
(or status.IsInternal()) and the C API is PW_STATUS_INTERNAL
. See INTERNAL for details on interacting with this status code in other languages.
◆ InvalidArgument()
static constexpr Status pw::Status::InvalidArgument |
( |
| ) |
|
|
inlinestaticconstexpr |
Argument was malformed; e.g. invalid characters when parsing integer.
- Note
- In the Pigweed docs we refer to this code by its generic, canonical name (
INVALID_ARGUMENT
). The C++ API for this code is Status::InvalidArgument()
(or status.IsInvalidArgument()) and the C API is PW_STATUS_INVALID_ARGUMENT
. See INVALID_ARGUMENT for details on interacting with this status code in other languages.
◆ IsAborted()
constexpr bool pw::Status::IsAborted |
( |
| ) |
const |
|
inlineconstexpr |
- Returns
true
if the status of this instance is ABORTED.
◆ IsAlreadyExists()
constexpr bool pw::Status::IsAlreadyExists |
( |
| ) |
const |
|
inlineconstexpr |
◆ IsCancelled()
constexpr bool pw::Status::IsCancelled |
( |
| ) |
const |
|
inlineconstexpr |
- Returns
true
if the status of this instance is CANCELLED.
◆ IsDataLoss()
constexpr bool pw::Status::IsDataLoss |
( |
| ) |
const |
|
inlineconstexpr |
- Returns
true
if the status of this instance is DATA_LOSS.
◆ IsDeadlineExceeded()
constexpr bool pw::Status::IsDeadlineExceeded |
( |
| ) |
const |
|
inlineconstexpr |
◆ IsFailedPrecondition()
constexpr bool pw::Status::IsFailedPrecondition |
( |
| ) |
const |
|
inlineconstexpr |
◆ IsInternal()
constexpr bool pw::Status::IsInternal |
( |
| ) |
const |
|
inlineconstexpr |
- Returns
true
if the status of this instance is INTERNAL.
◆ IsInvalidArgument()
constexpr bool pw::Status::IsInvalidArgument |
( |
| ) |
const |
|
inlineconstexpr |
◆ IsNotFound()
constexpr bool pw::Status::IsNotFound |
( |
| ) |
const |
|
inlineconstexpr |
- Returns
true
if the status of this instance is NOT_FOUND.
◆ IsOutOfRange()
constexpr bool pw::Status::IsOutOfRange |
( |
| ) |
const |
|
inlineconstexpr |
◆ IsPermissionDenied()
constexpr bool pw::Status::IsPermissionDenied |
( |
| ) |
const |
|
inlineconstexpr |
◆ IsResourceExhausted()
constexpr bool pw::Status::IsResourceExhausted |
( |
| ) |
const |
|
inlineconstexpr |
◆ IsUnauthenticated()
constexpr bool pw::Status::IsUnauthenticated |
( |
| ) |
const |
|
inlineconstexpr |
◆ IsUnavailable()
constexpr bool pw::Status::IsUnavailable |
( |
| ) |
const |
|
inlineconstexpr |
- Returns
true
if the status of this instance is UNAVAILABLE.
◆ IsUnimplemented()
constexpr bool pw::Status::IsUnimplemented |
( |
| ) |
const |
|
inlineconstexpr |
◆ IsUnknown()
constexpr bool pw::Status::IsUnknown |
( |
| ) |
const |
|
inlineconstexpr |
- Returns
true
if the status of this instance is UNKNOWN.
◆ NotFound()
static constexpr Status pw::Status::NotFound |
( |
| ) |
|
|
inlinestaticconstexpr |
The entity that the caller requested (e.g. file or directory) is not found.
- Note
- In the Pigweed docs we refer to this code by its generic, canonical name (
NOT_FOUND
). The C++ API for this code is Status::NotFound()
(or status.IsNotFound()) and the C API is PW_STATUS_NOT_FOUND
. See NOT_FOUND for details on interacting with this status code in other languages.
◆ ok()
constexpr bool pw::Status::ok |
( |
| ) |
const |
|
inlineconstexpr |
- Returns
true
if the status is pw::OkStatus()
.
This function is provided in place of an IsOk()
function.
◆ OutOfRange()
static constexpr Status pw::Status::OutOfRange |
( |
| ) |
|
|
inlinestaticconstexpr |
Operation attempted out of range; e.g. seeking past end of file.
- Note
- In the Pigweed docs we refer to this code by its generic, canonical name (
OUT_OF_RANGE
). The C++ API for this code is Status::OutOfRange()
(or status.IsOutOfRange()) and the C API is PW_STATUS_OUT_OF_RANGE
. See OUT_OF_RANGE for details on interacting with this status code in other languages.
◆ PermissionDenied()
static constexpr Status pw::Status::PermissionDenied |
( |
| ) |
|
|
inlinestaticconstexpr |
Caller lacks permission to execute action.
- Note
- In the Pigweed docs we refer to this code by its generic, canonical name (
PERMISSION_DENIED
). The C++ API for this code is Status::PermissionDenied()
(or status.IsPermissionDenied()) and the C API is PW_STATUS_PERMISSION_DENIED
. See PERMISSION_DENIED for details on interacting with this status code in other languages.
◆ ResourceExhausted()
static constexpr Status pw::Status::ResourceExhausted |
( |
| ) |
|
|
inlinestaticconstexpr |
Insufficient resources to complete operation; e.g. supplied buffer is too small.
- Note
- In the Pigweed docs we refer to this code by its generic, canonical name (
RESOURCE_EXHAUSTED
). The C++ API for this code is Status::ResourceExhausted()
(or status.IsResourceExhausted()) and the C API is PW_STATUS_RESOURCE_EXHAUSTED
. See RESOURCE_EXHAUSTED for details on interacting with this status code in other languages.
◆ str()
const char * pw::Status::str |
( |
| ) |
const |
|
inline |
- Returns
- A null-terminated string representation of the
Status
.
◆ Unauthenticated()
static constexpr Status pw::Status::Unauthenticated |
( |
| ) |
|
|
inlinestaticconstexpr |
Caller does not have valid authentication credentials for the operation.
- Note
- In the Pigweed docs we refer to this code by its generic, canonical name (
UNAUTHENTICATED
). The C++ API for this code is Status::Unauthenticated()
(or status.IsUnauthenticated()) and the C API is PW_STATUS_UNAUTHENTICATED
. See UNAUTHENTICATED for details on interacting with this status code in other languages.
◆ Unavailable()
static constexpr Status pw::Status::Unavailable |
( |
| ) |
|
|
inlinestaticconstexpr |
Requested operation can’t finish now, but may at a later time.
- Note
- In the Pigweed docs we refer to this code by its generic, canonical name (
UNAVAILABLE
). The C++ API for this code is Status::Unavailable()
(or status.IsUnavailable()) and the C API is PW_STATUS_UNAVAILABLE
. See UNAVAILABLE for details on interacting with this status code in other languages.
◆ Unimplemented()
static constexpr Status pw::Status::Unimplemented |
( |
| ) |
|
|
inlinestaticconstexpr |
Operation isn’t implemented or supported.
- Note
- In the Pigweed docs we refer to this code by its generic, canonical name (
UNIMPLEMENTED
). The C++ API for this code is Status::Unimplemented()
(or status.IsUnimplemented()) and the C API is PW_STATUS_UNIMPLEMENTED
. See UNIMPLEMENTED for details on interacting with this status code in other languages.
◆ Unknown()
static constexpr Status pw::Status::Unknown |
( |
| ) |
|
|
inlinestaticconstexpr |
Unknown error occurred. Avoid this code when possible.
- Note
- In the Pigweed docs we refer to this code by its generic, canonical name (
UNKNOWN
). The C++ API for this code is Status::Unknown()
(or status.IsUnknown()) and the C API is PW_STATUS_UNKNOWN
. See UNKNOWN for details on interacting with this status code in other languages.
◆ Update()
constexpr void pw::Status::Update |
( |
Status |
other | ) |
|
|
inlineconstexpr |
Updates this Status
to the other
IF this status is pw::OkStatus()
.
This is useful for tracking the first encountered error, as calls to this helper will not change one error status to another error status.
The documentation for this class was generated from the following file: