- Qt 6.6
- Qt GRPC
- C++ Classes
- QtGrpc (Technical Preview)
- QGrpcStatus
- Qt 6.6.1 Reference Documentation

# QGrpcStatus Class

The QGrpcStatus class contains information about last gRPC operation. More...

Header: | #include <QGrpcStatus>
CMake: | find_package(Qt6 REQUIRED COMPONENTS Grpc) target_link_libraries(mytarget PRIVATE Qt6::Grpc)
Since: | Qt 6.5
Status: | Technical Preview

- List of all members, including inherited members

## Public Types

enum | StatusCode { Ok, Cancelled, InvalidArgument, DeadlineExceeded, NotFound, …, Unauthenticated }

## Properties

- code : const StatusCode
- message : const QString

## Public Functions

| QGrpcStatus(QGrpcStatus::StatusCode code = StatusCode::Ok, const QString &message = QString())
| QGrpcStatus(const QGrpcStatus &other)
| QGrpcStatus(QGrpcStatus &&other)
| ~QGrpcStatus()
QGrpcStatus::StatusCode | code() const
QString | message() const
QGrpcStatus & | operator=(const QGrpcStatus &other)
QGrpcStatus & | operator=(QGrpcStatus &&other)

## Related Non-Members

bool | operator!=(const QGrpcStatus &lhs, QGrpcStatus::StatusCode code)
bool | operator!=(const QGrpcStatus &lhs, const QGrpcStatus &rhs)
bool | operator==(const QGrpcStatus &lhs, QGrpcStatus::StatusCode code)
bool | operator==(const QGrpcStatus &lhs, const QGrpcStatus &rhs)

## Detailed Description

In case of error in call/stream processing QGrpcStatus will contain code any of non-Ok QGrpcStatus::StatusCode. This class combines QGrpcStatus::StatusCode and message returned from channel or QGrpc framework.

## Member Type Documentation

### enum QGrpcStatus::StatusCode

Channel's status codes.

Constant | Value | Description
--- | --- | ---
`QGrpcStatus::Ok` | `0` | No error
`QGrpcStatus::Cancelled` | `1` | The operation was cancelled, typically by the caller.
`QGrpcStatus::InvalidArgument` | `3` | The client specified an invalid argument,
`QGrpcStatus::DeadlineExceeded` | `4` | The deadline expired before the operation could complete,
`QGrpcStatus::NotFound` | `5` | Some requested entity (e.g., file or directory) was not found.
`QGrpcStatus::AlreadyExists` | `6` | The entity that a client attempted to create (e.g., file or directory) already exists.
`QGrpcStatus::PermissionDenied` | `7` | The caller does not have permission to execute the specified operation. `PermissionDenied` must not be used for rejections caused by exhausting some resource (use `ResourceExhausted` instead for those errors). `PermissionDenied` must not be used if the caller can not be identified (use `Unauthenticated` instead for those errors). This error code does not imply the request is valid or the requested entity exists or satisfies other pre-conditions.
`QGrpcStatus::ResourceExhausted` | `8` | Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.
`QGrpcStatus::FailedPrecondition` | `9` | The operation was rejected because the system is not in a state required for the operation's execution.
`QGrpcStatus::Aborted` | `10` | The operation was aborted, typically due to a concurrency issue such as a sequencer check failure or transaction abort.
`QGrpcStatus::OutOfRange` | `11` | The operation was attempted past the valid range.
`QGrpcStatus::Unimplemented` | `12` | The operation is not implemented or is not supported/enabled in this service.
`QGrpcStatus::Internal` | `13` | This means that some invariants expected by the underlying system have been broken.
`QGrpcStatus::Unavailable` | `14` | The service is currently unavailable. This is most likely a transient condition, which can be corrected by retrying with a backoff. Note that it is not always safe to retry non-idempotent operations.
`QGrpcStatus::DataLoss` | `15` | Unrecoverable data loss or corruption.
`QGrpcStatus::Unauthenticated` | `16` | The request does not have valid authentication credentials for the operation.

See also gRPC status codes.

## Property Documentation

### `[read-only]` code : const StatusCode

QGrpcStatus::StatusCode received for prior gRPC call.

Access functions:

QGrpcStatus::StatusCode | code() const

### `[read-only]` message : const QString

Status message received for prior gRPC call.

Access functions:

QString | message() const

## Member Function Documentation

### QGrpcStatus::QGrpcStatus(QGrpcStatus::StatusCode code = StatusCode::Ok, const QString &message = QString())

Creates an instance of QGrpcStatus with a status code and a message.

### QGrpcStatus::QGrpcStatus(const QGrpcStatus &other)

Copies the other QGrpcStatus to this QGrpcStatus.

### QGrpcStatus::QGrpcStatus(QGrpcStatus &&other)

Moves other into new instance of QGrpcStatus.

### `[noexcept]` QGrpcStatus::~QGrpcStatus()

Destroys the QGrpcStatus.

### QGrpcStatus &QGrpcStatus::operator=(const QGrpcStatus &other)

Assigns the other QGrpcStatus into this QGrpcStatus.

### QGrpcStatus &QGrpcStatus::operator=(QGrpcStatus &&other)

Move assigns other into new instance of QGrpcStatus.

## Related Non-Members

### bool operator!=(const QGrpcStatus &lhs, QGrpcStatus::StatusCode code)

Returns `true` if lhs status code and code are not equal.

### bool operator!=(const QGrpcStatus &lhs, const QGrpcStatus &rhs)

Returns `true` if lhs status code and rhs status code are not equal.

### bool operator==(const QGrpcStatus &lhs, QGrpcStatus::StatusCode code)

Returns `true` if lhs status code and code are equal.

### bool operator==(const QGrpcStatus &lhs, const QGrpcStatus &rhs)

Returns `true` if lhs status code and rhs status code are equal.