1use oxrdfio::{RdfFormat, RdfParseError};
2use rdf_fusion_execution::sparql::error::QueryEvaluationError;
3use rdf_fusion_model::IriParseError;
4use rdf_fusion_model::StorageError;
5use std::io;
6
7#[derive(Debug, thiserror::Error)]
9pub enum LoaderError {
10 #[error(transparent)]
12 Parsing(#[from] RdfParseError),
13 #[error(transparent)]
15 Storage(#[from] StorageError),
16 #[error("Invalid base IRI '{iri}': {error}")]
18 InvalidBaseIri {
19 iri: String,
21 #[source]
23 error: IriParseError,
24 },
25}
26
27impl From<LoaderError> for io::Error {
28 #[inline]
29 fn from(error: LoaderError) -> Self {
30 match error {
31 LoaderError::Storage(error) => error.into(),
32 LoaderError::Parsing(error) => error.into(),
33 LoaderError::InvalidBaseIri { .. } => {
34 Self::new(io::ErrorKind::InvalidInput, error.to_string())
35 }
36 }
37 }
38}
39
40#[derive(Debug, thiserror::Error)]
43
44pub enum SerializerError {
45 #[error(transparent)]
47 Io(#[from] io::Error),
48
49 #[error(transparent)]
51 Evaluation(#[from] QueryEvaluationError),
52
53 #[error("A RDF format supporting datasets was expected, {0} found")]
55 DatasetFormatExpected(RdfFormat),
56}