Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fs: add new error type #792

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

Merged
nicholasbishop merged 3 commits into rust-osdev:main from phip1611:fs-err
May 9, 2023
Merged

fs: add new error type #792

nicholasbishop merged 3 commits into rust-osdev:main from phip1611:fs-err
May 9, 2023

Conversation

Copy link
Member

@phip1611 phip1611 commented May 6, 2023
edited
Loading

In #472 I added an initial version of a file-system error type. I did not really like it. Therefore, this MR adds a new type which adds much more context to errors. I think, the new abstraction is helpful - yet kind of feature-creep 😁

What do you think?

Hints for Review

Changelog update is not needed I think, as none of the fs-related code is published yet.

Checklist

  • Sensible git history (for example, squash "typo" or "fix" commits). See the Rewriting History guide for help.
  • Update the changelog (if necessary)

nicholasbishop reacted with thumbs up emoji
@phip1611 phip1611 force-pushed the fs-err branch 4 times, most recently from e5203be to d6c05e6 Compare May 6, 2023 19:08
@phip1611 phip1611 marked this pull request as ready for review May 6, 2023 19:10
Copy link
Member Author

phip1611 commented May 6, 2023
edited
Loading

@nicholasbishop this is now ready for review - what do you think? Is this helpful or overengineered?

Copy link
Member

@nicholasbishop nicholasbishop left a comment

Choose a reason for hiding this comment

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

Splitting up the error type looks good to me. Left a couple minor suggestions


/// Logical errors when working with files.
#[derive(Debug, Clone, Display, PartialEq, Eq)]
pub enum LogicError {
Copy link
Member

@nicholasbishop nicholasbishop May 7, 2023

Choose a reason for hiding this comment

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

I think the LogicError variants should be merged into the IoError variants to simplify a bit (and that matches how std::io::ErrorKind works)

Copy link
Member Author

@phip1611 phip1611 May 7, 2023

Choose a reason for hiding this comment

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

I didn't know about std::io::ErrorKind, interesting!

/// UEFI-error with context when working with the underlying UEFI file protocol.
#[derive(Debug, Clone, Display, PartialEq, Eq)]
#[display(fmt = "FileSystemIOError({},{})", context, path)]
pub struct FileSystemIOError {
Copy link
Member

@nicholasbishop nicholasbishop May 7, 2023

Choose a reason for hiding this comment

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

Naming nit: since this is already in the fs module, I think we can drop the FileSystem prefix from this and FileSystemIOErrorContext.

Also, per https://rust-lang.github.io/api-guidelines/naming.html, acronyms a treated as a word for capitalization, so IoError instead of IOError.

Copy link
Member Author

@phip1611 phip1611 May 7, 2023

Choose a reason for hiding this comment

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

Thanks! I've updated the PR

Copy link
Member

Just making sure you saw -- CI failed. (Also there's an a commit that was probably meant to be squashed.)

@nicholasbishop nicholasbishop merged commit 023b08d into rust-osdev:main May 9, 2023
@phip1611 phip1611 deleted the fs-err branch May 25, 2023 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@nicholasbishop nicholasbishop nicholasbishop approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /