Skip to main content

shacl_ir/compiled/
compiled_shacl_error.rs

1use rudof_rdf::rdf_core::{term::Object, utils::RDFRegexError};
2use rudof_rdf::rdf_impl::InMemoryGraphError;
3use shacl_ast::ShaclError;
4use shacl_rdf::error::ShaclParserError;
5use thiserror::Error;
6
7#[derive(Debug, Error)]
8pub enum CompiledShaclError {
9    #[error("Duplicate shape: {shape}")]
10    DuplicateShape { shape: Box<Object> },
11
12    #[error(
13        "Invalid path for property shape with reifier shape {shape_id}, the path must be a single predicate, but got: {path}"
14    )]
15    InvalidReifierShapePath { shape_id: Box<Object>, path: String },
16    #[error("Conversion from IriRef {iri_ref } failed: {err}")]
17    IriRefConversion { iri_ref: String, err: String },
18
19    #[error("Shape not found {shape} ")]
20    ShapeNotFound { shape: Box<Object> },
21
22    #[error("Could not convert to Literal: {node}")]
23    LiteralConversion { node: Box<Object> },
24
25    #[error("RDF error: {err}")]
26    RdfGraphError { err: Box<InMemoryGraphError> },
27
28    #[error("Error parsing SHACL: {err}")]
29    ShaclParserError { err: Box<ShaclParserError> },
30
31    #[error("ShaclError: {source}")]
32    ShaclError { source: ShaclError },
33
34    #[error("Invalid regex pattern: {pattern} with flags: {}: {error}", flags.as_deref().unwrap_or("None"))]
35    InvalidRegex {
36        pattern: String,
37        flags: Option<String>,
38        error: Box<RDFRegexError>,
39    },
40}