diff --git a/app/buck2_data/error.proto b/app/buck2_data/error.proto index c5a7f514178a..30df0b5d9b1d 100644 --- a/app/buck2_data/error.proto +++ b/app/buck2_data/error.proto @@ -210,6 +210,15 @@ enum ErrorTag { RE_DATA_LOSS = 1315; RE_UNAUTHENTICATED = 1316; + // Dice Errors + // Value: https://fburl.com/code/5dxzaw41 + DICE_DUPLICATED_CHANGE = 1400; + DICE_CHANGED_TO_INVALID = 1401; + DICE_INJECTED_KEY_GOT_INVALIDATION = 1402; + DICE_CANCELLED = 1403; + DICE_UNEXPECTED_CYCLE_GUARD_TYPE = 1404; + DICE_DUPLICATE_ACTIVATION_DATA = 1405; + // Error during attribute configuration during target configuration. CONFIGURE_ATTR = 3001; // Action execution diff --git a/app/buck2_error/src/classify.rs b/app/buck2_error/src/classify.rs index a5967f7bcdab..7cb1db885491 100644 --- a/app/buck2_error/src/classify.rs +++ b/app/buck2_error/src/classify.rs @@ -117,6 +117,12 @@ pub(crate) fn category_and_rank(tag: ErrorTag) -> (Option, u32) { ErrorTag::HttpServer => rank!(tier0), ErrorTag::StarlarkInternal => rank!(tier0), ErrorTag::ActionMismatchedOutputs => rank!(tier0), + ErrorTag::DiceDuplicatedChange => rank!(tier0), + ErrorTag::DiceChangedToInvalid => rank!(tier0), + ErrorTag::DiceInjectedKeyGotInvalidation => rank!(tier0), + ErrorTag::DiceCancelled => rank!(tier0), + ErrorTag::DiceUnexpectedCycleGuardType => rank!(tier0), + ErrorTag::DiceDuplicateActivationData => rank!(tier0), ErrorTag::Environment => rank!(environment), ErrorTag::Tier0 => rank!(tier0), diff --git a/app/buck2_error/src/conversion/dice_error.rs b/app/buck2_error/src/conversion/dice_error.rs index da225ec05e71..deaaae3579fb 100644 --- a/app/buck2_error/src/conversion/dice_error.rs +++ b/app/buck2_error/src/conversion/dice_error.rs @@ -7,10 +7,29 @@ * of this source tree. */ +use dice_error::DiceErrorImpl; + +use crate::ErrorTag; + impl From for crate::Error { #[cold] #[track_caller] fn from(value: dice_error::DiceError) -> Self { - crate::conversion::from_any_with_tag(value, crate::ErrorTag::Tier0) + let error_tag = match *value.0 { + DiceErrorImpl::DuplicateChange(_) => ErrorTag::DiceDuplicatedChange, + DiceErrorImpl::ChangedToInvalid(_) => ErrorTag::DiceChangedToInvalid, + DiceErrorImpl::InjectedKeyGotInvalidation(_) => { + ErrorTag::DiceInjectedKeyGotInvalidation + } + // TODO(minglunli): Might be worth extracting the CancellationReason and create tags for those too + DiceErrorImpl::Cancelled(_) => ErrorTag::DiceCancelled, + DiceErrorImpl::UnexpectedCycleGuardType { + expected_type_name: _, + actual_type_name: _, + } => ErrorTag::DiceUnexpectedCycleGuardType, + DiceErrorImpl::DuplicateActivationData => ErrorTag::DiceDuplicateActivationData, + }; + + crate::conversion::from_any_with_tag(value, error_tag) } }