-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Enh/blank startup #126
base: main
Are you sure you want to change the base?
Enh/blank startup #126
Conversation
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.
Thank you for this PR, it’s a good idea.
src/application/environment.rs
Outdated
match std::fs::File::create(file_path){ | ||
Ok(_) => {}, | ||
Err(err) => { | ||
log::error!("Unable to create {} because {}",file_path, err); |
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.
Errors shouldn’t be treated here but reported to caller.
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.
I am reporting these errors back up with a Result<(), std::io::Error>
to the Environment
constructor now, and the constructor logs an error if there are any initialization problems. I'll hold off on resolving this in case we need to bubble this up any further
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.
The constructor can return a Result
and let the main function deals with error.
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.
Thanks for the feedback, will work on this when I get a chance...if it were to return an Error to the caller in main()
should we panic at that point? Or is there someway to recover from this (fallback todo.txt and done.txt for example)?
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.
Unwrapping this in main, let me know your thoughts though
…ntialization now returns a Result so the caller can decide how to handle errors
… case of issues accessing todo.txt and done.txt
… can be accessed from main, removed new from update_tasks function, app now uses one instance of Environment for everything
Environment constructor now returns a Result so the caller can handle initialization issues
…le is already set to something non-default
…ent' for it's Model
…d do not leave any artifacts on the file system
@@ -18,6 +18,8 @@ regex = "^1.0" | |||
relm = "0.24" | |||
relm-derive = "0.24" | |||
xdg = "2.1" | |||
dirs = "4.0.0" | |||
mktemp = "0.5.0" |
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.
You should add dev dependencies in the [dev-depedencies] section.
Description
Handles default initialization for an empty environment (never used effitask or todo.sh before)
Checklist
Thanks for contributing!