mysql_replication/
error.rs1#[derive(Debug, thiserror::Error)]
2pub enum Error {
3 #[error("source failure: {0}")]
4 Sources(String),
5 #[error("sink failure: {0}")]
6 Sink(String),
7 #[error("truncated input: need {need} bytes, have {have}")]
8 Truncated { need: usize, have: usize },
9 #[error("invalid binlog: {0}")]
10 Invalid(String),
11 #[error("unsupported: {0}")]
12 Unsupported(String),
13 #[error("schema mismatch: {0}")]
14 Schema(String),
15 #[error("missing or NULL primary key")]
16 MissingPrimaryKey,
17 #[error("table id {0} has no TABLE_MAP in this statement")]
18 MissingTable(u64),
19 #[error("CRC32 checksum mismatch")]
20 Checksum,
21 #[error("transaction exceeds configured {0}-byte memory budget")]
22 TransactionLimit(usize),
23 #[error("DDL/statement encountered; stop and migrate the schema snapshot: {0}")]
24 Statement(String),
25 #[error(transparent)]
26 Io(#[from] std::io::Error),
27 #[error(transparent)]
28 Mysql(#[from] mysql::Error),
29 #[error(transparent)]
30 Json(#[from] serde_json::Error),
31 #[error(transparent)]
32 Toml(#[from] toml::de::Error),
33 #[error(transparent)]
34 Utf8(#[from] std::str::Utf8Error),
35}
36
37pub type Result<T> = std::result::Result<T, Error>;
38
39pub(crate) fn invalid(message: impl Into<String>) -> Error {
40 Error::Invalid(message.into())
41}