aboutsummaryrefslogtreecommitdiffstats
path: root/src/errors.rs
AgeCommit message (Collapse)Author
2018-10-22trial: Add a function to initialise a trial timestamp in a fileTeddy Wing
Save an encoded timestamp to a file. This function should be run once if no trial file is found. The encoded timestamp can then be read on subsequent launches to determine whether the trial period is still in effect. Also add a few function stubs for other actions that seem relevant.
2018-10-22decode_datetime(): Return a `Result`Teddy Wing
Make a custom error type because it's trickier to integrate with 'error-chain' given that 'magic-crypt''s `Error` type doesn't implement the `std::error::Error` trait. For the same reason, we can't use that as the `cause` for `DateCryptError::Decrypt`. This allows us to capture the errors without panicking. Include some additional cleanups as a result of removing the `use std::result` and `use errors::*` imports.
2018-10-21Add `trial` module, calculate days remainingTeddy Wing
This new module will contain functions to calculate trial days. Here we implement a function to calculate the days remaining in a trial period. If there are less than 0 days remaining, it returns an error result. Couldn't use 'error-chain' because it was complaining about `Debug` and `PartialEq` not being defined. Don't know if it's possible to implement those traits on 'error-chain''s ErrorKind`, but it was complicated enough that I ended up not bothering. Went with 'quick_error' instead to create a custom error type without having to `impl` all the required traits.
2018-10-20read_config_file(): Update to get the config from `config.toml`Teddy Wing
Use XDG handling from `state_load_map_group()` to do basically the same thing here for reading the config from a `config.toml` file. Use 'error-chain' to handle the `Result`s more easily. No more nested pattern matching, we'll just have to unwrap one `Result` and write the error to stderr in an FFI function.