use std::{io, str::Utf8Error, string::FromUtf8Error};
use thiserror::Error;
use super::*;
#[derive(Error, Debug)]
pub enum LoaderError {
#[error("{0}")]
TextSplitter(#[from] TextSplitterError),
#[error(transparent)]
IO(#[from] io::Error),
#[error(transparent)]
Utf8(#[from] Utf8Error),
#[error(transparent)]
FromUtf8(#[from] FromUtf8Error),
#[error(transparent)]
PdfOxide(#[from] pdf_oxide::error::Error),
#[error(transparent)]
OfficeOxide(#[from] office_oxide::OfficeError),
#[error(transparent)]
Readability(#[from] readability::error::Error),
#[error(transparent)]
UrlParse(#[from] url::ParseError),
#[error("Unsupported source language")]
UnsupportedLanguage,
#[error("Error: {0}")]
Other(String),
}
pub type LoaderResult<T> = Result<T, LoaderError>;