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

Error refactoring #130

Closed
wants to merge 5 commits into from
Closed

Error refactoring #130

wants to merge 5 commits into from

Conversation

arkanoider
Copy link
Collaborator

Hi @grunch ,

putting here as an example of possible refactoring idea based on the blog article I shared on telegram:

https://sabrinajewson.org/blog/errors

I like the idea inside seems more elegant also if it's a required an effort in code and many calls to map_err when we can have a Result.

Putting here this as draft to share what could be te result, now settings.rs has some refactoring i did and results of error are now like this:

mostrod.exe -d c:\mostroSettings
Error: error reading `c:\mostroSettings\`

Caused by:
    expected an equals, found a newline at line 18 column 4 in ..\..\..\..\mostroSettings\settings.dev.toml

or

Error: error reading `H:\.mostro\`

Caused by:
    Forbidden access. (os error 5)

The approach is to avoid a big enum file and distribute errors in relative file, creating more specialized ones.

This will remove also anyhow crate.

Let me know what you think about...

@arkanoider arkanoider closed this Oct 26, 2023
@arkanoider arkanoider deleted the error-new branch October 26, 2023 13:37
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.

1 participant