some docs
This commit is contained in:
parent
c067088a32
commit
1314320260
6 changed files with 58 additions and 3 deletions
|
@ -24,83 +24,107 @@ pub struct Calibre {
|
|||
}
|
||||
|
||||
#[derive(Debug, Snafu)]
|
||||
/// Errors that can occur when loading the calibre database.
|
||||
pub enum LoadError {
|
||||
/// A failure to create the database connection pool.
|
||||
#[snafu(display("Failed to create database connection pool."))]
|
||||
CreateDbPool { source: r2d2::Error },
|
||||
/// A failure to create the temporary database view.
|
||||
#[snafu(display("Failed to create temporary database view."))]
|
||||
TmpDb { source: io::Error },
|
||||
/// A failure to keep the temporary database from being deleted.
|
||||
#[snafu(display("Failed to keep temporary database from deletion."))]
|
||||
PersistTmpDb { source: PersistError },
|
||||
}
|
||||
|
||||
#[derive(Debug, Snafu)]
|
||||
/// Errors that can occur when accessing the data store.
|
||||
pub enum DataStoreError {
|
||||
/// A failure to get a database connection from the pool.
|
||||
#[snafu(display("Failed to get database connection from pool."))]
|
||||
GetDbConn { source: r2d2::Error },
|
||||
|
||||
/// A failure during a search operation.
|
||||
#[snafu(display("Failed to search."))]
|
||||
Search { source: crate::search::SearchError },
|
||||
|
||||
/// A failure to fetch multiple books.
|
||||
#[snafu(display("Failed to fetch multiple books."))]
|
||||
MultipleBooks {
|
||||
source: data::book::MultipleBooksError,
|
||||
},
|
||||
/// A failure to fetch recent books.
|
||||
#[snafu(display("Failed to fetch recent books."))]
|
||||
RecentBooks {
|
||||
source: data::book::RecentBooksError,
|
||||
},
|
||||
/// A failure to fetch a single book.
|
||||
#[snafu(display("Failed to fetch book."))]
|
||||
ScalarBook { source: data::book::ScalarBookError },
|
||||
/// A failure to get a series' books.
|
||||
#[snafu(display("Failed to get a series' books."))]
|
||||
SeriesBooks { source: data::book::SeriesBookError },
|
||||
/// A failure to fetch an author's books.
|
||||
#[snafu(display("Failed to fetch an author's books."))]
|
||||
AuthorBooks {
|
||||
source: data::book::AuthorBooksError,
|
||||
},
|
||||
/// A failure to check for previous books.
|
||||
#[snafu(display("Failed to check if there are previous books."))]
|
||||
HasPreviousBooks {
|
||||
source: data::book::PreviousBooksError,
|
||||
},
|
||||
/// A failure to check for more books.
|
||||
#[snafu(display("Failed to check if there are more books."))]
|
||||
HasMoreBooks { source: data::book::MoreBooksError },
|
||||
|
||||
/// A failure to fetch multiple authors.
|
||||
#[snafu(display("Failed to fetch multiple authors."))]
|
||||
MultipleAuthors {
|
||||
source: data::author::MultipleAuthorsError,
|
||||
},
|
||||
/// A failure to fetch a single author.
|
||||
#[snafu(display("Failed to fetch author."))]
|
||||
ScalarAuthor {
|
||||
source: data::author::ScalarAuthorError,
|
||||
},
|
||||
/// A failure to fetch a book's author.
|
||||
#[snafu(display("Failed to fetch book's author."))]
|
||||
BookAuthor {
|
||||
source: data::author::BookAuthorError,
|
||||
},
|
||||
/// A failure to check for previous authors.
|
||||
#[snafu(display("Failed to check if there are previous authors."))]
|
||||
HasPreviousAuthors {
|
||||
source: data::author::PreviousAuthorsError,
|
||||
},
|
||||
/// A failure to check for more authors.
|
||||
#[snafu(display("Failed to check if there are more authors."))]
|
||||
HasMoreAuthors {
|
||||
source: data::author::MoreAuthorsError,
|
||||
},
|
||||
|
||||
/// A failure to fetch multiple series.
|
||||
#[snafu(display("Failed to fetch multiple series."))]
|
||||
MultipleSeries {
|
||||
source: data::series::MultiplSeriesError,
|
||||
},
|
||||
/// A failure to fetch a single series.
|
||||
#[snafu(display("Failed to fetch series."))]
|
||||
ScalarSeries {
|
||||
source: data::series::ScalarSeriesError,
|
||||
},
|
||||
/// A failure to get the series a book belongs to.
|
||||
#[snafu(display("Failed to get the series a book belongs to."))]
|
||||
BookSeries {
|
||||
source: data::series::SeriesBooksError,
|
||||
},
|
||||
/// A failure to check for previous series.
|
||||
#[snafu(display("Failed to check if there are previous series."))]
|
||||
HasPreviousSeries {
|
||||
source: data::series::PreviousSeriesError,
|
||||
},
|
||||
/// A failure to check for more series.
|
||||
#[snafu(display("Failed to check if there are more series."))]
|
||||
HasMoreSeries {
|
||||
source: data::series::MoreSeriesError,
|
||||
|
|
|
@ -26,17 +26,23 @@ pub struct Pagination<'a> {
|
|||
}
|
||||
|
||||
#[derive(Debug, Snafu)]
|
||||
/// Errors that can occur when checking for previous or more items.
|
||||
pub enum HasPrevOrMoreError {
|
||||
/// A failure to prepare the SQL statement.
|
||||
#[snafu(display("Failed to prepare statement."))]
|
||||
PrepareHasPrevOrMore { source: rusqlite::Error },
|
||||
/// A failure to execute the SQL statement.
|
||||
#[snafu(display("Failed to execute statement."))]
|
||||
ExecuteHasPrevOrMore { source: rusqlite::Error },
|
||||
}
|
||||
|
||||
#[derive(Debug, Snafu)]
|
||||
/// Errors that can occur during pagination.
|
||||
pub enum PaginationError {
|
||||
/// A failure to prepare the SQL statement.
|
||||
#[snafu(display("Failed to prepare statement."))]
|
||||
PreparePagination { source: rusqlite::Error },
|
||||
/// A failure to execute the SQL statement.
|
||||
#[snafu(display("Failed to execute statement."))]
|
||||
ExecutePagination { source: rusqlite::Error },
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue