Skip to content

Commit

Permalink
Relocate Rust error types (D-E)
Browse files Browse the repository at this point in the history
Summary:
This diff is part of the codemod for {D54514896}.

Generated using the code in P1194050452 and the procedure from D54694062.

Reviewed By: emersonford

Differential Revision: D54708165

fbshipit-source-id: 929afd88440fa0f06e82236debf1c55416c472a2
  • Loading branch information
David Tolnay authored and facebook-github-bot committed Mar 9, 2024
1 parent 4b95a3f commit 63e038b
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 31 deletions.
2 changes: 1 addition & 1 deletion eden/fs/cli_rs/edenfs-client/src/checkout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ use serde::Serializer;
use strum::EnumString;
use strum::EnumVariantNames;
use strum::VariantNames;
use thrift_types::edenfs::errors::eden_service::PrefetchFilesError;
use thrift_types::edenfs::types::GlobParams;
use thrift_types::edenfs::types::MountInfo;
use thrift_types::edenfs::types::MountState;
use thrift_types::edenfs::types::PredictiveFetch;
use thrift_types::edenfs::types::PrefetchParams;
use thrift_types::edenfs_clients::errors::PrefetchFilesError;
use thrift_types::fbthrift::ApplicationExceptionErrorCode;
use toml::value::Value;
use uuid::Uuid;
Expand Down
2 changes: 1 addition & 1 deletion eden/fs/cli_rs/edenfs-client/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use edenfs_utils::strip_unc_prefix;
use fbinit::expect_init;
use fbthrift_socket::SocketTransport;
#[cfg(fbcode_build)]
use thrift_streaming::streaming_eden_service::StreamStartStatusError;
use thrift_streaming_clients::errors::StreamStartStatusError;
#[cfg(fbcode_build)]
use thrift_streaming_thriftclients::build_StreamingEdenService_client;
use thrift_types::edenfs::types::DaemonInfo;
Expand Down
4 changes: 2 additions & 2 deletions eden/fs/cli_rs/edenfs-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ use std::sync::Arc;

use futures::stream::BoxStream;
#[cfg(fbcode_build)]
use thrift_streaming::errors::streaming_eden_service::StreamStartStatusStreamError;
#[cfg(fbcode_build)]
use thrift_streaming::types::EdenStartStatusUpdate;
#[cfg(fbcode_build)]
use thrift_streaming_clients::errors::StreamStartStatusStreamError;
#[cfg(fbcode_build)]
use thrift_streaming_clients::StreamingEdenService;
use thrift_types::edenfs_clients::EdenService;

