syntax = "proto3";

package cockroach.errorspb;

import "google/protobuf/any.proto";

enum MessageType {
  PREFIX = 0;
  FULL_MESSAGE = 1;
}

message EncodedError {
  oneof error {
    .cockroach.errorspb.EncodedErrorLeaf leaf = 1;
    .cockroach.errorspb.EncodedWrapper wrapper = 2;
  }
}

message EncodedErrorLeaf {
  string message = 1;
  .cockroach.errorspb.EncodedErrorDetails details = 2;
  repeated .cockroach.errorspb.EncodedError multierror_causes = 3;
}

message EncodedErrorDetails {
  string original_type_name = 1;
  .cockroach.errorspb.ErrorTypeMark error_type_mark = 2;
  repeated string reportable_payload = 3;
  .google.protobuf.Any full_details = 4;
}

message EncodedWrapper {
  .cockroach.errorspb.EncodedError cause = 1;
  string message = 2;
  .cockroach.errorspb.EncodedErrorDetails details = 3;
  .cockroach.errorspb.MessageType message_type = 4;
}

message ErrorTypeMark {
  string family_name = 1;
  string extension = 2;
}

message StringsPayload {
  repeated string details = 1;
}

message ErrnoPayload {
  int64 orig_errno = 1;
  string arch = 2;
  bool is_permission = 3;
  bool is_exist = 4;
  bool is_not_exist = 5;
  bool is_timeout = 6;
  bool is_temporary = 7;
}
