wesichain_checkpoint_sql/
error.rs1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum CheckpointSqlError {
5 #[error("checkpoint SQL connection error: {0}")]
6 Connection(#[source] sqlx::Error),
7 #[error("checkpoint SQL migration error: {0}")]
8 Migration(#[source] sqlx::Error),
9 #[error("checkpoint SQL serialization error: {0}")]
10 Serialization(#[source] serde_json::Error),
11 #[error("checkpoint SQL query error: {0}")]
12 Query(#[source] sqlx::Error),
13 #[error("checkpoint SQL projection error: {0}")]
14 Projection(String),
15 #[error("SQL checkpoint operation is not implemented")]
16 NotImplemented,
17}
18
19impl From<sqlx::Error> for CheckpointSqlError {
20 fn from(source: sqlx::Error) -> Self {
21 Self::Query(source)
22 }
23}
24
25impl From<serde_json::Error> for CheckpointSqlError {
26 fn from(source: serde_json::Error) -> Self {
27 Self::Serialization(source)
28 }
29}