Skip to content

Commit

Permalink
Categorize eval/load errors as Input
Browse files Browse the repository at this point in the history
Summary:
Looks like `DiceCalculationDelegateError` type never bubble up in error categorization, although its error strings are associated with `ANALYSIS` error tags, I'm honestly not too sure what's going on, but I assume it's some Starlark magic, but regardless, tagging this as Input seems right

And `LoadCycleError` always seem like an input error so categorizing it as such

Reviewed By: cjhopman

Differential Revision: D69254527

fbshipit-source-id: 7500113c803a07e073d5dd1da9a6074cc1efa568
  • Loading branch information
Will-MingLun-Li authored and facebook-github-bot committed Feb 7, 2025
1 parent d8b3197 commit 53f4592
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 2 additions & 3 deletions app/buck2_interpreter_for_build/src/interpreter/cycles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ pub enum LoadCycleKey {
Module(OwnedStarlarkModulePath),
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, buck2_error::Error)]
#[buck2(tag = Input)]
pub struct LoadCycleError {
cycle: Arc<Vec<OwnedStarlarkModulePath>>,
}

impl std::error::Error for LoadCycleError {}

impl Display for LoadCycleError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
writeln!(f, "Load cycle detected (`->` means \"loads\"):")?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use buck2_core::build_file_path::BuildFilePath;
use buck2_core::cells::build_file_cell::BuildFileCell;
use buck2_core::cells::name::CellName;
use buck2_core::package::PackageLabel;
use buck2_error::conversion::from_any_with_tag;
use buck2_error::internal_error;
use buck2_error::BuckErrorContext;
use buck2_events::dispatch::span;
Expand Down Expand Up @@ -64,7 +63,7 @@ use crate::interpreter::interpreter_for_cell::ParseResult;
use crate::super_package::package_value::SuperPackageValuesImpl;

#[derive(Debug, buck2_error::Error)]
#[buck2(tag = Tier0)]
#[buck2(tag = Input)]
enum DiceCalculationDelegateError {
#[error("Error evaluating build file: `{0}`")]
EvalBuildFileError(BuildFilePath),
Expand Down Expand Up @@ -200,8 +199,7 @@ impl<'c, 'd: 'c> DiceCalculationDelegate<'c, 'd> {
.guard_this(Self::eval_deps(self.ctx, &imports))
.await
.into_result(self.ctx)
.await?
.map_err(|e| from_any_with_tag(e, buck2_error::ErrorTag::Tier0))??;
.await???;
Ok((ast, deps))
}

Expand Down

0 comments on commit 53f4592

Please sign in to comment.