p4runtime
p4runtime copied to clipboard
Improve Error proto
There are currently a few issues with Error:
-
Errorhas acodeandcanonical_code, wherecanonical_codeis the main error code (and the only standardized code). However, almost all other kinds of status use code as the canonical code, which can easily lead to confusion. Instead, we should usecodefor the cannonical code as well, and maybevendor_codefor additional info. -
The name is very misleading, because Error is also used to represent success. This is really a status, not an error.
I propose we change the message as follows:
message Status {
int32 code = 1;
string message = 2;
string space = 3;
int32 vendor_code = 4;
google.protobuf.Any details = 5;
}
For reference, right now it is:
message Error {
int32 canonical_code = 1;
string message = 2;".
string space = 3;
int32 code = 4;
google.protobuf.Any details = 5;
}
Alternatively, we could just remove this altogether, and use google.rpc.Status instead, depending on how valuable we think the vendor parts are.