advent_of_utils_cli/error/
database.rs1use std::{io, path::PathBuf};
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5pub enum DatabaseError {
6 #[error(
7 "Failed executing following command on the Database: \n\"{command}\"\nCaused by: {source}"
8 )]
9 DatabaseExec {
10 command: String,
11 #[source]
12 source: rusqlite::Error,
13 },
14
15 #[error("Failed finding the correct location for local data")]
16 DataLocation,
17
18 #[error("Failed connecting to the database at {path}")]
19 ConnectionFailed {
20 path: PathBuf,
21 #[source]
22 source: r2d2::Error,
23 },
24
25 #[error("Failed querring the database, trying getting {object}: {source}")]
26 DatabaseQuerying {
27 object: String,
28 #[source]
29 source: rusqlite::Error,
30 },
31
32 #[error("Failed creating folder for the database at {path}")]
33 DirectoryCreateFailed {
34 path: PathBuf,
35 #[source]
36 source: io::Error,
37 },
38}