Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
asr2003 committed Dec 15, 2024
1 parent 11dc3a0 commit ad02579
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions nativelink-error/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ rust_library(
"//nativelink-metric",
"//nativelink-proto",
"@crates//:fred",
"@crates//:google-cloud-storage",
"@crates//:hex",
"@crates//:prost",
"@crates//:prost-types",
Expand Down
1 change: 1 addition & 0 deletions nativelink-error/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ prost-types = { version = "0.13.4", default-features = false }
serde = { version = "1.0.216", default-features = false }
tokio = { version = "1.42.0", features = ["fs", "rt-multi-thread", "signal", "io-util"], default-features = false }
tonic = { version = "0.12.3", features = ["transport", "tls"], default-features = false }
google-cloud-storage = "0.23.0"
31 changes: 31 additions & 0 deletions nativelink-error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use std::convert::Into;

pub use google_cloud_storage::http::Error as GcsError;
use nativelink_metric::{
MetricFieldData, MetricKind, MetricPublishKnownKindData, MetricsComponent,
};
Expand Down Expand Up @@ -219,6 +220,36 @@ impl From<Code> for Error {
}
}

impl From<GcsError> for Error {
fn from(err: GcsError) -> Self {
match err {
GcsError::Response(error_response) => {
make_err!(
Code::Unavailable,
"GCS Response Error: {:?}",
error_response
)
}
GcsError::HttpClient(error) => {
make_err!(Code::Unavailable, "GCS HTTP Client Error: {:?}", error)
}
GcsError::HttpMiddleware(error) => {
make_err!(Code::Unavailable, "GCS HTTP Middleware Error: {:?}", error)
}
GcsError::TokenSource(error) => {
make_err!(Code::Unauthenticated, "GCS Token Source Error: {:?}", error)
}
GcsError::InvalidRangeHeader(header) => {
make_err!(
Code::InvalidArgument,
"GCS Invalid Range Header: {:?}",
header
)
}
}
}
}

impl From<fred::error::Error> for Error {
fn from(error: fred::error::Error) -> Self {
use fred::error::ErrorKind::{
Expand Down
4 changes: 4 additions & 0 deletions nativelink-store/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,19 @@ rust_library(
"@crates//:filetime",
"@crates//:fred",
"@crates//:futures",
"@crates//:google-cloud-storage",
"@crates//:hex",
"@crates//:http-body",
"@crates//:hyper-0.14.31",
"@crates//:hyper-rustls",
"@crates//:lz4_flex",
"@crates//:parking_lot",
"@crates//:patricia_tree",
"@crates//:percent-encoding",
"@crates//:prost",
"@crates//:rand",
"@crates//:reqwest",
"@crates//:reqwest-middleware",
"@crates//:serde",
"@crates//:tokio",
"@crates//:tokio-stream",
Expand Down

0 comments on commit ad02579

Please sign in to comment.