use std::path::PathBuf;
use thiserror::Error;
use crate::{
models,
parser::{self},
};
#[derive(Error, Debug)]
pub enum Error {
#[error("Unable to create parent path ({0}) for index file: {1}")]
DatabaseFileError(PathBuf, std::io::Error),
#[error("Provided file path ({0}) was not valid: {1}")]
InvalidPath(PathBuf, String),
#[error("Parsing error occurred while indexing file: {0:?}")]
ParsingFailed(parser::Error),
#[error("Invalid query during indexing: {0}")]
InvalidQuerySyntax(#[from] sea_query::error::Error),
#[error("Query error during indexing: {0}")]
QueryFailed(#[from] sqlx::Error),
#[error("Database migration failed: {0}")]
MigrationFailed(#[from] sqlx::migrate::MigrateError),
#[error("The provided range is invalid: {0:?}")]
InvalidRange(models::parsed::Range),
}