enum Status
gRPC status codes (the variants are in the order of the numeric codes).
Example:
use std.rpc { callStatus, Status }
@grpc_status(.NotFound) @error data Missing { what: str }
service S {
@public rpc find() -> i32 | Missing
}
impl S {
rpc find() { fail Missing{ what: "x" } }
}
fn main() io, net {
print("{callStatus(S, "find", b"") == Status.NotFound}")
}Вывод
true
pub(api) enum StatusС версии. 1.0.0-beta
Варианты
Ok | The call succeeded. |
Cancelled | The call was cancelled. |
Unknown | An unknown error. |
InvalidArgument | The request is invalid. |
DeadlineExceeded | The deadline passed. |
NotFound | The entity was not found. |
AlreadyExists | The entity exists already. |
PermissionDenied | The caller may not do it. |
ResourceExhausted | A resource (quota, memory) is exhausted. |
FailedPrecondition | The system is not in a state the call needs. |
Aborted | The call was aborted (a conflict). |
OutOfRange | A value is outside the valid range. |
Unimplemented | The method is not implemented. |
Internal | An internal error. |
Unavailable | The service is unavailable now. |
DataLoss | Data was lost or damaged. |
Unauthenticated | The caller has no valid credentials. |
Определено в: std/rpc/rpc.oxl:50