-
Notifications
You must be signed in to change notification settings - Fork 411
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
Improve UX for pack and publish path expectations #198
Changes from 1 commit
840c7bd
035bcbe
ec17b8a
8efabfa
b57d68f
a67762a
63c91ca
ac34e7b
e6cd7bb
ce77e5c
28d5bb5
88fdbc5
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 |
---|---|---|
|
@@ -9,7 +9,15 @@ pub fn pack(path: Option<String>, log: &Logger) -> result::Result<(), Error> { | |
let crate_path = set_crate_path(path); | ||
|
||
info!(&log, "Packing up the npm package..."); | ||
npm::npm_pack(&crate_path)?; | ||
match npm::npm_pack(&crate_path) { | ||
Ok(r) => r, | ||
Err(Error::Io { .. }) => { | ||
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. I think this match is too broad. I only want to catch os error 2: directory not found. I don't want to swallow other IO errors. Investigate how to do that. |
||
return Err(Error::DirNotFound { | ||
message: "Unable to find the pkg directory".to_owned(), | ||
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. Should this be more specific? Should it also print the path that the user entered? Not sure yet. |
||
}); | ||
} | ||
Err(e) => return Err(e), | ||
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. These explicit 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. I should try something like this instead: my_function_call().map_err(|e| match {
interesting_error => something_else,
stuff => stuff,
})? |
||
}; | ||
#[cfg(not(target_os = "windows"))] | ||
info!(&log, "Your package is located at {}/pkg", &crate_path); | ||
#[cfg(target_os = "windows")] | ||
|
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.
This should probably just be
Ok(r) => (),