Skip to content

Commit

Permalink
docs(sozo): update error message for more context (dojoengine#2005)
Browse files Browse the repository at this point in the history
docs: update error message for more context
  • Loading branch information
lambda-0x authored May 27, 2024
1 parent 492f5ae commit 03aefc3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 1 addition & 2 deletions bin/sozo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ fn main() {
let ui = Ui::new(args.ui_verbosity(), OutputFormat::Text);

if let Err(err) = cli_main(args) {
ui.error(format!("{err}"));
err.chain().skip(1).for_each(|clause| eprintln!("reason: {:?}", clause));
ui.anyhow(&err);
exit(1);
}
}
Expand Down
9 changes: 7 additions & 2 deletions crates/dojo-world/src/migration/strategy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ pub fn prepare_for_migration(
target_dir: &Utf8PathBuf,
diff: WorldDiff,
) -> Result<MigrationStrategy> {
let entries = fs::read_dir(target_dir)
.map_err(|err| anyhow!("Failed reading source directory: {err}"))?;
let entries = fs::read_dir(target_dir).with_context(|| {
format!(
"Failed trying to read target directory ({target_dir})\nNOTE: build files are profile \
specified so make sure to run build command with correct profile. For e.g. `sozo -P \
my_profile build`"
)
})?;

let mut artifact_paths = HashMap::new();
for entry in entries.flatten() {
Expand Down
5 changes: 2 additions & 3 deletions crates/sozo/ops/src/migration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ where
|e| {
ui.error(e.to_string());
anyhow!(
"\n Use `sozo clean` to clean your project, or `sozo clean --manifests-abis` \
to clean manifest and abi files only.\nThen, rebuild your project with `sozo \
build`.",
"\n Use `sozo clean` to clean your project.\nThen, rebuild your project with \
`sozo build`.",
)
},
)?;
Expand Down

0 comments on commit 03aefc3

Please sign in to comment.