Expand Down
1 change: 0 additions & 1 deletion eden/mononoke/hooks/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ rust_library(
"//infrasec/authorization/if:if-aclchecker-rust",
"//infrasec/authorization/if:if-aclchecker-rust-clients",
"//infrasec/authorization/if:if-aclchecker-rust-srclients",
"//infrasec/authorization/if:if-service-rust",
"//infrasec/authorization/if:if-service-rust-clients",
"//infrasec/authorization/if:if-service-rust-srclients",
"//security/source_control/verify_integrity:verify_integrity_client_lib",
Expand Down
4 changes: 2 additions & 2 deletions eden/mononoke/land_service/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use anyhow::Error;
use bookmarks_movement::describe_hook_rejections;
use bookmarks_movement::BookmarkMovementError;
use bookmarks_movement::HookRejection;
use land_service_if::services::land_service::LandChangesetsExn;
use land_service_if::InternalError;
use land_service_if_services::errors::LandChangesetsExn;
use mononoke_api::MononokeError;
use pushrebase::PushrebaseConflict;
use pushrebase::PushrebaseError;
Expand Down Expand Up @@ -66,7 +66,7 @@ impl From<LandChangesetsError> for LandChangesetsExn {
fn from(e: LandChangesetsError) -> LandChangesetsExn {
match e {
LandChangesetsError::InternalError(e) => {
land_service_if::services::land_service::LandChangesetsExn::internal_error(e)
land_service_if_services::errors::LandChangesetsExn::internal_error(e)
}
LandChangesetsError::HookRejections(rejections) => {
LandChangesetsExn::hook_rejections(land_service_if::HookRejectionsException {
Expand Down
6 changes: 3 additions & 3 deletions eden/mononoke/land_service/src/facebook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use std::sync::Arc;

use async_trait::async_trait;
use fb303_core::fb303_status;
use fb303_core::services::base_service::GetNameExn;
use fb303_core::services::base_service::GetStatusDetailsExn;
use fb303_core::services::base_service::GetStatusExn;
use fb303_core_services::errors::GetNameExn;
use fb303_core_services::errors::GetStatusDetailsExn;
use fb303_core_services::errors::GetStatusExn;
use fb303_core_services::BaseService;

#[derive(Clone)]
Expand Down
2 changes: 1 addition & 1 deletion eden/mononoke/land_service/src/land_service_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use async_trait::async_trait;
use futures::channel::oneshot;
use futures::future::BoxFuture;
use futures::future::Shared;
use land_service_if::services::land_service::LandChangesetsExn;
use land_service_if::types::*;
use land_service_if_services::errors::LandChangesetsExn;
use land_service_if_services::LandService;
use mononoke_api::CoreContext;
use parking_lot::Mutex;
Expand Down
4 changes: 2 additions & 2 deletions eden/mononoke/pushrebase/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ rust_library(
name = "pushrebase_client",
srcs = glob(["client/**/*.rs"]),
autocargo = {"cargo_toml_dir": "client"},
deps = [
deps = ([
"fbsource//third-party/rust:async-trait",
"fbsource//third-party/rust:bytes",
"//common/rust/smc-thrift:smc-thrift",
Expand All @@ -115,5 +115,5 @@ rust_library(
"fbsource//third-party/rust:arc-swap",
"fbsource//third-party/rust:regex",
"//eden/mononoke/repo_attributes/repo_identity:repo_identity",
]),
])) + ["//eden/mononoke/land_service/if:land_service_if-rust-clients"],
)
2 changes: 1 addition & 1 deletion eden/mononoke/scs_server/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use git_types::GitError;
use megarepo_error::MegarepoError;
use mononoke_api::MononokeError;
use source_control as thrift;
use source_control::services::source_control_service as service;
use source_control_services::errors::source_control_service as service;

pub(crate) enum ServiceError {
Request(thrift::RequestError),
Expand Down
6 changes: 3 additions & 3 deletions eden/mononoke/scs_server/src/facebook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use std::sync::Arc;

use async_trait::async_trait;
use fb303_core::fb303_status;
use fb303_core::services::base_service::GetNameExn;
use fb303_core::services::base_service::GetStatusDetailsExn;
use fb303_core::services::base_service::GetStatusExn;
use fb303_core_services::errors::GetNameExn;
use fb303_core_services::errors::GetStatusDetailsExn;
use fb303_core_services::errors::GetStatusExn;
use fb303_core_services::BaseService;

#[derive(Clone)]
Expand Down
2 changes: 1 addition & 1 deletion eden/mononoke/scs_server/src/methods/repo/land_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use mononoke_api::MononokeError;
use pushrebase::PushrebaseConflict;
use service::RepoLandStackExn;
use source_control as thrift;
use source_control::services::source_control_service as service;
use source_control_services::errors::source_control_service as service;

use crate::commit_id::CommitIdExt;
use crate::errors;
Expand Down
2 changes: 1 addition & 1 deletion eden/mononoke/scs_server/src/source_control_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ use scuba_ext::MononokeScubaSampleBuilder;
use scuba_ext::ScubaValue;
use slog::Logger;
use source_control as thrift;
use source_control::services::source_control_service as service;
use source_control_services::errors::source_control_service as service;
use source_control_services::SourceControlService;
use srserver::RequestContext;
use stats::prelude::*;
Expand Down
24 changes: 12 additions & 12 deletions eden/scm/lib/clidispatch/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use configmodel::Config;
use configmodel::ConfigExt;
use thiserror::Error;
#[cfg(feature = "eden")]
use thrift_types::edenfs as eden;
use thrift_types::edenfs_clients as eden_clients;

#[derive(Debug, Error)]
#[error("cannot decode arguments")]
Expand Down Expand Up @@ -79,9 +79,7 @@ pub fn print_error(err: &anyhow::Error, io: &crate::io::IO, _args: &[String]) {
} else {
#[cfg(feature = "eden")]
{
if let Some(eden::errors::eden_service::GetScmStatusV2Error::ex(e)) =
err.downcast_ref::<eden::errors::eden_service::GetScmStatusV2Error>()
{
if let Some(eden_clients::errors::GetScmStatusV2Error::ex(e)) = err.downcast_ref() {
let _ = io.write_err(format!("abort: {}\n", e.message));
let _ = io.flush();
return;
Expand Down Expand Up @@ -164,6 +162,9 @@ pub fn triage_error(
mod tests {
use std::io::Cursor;

#[cfg(feature = "eden")]
use thrift_types::edenfs as eden;

use super::*;

#[test]
Expand All @@ -172,14 +173,13 @@ mod tests {
let error_msg = "cannot compute status while a checkout is currently in progress";
let expected_error = format!("abort: {}\n", error_msg);

let error: anyhow::Error =
eden::errors::eden_service::GetScmStatusV2Error::ex(eden::EdenError {
message: error_msg.to_string(),
errorCode: Some(255),
errorType: eden::EdenErrorType::CHECKOUT_IN_PROGRESS,
..Default::default()
})
.into();
let error: anyhow::Error = eden_clients::errors::GetScmStatusV2Error::ex(eden::EdenError {
message: error_msg.to_string(),
errorCode: Some(255),
errorType: eden::EdenErrorType::CHECKOUT_IN_PROGRESS,
..Default::default()
})
.into();

let tin = Cursor::new(Vec::new());
let tout = Cursor::new(Vec::new());
Expand Down

0 comments on commit 63e038b

Please sign in to comment.