shex_ast/ast/
schema_json_error.rs

1use std::path::PathBuf;
2
3use iri_s::{IriS, IriSError};
4use thiserror::Error;
5
6#[derive(Error, Debug, Clone)]
7pub enum SchemaJsonError {
8    #[error("ShapeLabel {value} is not valid: {error}")]
9    InvalidShapeLabel {
10        value: String,
11        error: String, // We need to clone errors so we use String instead of IriSError
12    },
13    #[error("Node {node} is not a valid RDF Node in an ObjectValue: {error}")]
14    InvalidNodeInObjectValue {
15        node: String, // We need to clone so we use String instead of Object
16        error: String,
17    },
18    #[error("Error checking literal: {error}")]
19    LiteralError { error: String },
20
21    #[error("Error parsing label as IriRef, label: {label}: {error}")]
22    InvalidIriRef {
23        label: String,
24        error: String, // We need to clone errors so we use String instead of IriSError
25    },
26    #[error("Reading path {path_name:?} error: {error:?}")]
27    ReadingPathError {
28        path_name: String,
29        error: String, // We need to clone so we use String instead of io::Error
30    },
31
32    #[error("Reading JSON from {path_name:?}. Error: {error:?}")]
33    JsonError {
34        path_name: String,
35        error: String, // We need to clone errors so we use String instead of serde_json::Error,
36    },
37
38    #[error("Reading JSON from reader. Error: {error:?}")]
39    JsonErrorFromReader {
40        error: String, // We need to clone errors so we use String instead of serde_json::Error,
41    },
42
43    #[error("Shape Decl with prefixed shape {prefix:}:{local} but no prefix map declaration")]
44    ShapeDeclPrefixNoPrefixMap { prefix: String, local: String },
45
46    #[error(transparent)]
47    PrefixMapError {
48        #[from]
49        err: prefixmap::PrefixMapError,
50    },
51
52    #[error("Obtaining current dir: {error:?}")]
53    CurrentDir { error: String },
54
55    #[error("Obtaining Url from local dir: {path}")]
56    LocalFolderIriError { path: PathBuf },
57
58    #[error("Trying to dereference IRI: {iri}: {error}")]
59    DereferencingIri { iri: IriS, error: IriSError },
60
61    #[error("Obtaining schema from IRI {iri}. Error: {error}")]
62    SchemaFromIri { iri: IriS, error: String },
63}