Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve errors.
Browse files Browse the repository at this point in the history
milesj committed Jan 24, 2025
1 parent 365dd1b commit fd5cb31
Showing 3 changed files with 5 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/workflows/moon.yml
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ jobs:
cache-base: '^(master|develop-)'
- run: cargo run -- --color --log trace ci --base ${{ github.base_ref || 'master' }}
env:
DEPOT_TOKEN: ${{ secrets.DEPOT_TOKEN }}
MOON_NODE_VERSION: ${{ matrix.node-version }}
MOONBASE_SECRET_KEY: ${{ secrets.MOONBASE_SECRET_KEY }}
MOONBASE_ACCESS_KEY: ${{ secrets.MOONBASE_ACCESS_KEY }}
9 changes: 2 additions & 7 deletions crates/remote/src/grpc_remote_client.rs
Original file line number Diff line number Diff line change
@@ -30,13 +30,8 @@ fn map_transport_error(error: tonic::transport::Error) -> RemoteError {

fn map_status_error(error: tonic::Status) -> RemoteError {
dbg!(&error);
match error.source() {
Some(src) => RemoteError::GrpcCallFailedViaSource {
error: src.to_string(),
},
None => RemoteError::GrpcCallFailed {
error: Box::new(error),
},
RemoteError::GrpcCallFailed {
error: Box::new(error),
}
}

11 changes: 2 additions & 9 deletions crates/remote/src/remote_error.rs
Original file line number Diff line number Diff line change
@@ -5,15 +5,8 @@ use thiserror::Error;
#[derive(Error, Debug, Diagnostic)]
pub enum RemoteError {
#[diagnostic(code(remote::grpc::call_failed))]
#[error("Failed to make gRPC call.")]
GrpcCallFailed {
#[source]
error: Box<tonic::Status>,
},

#[diagnostic(code(remote::grpc::call_failed))]
#[error("Failed to make gRPC call: {error}")]
GrpcCallFailedViaSource { error: String },
#[error("Failed to make gRPC call.\n{}: {}", .error.code(), .error.message())]
GrpcCallFailed { error: Box<tonic::Status> },

#[diagnostic(code(remote::grpc::connect_failed))]
#[error("Failed to connect to gRPC host.")]

0 comments on commit fd5cb31

Please sign in to comment.