-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal: add error context for n2 db processing (#261)
- Loading branch information
1 parent
36b7672
commit 95c6fb2
Showing
5 changed files
with
22 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
// | ||
// For inquiries, you can contact us via e-mail at [email protected]. | ||
|
||
use anyhow::{bail, Ok}; | ||
use anyhow::{bail, Context, Ok}; | ||
use moonutil::common::TargetBackend::*; | ||
use moonutil::module::ModuleDB; | ||
use moonutil::package::{JsFormat, Package}; | ||
|
@@ -443,7 +443,9 @@ pub fn gen_n2_build_state( | |
} | ||
|
||
let mut hashes = n2graph::Hashes::default(); | ||
let db = n2::db::open(&target_dir.join("build.moon_db"), &mut graph, &mut hashes)?; | ||
let n2_db_path = &target_dir.join("build.moon_db"); | ||
let db = n2::db::open(n2_db_path, &mut graph, &mut hashes) | ||
.with_context(|| format!("failed to process n2 db: {}", n2_db_path.display()))?; | ||
|
||
Ok(State { | ||
graph, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
// | ||
// For inquiries, you can contact us via e-mail at [email protected]. | ||
|
||
use anyhow::bail; | ||
use anyhow::{bail, Context}; | ||
use indexmap::IndexMap; | ||
use moonutil::module::ModuleDB; | ||
use moonutil::package::Package; | ||
|
@@ -306,7 +306,9 @@ pub fn gen_n2_bundle_state( | |
let default = graph.get_start_nodes(); | ||
|
||
let mut hashes = n2graph::Hashes::default(); | ||
let db = n2::db::open(&target_dir.join("build.moon_db"), &mut graph, &mut hashes)?; | ||
let n2_db_path = &target_dir.join("build.moon_db"); | ||
let db = n2::db::open(n2_db_path, &mut graph, &mut hashes) | ||
.with_context(|| format!("failed to process n2 db: {}", n2_db_path.display()))?; | ||
|
||
Ok(State { | ||
graph, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
// | ||
// For inquiries, you can contact us via e-mail at [email protected]. | ||
|
||
use anyhow::{bail, Ok}; | ||
use anyhow::{bail, Context, Ok}; | ||
use colored::Colorize; | ||
use moonutil::common::{DriverKind, GeneratedTestDriver, MOONBITLANG_CORE}; | ||
use moonutil::module::ModuleDB; | ||
|
@@ -917,11 +917,9 @@ pub fn gen_n2_runtest_state( | |
} | ||
|
||
let mut hashes = n2graph::Hashes::default(); | ||
let db = n2::db::open( | ||
&moonbuild_opt.target_dir.join("build.moon_db"), | ||
&mut graph, | ||
&mut hashes, | ||
)?; | ||
let n2_db_path = &moonbuild_opt.target_dir.join("build.moon_db"); | ||
let db = n2::db::open(n2_db_path, &mut graph, &mut hashes) | ||
.with_context(|| format!("failed to process n2 db: {}", n2_db_path.display()))?; | ||
|
||
Ok(State { | ||
graph, | ||
|