Skip to content
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

Rework remaining errors #344

Merged
merged 13 commits into from
Apr 22, 2019

Conversation

charlespierce
Copy link
Contributor

@charlespierce charlespierce commented Apr 9, 2019

Closes #296
Closes #298
Closes #299
Closes #300
Closes #305
Closes #343

Info

  • Several of the modules are interconnected and updating the errors in the fs module led to updating many of the other modules.

Changes

  • Refactored the fs module to not use .unknown() but instead return an io::Error, as they are still IO utilities.
  • Updated distro module to convert .unknown() into .with_context()
  • Updated hook module to convert .unknown() into .with_context()
  • Updated inventory module to convert .unknown() into .with_context()
  • Updated toolchain module to convert .unknown() into .with_context()

Notes

  • There is a lot of duplication in Read / Write errors. It is a common pattern to call path.to_string_lossy().to_string() to convert a Path / PathBuf to a string. I'm not sure the best approach to refactor that to prevent having that same block appear in multiple places.

@charlespierce charlespierce force-pushed the rework_remaining_errors branch from 80cd3b5 to 5c44660 Compare April 11, 2019 21:04
@charlespierce charlespierce marked this pull request as ready for review April 11, 2019 21:04
@charlespierce charlespierce force-pushed the rework_remaining_errors branch from b5c36c9 to a87c01a Compare April 12, 2019 06:11
Copy link
Contributor

@chriskrycho chriskrycho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple small changes – most of the comments here are things we should defer to a cleanup PR so we can land this one and not block other things any longer.

crates/notion-core/src/distro/package.rs Show resolved Hide resolved
crates/notion-core/src/distro/yarn.rs Show resolved Hide resolved
crates/notion-core/src/distro/yarn.rs Show resolved Hide resolved
crates/notion-core/src/error/details.rs Show resolved Hide resolved
crates/notion-core/src/error/details.rs Outdated Show resolved Hide resolved
crates/notion-core/src/inventory/mod.rs Show resolved Hide resolved
crates/notion-core/src/inventory/mod.rs Show resolved Hide resolved
crates/notion-core/src/inventory/mod.rs Show resolved Hide resolved
crates/notion-core/src/inventory/mod.rs Show resolved Hide resolved
crates/notion-core/src/toolchain/mod.rs Outdated Show resolved Hide resolved
@charlespierce
Copy link
Contributor Author

Updated to address most of the comments, still investigating passing an owned PathBuf to the error object, instead of a String.

@charlespierce charlespierce merged commit f6f2d00 into volta-cli:master Apr 22, 2019
@charlespierce charlespierce deleted the rework_remaining_errors branch April 22, 2019 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants