1use iri_s::error::IriSError;
2use prefixmap::PrefixMapError;
3use rudof_rdf::rdf_core::RDFError;
4use shacl_ast::ShaclError;
5use thiserror::Error;
6
7#[derive(Debug, Error)]
8pub enum ShaclParserError {
9 #[error("RDF parse error: {err}")]
10 RDFParseError {
11 #[from]
12 err: RDFError,
13 },
14
15 #[error("Expected Value of `sh:reifierShape` to be a subject, found: {term}")]
16 ReifierShapeNoSubject { term: String },
17
18 #[error("Error converting Term to RDFNode: {term}")]
19 TermToRDFNodeFailed { term: String },
20
21 #[error("Expected RDFNode parsing node shape, found: {term}")]
22 ExpectedRDFNodeNodeShape { term: String },
23
24 #[error("Expected term as subject, found: {term} in {context}")]
25 ExpectedSubject { term: String, context: String },
26
27 #[error("Expected Value of `sh:or` to be a subject, found: {term}")]
28 OrValueNoSubject { term: String },
29
30 #[error("Expected Value of `sh:or` to be an object, found: {term}")]
31 OrValueNoObject { term: String },
32
33 #[error("Expected Value of `sh:and` to be a subject, found: {term}")]
34 AndValueNoSubject { term: String },
35
36 #[error("Expected Value of `sh:xone` to be a subject, found: {term}")]
37 XOneValueNoSubject { term: String },
38
39 #[error("Expected Value of `sh:not` to be an object, found: {term}")]
40 NotValueNoObject { term: String },
41
42 #[error("Expected NodeKind, found: {term}")]
43 ExpectedNodeKind { term: String },
44
45 #[error("Unknown NodeKind, found: {term}")]
46 UnknownNodeKind { term: String },
47
48 #[error("SHACL error: {err}")]
49 ShaclError {
50 #[from]
51 err: ShaclError,
52 },
53
54 #[error("Custom error: {msg}")]
55 Custom { msg: String },
56}
57
58#[derive(Debug, Error)]
59pub enum ShaclWriterError {
60 #[error("IRI parsing error: {err}")]
61 IriS {
62 #[from]
63 err: IriSError,
64 },
65
66 #[error("Prefix map error: {err}")]
67 PrefixMap {
68 #[from]
69 err: PrefixMapError,
70 },
71
72 #[error("An error occured while writing RDF: {msg}")]
73 Write { msg: String },
74
75 #[error("An error occured while adding a prefix map to RDF: {msg}")]
76 AddPrefixMap { msg: String },
77
78 #[error("An error occured while adding a base to RDF: {msg}")]
79 AddBase { msg: String },
80}