mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 19:57:25 +01:00
database: Add parsing error
This commit is contained in:
parent
ac14beb665
commit
20683ca824
2 changed files with 7 additions and 7 deletions
|
|
@ -13,14 +13,14 @@ pub enum Error {
|
||||||
#[error("Missing item dependency ({0} {1})")]
|
#[error("Missing item dependency ({0} {1})")]
|
||||||
MissingItem(&'static str, String),
|
MissingItem(&'static str, String),
|
||||||
|
|
||||||
|
#[error("Failed to parse {0} from '{1}'")]
|
||||||
|
ParsingError(&'static str, String),
|
||||||
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
SendError(#[from] std::sync::mpsc::SendError<super::thread::Action>),
|
SendError(#[from] std::sync::mpsc::SendError<super::thread::Action>),
|
||||||
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ReceiveError(#[from] tokio::sync::oneshot::error::RecvError),
|
ReceiveError(#[from] tokio::sync::oneshot::error::RecvError),
|
||||||
|
|
||||||
#[error("Database error: {0}")]
|
|
||||||
Other(String),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return type for database methods.
|
/// Return type for database methods.
|
||||||
|
|
|
||||||
|
|
@ -264,10 +264,10 @@ impl Database {
|
||||||
|
|
||||||
for part_index in work_parts {
|
for part_index in work_parts {
|
||||||
if !part_index.is_empty() {
|
if !part_index.is_empty() {
|
||||||
let index = str::parse(part_index).or(Err(Error::Other(format!(
|
let index = str::parse(part_index).or(Err(Error::ParsingError(
|
||||||
"Failed to parse part index from '{}'.",
|
"part index",
|
||||||
row.work_parts
|
String::from(part_index),
|
||||||
))))?;
|
)))?;
|
||||||
|
|
||||||
part_indices.push(index);
|
part_indices.push(index);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue