p4runtime icon indicating copy to clipboard operation
p4runtime copied to clipboard

Improve Error proto

Open stefanheule opened this issue 6 years ago • 0 comments

There are currently a few issues with Error:

  1. Error has a code and canonical_code, where canonical_code is 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 use code for the cannonical code as well, and maybe vendor_code for additional info.

  2. 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.

stefanheule avatar Aug 14 '19 20:08 stefanheule