This commit is contained in:
ryneeverett
2023-01-15 17:00:03 -05:00
committed by Dustin J. Mitchell
parent 2f7196dbfc
commit 725dab681f
2 changed files with 10 additions and 10 deletions

View File

@@ -5,8 +5,8 @@ use thiserror::Error;
#[non_exhaustive] #[non_exhaustive]
/// Errors returned from taskchampion operations /// Errors returned from taskchampion operations
pub enum Error { pub enum Error {
/// A crypto-related error /// A server-related error
#[error("Crypto Error: {0}")] #[error("Server Error: {0}")]
Server(String), Server(String),
/// A task-database-related error /// A task-database-related error
#[error("Task Database Error: {0}")] #[error("Task Database Error: {0}")]
@@ -17,7 +17,7 @@ pub enum Error {
#[error("Local replica is out of sync with the server")] #[error("Local replica is out of sync with the server")]
OutOfSync, OutOfSync,
/// A usage error /// A usage error
#[error("User Error: {0}")] #[error("Usage Error: {0}")]
Usage(String), Usage(String),
/// A general error. /// A general error.
#[error(transparent)] #[error(transparent)]
@@ -25,7 +25,7 @@ pub enum Error {
} }
/// Convert private and third party errors into Error::Other. /// Convert private and third party errors into Error::Other.
macro_rules! convert_error { macro_rules! other_error {
( $error:ty ) => { ( $error:ty ) => {
impl From<$error> for Error { impl From<$error> for Error {
fn from(err: $error) -> Self { fn from(err: $error) -> Self {
@@ -34,10 +34,10 @@ macro_rules! convert_error {
} }
}; };
} }
convert_error!(ureq::Error); other_error!(ureq::Error);
convert_error!(io::Error); other_error!(io::Error);
convert_error!(serde_json::Error); other_error!(serde_json::Error);
convert_error!(rusqlite::Error); other_error!(rusqlite::Error);
convert_error!(crate::storage::sqlite::SqliteError); other_error!(crate::storage::sqlite::SqliteError);
pub type Result<T> = std::result::Result<T, Error>; pub type Result<T> = std::result::Result<T, Error>;

View File

@@ -10,7 +10,7 @@ use uuid::Uuid;
pub(super) struct SnapshotTasks(Vec<(Uuid, TaskMap)>); pub(super) struct SnapshotTasks(Vec<(Uuid, TaskMap)>);
impl Serialize for SnapshotTasks { impl Serialize for SnapshotTasks {
fn serialize<'a, S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where where
S: Serializer, S: Serializer,
{ {