-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ensure metadata loading errors are correctly logged #2149
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ | |
self.tag_or_address | ||
} else { | ||
let ws = scarb::ops::read_workspace(config.manifest_path(), config)?; | ||
let default_namespace = get_default_namespace_from_ws(&ws); | ||
let default_namespace = get_default_namespace_from_ws(&ws)?; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM! Consider adding error context for better debugging. The addition of the let default_namespace = get_default_namespace_from_ws(&ws).context("Failed to get default namespace from workspace")?; |
||
ensure_namespace(&self.tag_or_address, &default_namespace) | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,7 @@ pub fn setup_migration(config: &Config) -> Result<MigrationStrategy> { | |
let base_dir = manifest_path.parent().unwrap(); | ||
let target_dir = format!("{}/target/dev", base_dir); | ||
|
||
let default_namespace = get_default_namespace_from_ws(&ws); | ||
let default_namespace = get_default_namespace_from_ws(&ws).unwrap(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a meaningful error message. Using let default_namespace = get_default_namespace_from_ws(&ws).expect("Failed to get default namespace from workspace"); |
||
|
||
prepare_migration_with_world_and_seed( | ||
base_dir.into(), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ async fn test_entities_queries() { | |
|
||
let target_path = ws.target_dir().path_existent().unwrap().join(config.profile().to_string()); | ||
|
||
let default_namespace = get_default_namespace_from_ws(&ws); | ||
let default_namespace = get_default_namespace_from_ws(&ws).unwrap(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a meaningful error message. Using let default_namespace = get_default_namespace_from_ws(&ws).expect("Failed to get default namespace from workspace"); |
||
|
||
let mut migration = prepare_migration( | ||
config.manifest_path().parent().unwrap().into(), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Consider adding error context for better debugging.
The addition of the
?
operator ensures that errors are propagated correctly. However, adding context to the error can help with debugging.