IsGrpcErrorWithCode
Checks if a given error is a gRPC error with a specific status code.
def IsGrpcErrorWithCode(
code: codes.Code,
err: error
) - > bool
Checks if a given error is a gRPC error with a specific status code. This function is useful for handling gRPC errors by allowing callers to determine if an error matches an expected gRPC status code.
Parameters
| Name | Type | Description |
|---|---|---|
| code | codes.Code | The gRPC status code to check against the error. |
| err | error | The error object to inspect. |
Returns
| Type | Description |
|---|---|
bool | True if the error is a gRPC error and its status code matches the provided code, False otherwise. |