forked from projectmoon/tenebrous-dicebot
Document the From trait on the DataError type.
This commit is contained in:
parent
114c879c6f
commit
2ee8ae2e34
|
@ -44,6 +44,12 @@ pub enum DataError {
|
||||||
UnabortableTransactionError(#[from] UnabortableTransactionError),
|
UnabortableTransactionError(#[from] UnabortableTransactionError),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// This From implementation is necessary to deal with the recursive
|
||||||
|
/// error type in the error enum. We defined a transaction error, but
|
||||||
|
/// the only place we use it is when converting from
|
||||||
|
/// sled::transaction::TransactionError<DataError>. This converter
|
||||||
|
/// extracts the inner data error from transaction aborted errors, and
|
||||||
|
/// forwards anything else onward as-is, but wrapped in DataError.
|
||||||
impl From<TransactionError<DataError>> for DataError {
|
impl From<TransactionError<DataError>> for DataError {
|
||||||
fn from(error: TransactionError<DataError>) -> Self {
|
fn from(error: TransactionError<DataError>) -> Self {
|
||||||
match error {
|
match error {
|
||||||
|
|
Loading…
Reference in New Issue