forked from ankurah/ankurah
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ankurah#1 from synestheticsystems/model
Split Record into Record/ScopedRecord
- Loading branch information
Showing
15 changed files
with
315 additions
and
205 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
use crate::model::ID; | ||
use thiserror::Error; | ||
|
||
#[derive(Debug)] | ||
#[derive(Error, Debug)] | ||
pub enum RetrievalError { | ||
#[error("ID {0:?} not found")] | ||
NotFound(ID), | ||
#[error("Storage error: {0}")] | ||
StorageError(Box<dyn std::error::Error>), | ||
#[error("Update failed: {0}")] | ||
FailedUpdate(Box<dyn std::error::Error>), | ||
#[error("Deserialization error: {0}")] | ||
DeserializationError(bincode::Error), | ||
} | ||
|
||
impl From<bincode::Error> for RetrievalError { | ||
fn from(e: bincode::Error) -> Self { | ||
RetrievalError::DeserializationError(e) | ||
} | ||
} | ||
|
||
impl From<RetrievalError> for anyhow::Error { | ||
fn from(e: RetrievalError) -> Self { | ||
anyhow::anyhow!("{:?}", e) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.