Skip to content

Commit

Permalink
gRPC spec update - common application level error (#8139)
Browse files Browse the repository at this point in the history
Move error codes into remote_store.proto so that all remote service
related types are there. Also, switch to using a single error type for
now for all remote store application level errors.
  • Loading branch information
zehiko authored Nov 14, 2024
1 parent 1bce6b0 commit a6f0f4f
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 72 deletions.
12 changes: 0 additions & 12 deletions crates/store/re_protos/proto/rerun/v0/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,3 @@ enum SparseFillStrategy {
NONE = 0;
LATEST_AT_GLOBAL = 1;
}

// Error codes for application level errors
enum ErrorCode {
// unused
_UNUSED = 0;

// object store access error
OBJECT_STORE_ERROR = 1;

// metadata database access error
METADATA_DB_ERROR = 2;
}
35 changes: 25 additions & 10 deletions crates/store/re_protos/proto/rerun/v0/remote_store.proto
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,6 @@ message RegisterRecordingResponse {
RecordingMetadata metadata = 2;
}

// Server can include details about the error as part of gRPC error (Status)
message RegistrationError {
// error code
ErrorCode code = 1;
// storage url of the recording that failed to register
string storage_url = 2;
// human readable details about the error
string message = 3;
}

// ---------------- GetRecordingMetadata -----------------

message GetRecordingMetadataRequest {
Expand Down Expand Up @@ -141,3 +131,28 @@ message FetchRecordingResponse {
// payload is raw bytes that the relevant codec can interpret
bytes payload = 2;
}

// Application level error - use as `details` in the `google.rpc.Status` message
message RemoteStoreError {
// error code
ErrorCode code = 1;
// unique identifier associated with the request (e.g. recording id, recording storage url)
string id = 2;
// human readable details about the error
string message = 3;
}

// Error codes for application level errors
enum ErrorCode {
// unused
_UNUSED = 0;

// object store access error
OBJECT_STORE_ERROR = 1;

// metadata database access error
METADATA_DB_ERROR = 2;

// Encoding / decoding error
CODEC_ERROR = 3;
}
8 changes: 4 additions & 4 deletions crates/store/re_protos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,13 @@ pub mod v0 {
}

// ------- Application level errors -------
impl std::error::Error for RegistrationError {}
impl std::error::Error for RemoteStoreError {}

impl std::fmt::Display for RegistrationError {
impl std::fmt::Display for RemoteStoreError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_fmt(format_args!(
"Failed to register recording: {}, error code: {}, error message: {}",
self.storage_url, self.code, self.message
"Remote store error. Request identifier: {}, error msg: {}, error code: {}",
self.id, self.message, self.code
))
}
}
Expand Down
96 changes: 50 additions & 46 deletions crates/store/re_protos/src/v0/rerun.remote_store.v0.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a6f0f4f

Please sign in to comment.