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

core: add fs_err dependency #363

Merged
merged 1 commit into from
Oct 4, 2020
Merged

core: add fs_err dependency #363

merged 1 commit into from
Oct 4, 2020

Conversation

tony-iqlusion
Copy link
Member

The fs_err crate is a drop-in replacement for std:::fs with zero transitive dependencies which provides error messages that include the filename in addition to the failing operation:

https://github.com/andrewhickman/fs-err

This commit re-exports it as abscissa_core::fs and uses it to implement all framework-level filesystem operations.

Example

let file = File::open("does not exist.txt")?;

std::fs::File error message

The system cannot find the file specified. (os error 2)

fs_err::File error message

failed to open file `does not exist.txt`
    caused by: The system cannot find the file specified. (os error 2)

cc @yaahc

The `fs_err` crate is a drop-in replacement for `std:::fs` with zero
transitive dependencies which provides error messages that include the
filename in addition to the failing operation, e.g.

std::fs::File:

    The system cannot find the file specified. (os error 2)

fs_err::File:

    failed to open file `does not exist.txt`
      caused by: The system cannot find the file specified. (os error 2)
@tony-iqlusion
Copy link
Member Author

Additional questions: should it be added to the prelude?

@yaahc
Copy link

yaahc commented Sep 30, 2020

@tony-iqlusion I think in theory adding it to the prelude could be a breaking change though its hard to imagine anyone would write code that triggers the issue. In theory tho i think this might fail to compile:

use std::*;
use abscissa::prelude::*; // error ambiguous `fs`

@tony-iqlusion
Copy link
Member Author

Yeah, good point. I plan on starting to make breaking changes soon, but it might be good to make one more maintenance release before that.

@tony-iqlusion tony-iqlusion merged commit bee6525 into develop Oct 4, 2020
@tony-iqlusion tony-iqlusion deleted the fs_err branch October 4, 2020 23:26
@tony-iqlusion tony-iqlusion mentioned this pull request Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants