diff --git a/app/buck2_data/error.proto b/app/buck2_data/error.proto index 609335ba6c406..3bb2a454fbc21 100644 --- a/app/buck2_data/error.proto +++ b/app/buck2_data/error.proto @@ -138,6 +138,10 @@ enum ErrorTag { // Errors during buck2 install. INSTALL = 200; + INSTALLER_UNKNOWN = 2101; + INSTALLER_TIER0 = 2102; + INSTALLER_ENVIRONMENT = 2103; + INSTALLER_INPUT = 2104; //// High level descriptions of the "phase" of the build during which the // error occurred diff --git a/app/buck2_error/src/classify.rs b/app/buck2_error/src/classify.rs index 64f06b0e77c34..d6811bfd8c9a8 100644 --- a/app/buck2_error/src/classify.rs +++ b/app/buck2_error/src/classify.rs @@ -63,6 +63,7 @@ pub(crate) fn category_and_rank(tag: ErrorTag) -> (Option, u32) { ErrorTag::ServerStderrEmpty => rank!(environment), // Note: This is only true internally due to buckwrapper ErrorTag::NoBuckRoot => rank!(environment), + ErrorTag::InstallerEnvironment => rank!(environment), // Tier 0 errors ErrorTag::ServerJemallocAssert => rank!(tier0), @@ -123,6 +124,8 @@ pub(crate) fn category_and_rank(tag: ErrorTag) -> (Option, u32) { ErrorTag::DiceCancelled => rank!(tier0), ErrorTag::DiceUnexpectedCycleGuardType => rank!(tier0), ErrorTag::DiceDuplicateActivationData => rank!(tier0), + ErrorTag::InstallerUnknown => rank!(tier0), + ErrorTag::InstallerTier0 => rank!(tier0), ErrorTag::Environment => rank!(environment), ErrorTag::Tier0 => rank!(tier0), @@ -158,6 +161,7 @@ pub(crate) fn category_and_rank(tag: ErrorTag) -> (Option, u32) { ErrorTag::Analysis => rank!(input), ErrorTag::TestDeadlineExpired => rank!(input), ErrorTag::Unimplemented => rank!(input), + ErrorTag::InstallerInput => rank!(input), ErrorTag::Input => rank!(input), @@ -216,6 +220,9 @@ pub fn tag_is_hidden(tag: &ErrorTag) -> bool { ErrorTag::Tier0 => true, ErrorTag::Input => true, ErrorTag::Environment => true, + ErrorTag::InstallerTier0 => true, + ErrorTag::InstallerInput => true, + ErrorTag::InstallerEnvironment => true, _ => false, } } @@ -279,6 +286,7 @@ pub enum ErrorSourceArea { Watchman, Starlark, TestExecutor, + Installer, } pub fn source_area(tag: ErrorTag) -> ErrorSourceArea { @@ -293,6 +301,8 @@ pub fn source_area(tag: ErrorTag) -> ErrorSourceArea { ErrorSourceArea::Starlark } else if tag == crate::ErrorTag::Tpx || tag == crate::ErrorTag::TestExecutor { ErrorSourceArea::TestExecutor + } else if tag_name.starts_with("INSTALLER") { + ErrorSourceArea::Installer } else { ErrorSourceArea::Buck2 } diff --git a/app/buck2_server_commands/src/commands/install.rs b/app/buck2_server_commands/src/commands/install.rs index 5785d34319374..2a33e0b8b966e 100644 --- a/app/buck2_server_commands/src/commands/install.rs +++ b/app/buck2_server_commands/src/commands/install.rs @@ -799,18 +799,21 @@ async fn send_file( installer_log: install_log.to_owned(), } .into(); - if let Some(category) = + let category_tag = if let Some(category) = buck2_install_proto::ErrorCategory::from_i32(error_detail.category) { - if let Some(category_tag) = match category { - buck2_install_proto::ErrorCategory::Unspecified => None, - buck2_install_proto::ErrorCategory::Tier0 => Some(ErrorTag::Tier0), - buck2_install_proto::ErrorCategory::Input => Some(ErrorTag::Input), - buck2_install_proto::ErrorCategory::Environment => Some(ErrorTag::Environment), - } { - error = error.tag([category_tag]); + match category { + buck2_install_proto::ErrorCategory::Unspecified => ErrorTag::InstallerUnknown, + buck2_install_proto::ErrorCategory::Tier0 => ErrorTag::InstallerTier0, + buck2_install_proto::ErrorCategory::Input => ErrorTag::InstallerInput, + buck2_install_proto::ErrorCategory::Environment => { + ErrorTag::InstallerEnvironment + } } - } + } else { + ErrorTag::InstallerUnknown + }; + error = error.tag([category_tag]); for tag in error_detail.tags { error = error.context_for_key(&tag);