pub enum Error<E = Infallible> {
Show 24 variants
InvalidContextNullification,
LoadingDocumentFailed,
ProcessingModeConflict,
InvalidContextEntry,
InvalidImportValue,
InvalidRemoteContext,
InvalidBaseIri,
InvalidVocabMapping,
CyclicIriMapping,
InvalidTermDefinition,
KeywordRedefinition,
InvalidProtectedValue,
InvalidTypeMapping,
InvalidReverseProperty,
InvalidIriMapping,
InvalidKeywordAlias,
InvalidContainerMapping,
InvalidScopedContext,
ProtectedTermRedefinition,
ContextLoadingFailed(LoadError<E>),
ContextExtractionFailed(ExtractContextError),
RecursiveContextInclusion,
ContextOverflow,
ForbiddenVocab,
}Expand description
Errors that can happen during context processing.
Variants§
InvalidContextNullification
A null context tried to clear an active context that holds protected
term definitions, outside of a scope allowed to override them.
LoadingDocumentFailed
A remote @context IRI could not be resolved against the base URL.
Also used as a guard by the synchronous fast path, which refuses to
continue if it meets a remote @context or an @import that the
loader would have to fetch.
ProcessingModeConflict
A context declares @version while the processor is running in JSON-LD
1.0 mode.
InvalidContextEntry
A context entry is not permitted in the current processing mode.
Raised for @propagate, @import and @direction, all of which are
JSON-LD 1.1 additions, and for an @imported context that itself
contains @import.
InvalidImportValue
An @import value could not be resolved into an IRI against the base
URL.
InvalidRemoteContext
An @imported document’s @context is not a single context definition
object.
InvalidBaseIri
A @base value is neither an absolute IRI nor resolvable against the
context’s current base IRI.
InvalidVocabMapping
A @vocab value did not expand to an IRI or blank node identifier.
Also raised in JSON-LD 1.0 mode for a document-relative @vocab, which
only became legal in 1.1.
CyclicIriMapping
A term definition depends on itself, directly or through a chain of
prefixes or @id values.
InvalidTermDefinition
A term definition is malformed or uses a JSON-LD 1.1 entry in 1.0 mode.
Raised for an empty term; for @protected, @context, @nest or
@prefix under JSON-LD 1.0; for @index under JSON-LD 1.0 or without an
@index container; for @prefix on a term containing : or /; for
@prefix on a keyword alias; and for a stray @propagate inside a term
definition.
KeywordRedefinition
A context tried to define a keyword as a term.
@type is the one exception, and only under JSON-LD 1.1, where it may be
given @container: @set and @protected.
InvalidProtectedValue
An @protected entry holds something other than a boolean.
Rejected while parsing the context syntax, so context processing itself never raises this variant.
InvalidTypeMapping
A @type entry in a term definition does not name a usable type.
Raised when it expands to something that is not an IRI, @id, @vocab,
@json or @none; when it is @json or @none under JSON-LD 1.0; and
when a term with an @type container maps to a type other than @id or
@vocab.
InvalidReverseProperty
An @reverse term definition is malformed.
Raised when it also carries @id or @nest, or when its @container is
anything other than @set, @index or null.
InvalidIriMapping
A term could not be given an IRI mapping.
Raised when an @id or @reverse value does not expand to an IRI or
blank node identifier, when a term that looks like a compact IRI or a
path does not expand back to its own @id (JSON-LD 1.1 only), and when a
term has no @id and cannot be resolved through a prefix or the
vocabulary mapping.
InvalidKeywordAlias
A term definition tried to alias @context, which must never be
aliasable.
InvalidContainerMapping
A @container value is not one of the permitted keywords or
combinations, or uses @graph, @id, @type, an array or null under
JSON-LD 1.0.
InvalidScopedContext
A @context inside a term definition failed to process.
The underlying error is deliberately replaced by this one, as the
specification requires. The one exception is
Self::ContextOverflow, which is passed through unchanged: a
resource limit says nothing about the scoped context’s validity.
ProtectedTermRedefinition
A term marked @protected was redefined with a different meaning,
outside of a scope allowed to override protected terms.
ContextLoadingFailed(LoadError<E>)
The Loader failed to fetch a document referenced by a remote
@context or by @import.
ContextExtractionFailed(ExtractContextError)
A fetched document could not be reduced to a @context.
Raised when the document is not JSON-LD, or has no top-level object with
a @context entry.
RecursiveContextInclusion
A remote context includes itself, directly or indirectly.
JSON-LD 1.0 only. Under 1.1 a context already on the remote-context
stack is skipped while a scoped context is being validated and
processed again everywhere else (context processing step 5.2.2), so only
the Self::ContextOverflow limit constrains the chain.
ContextOverflow
A processor-defined resource limit on context nesting was exceeded.
Raised when the chain of remote contexts grows past
MAX_REMOTE_CONTEXTS, which is the limit the context processing
algorithm mandates against unbounded remote context chains, and also
when the synchronous fast path reaches its recursion depth limit on a
deeply nested inline @context.
ForbiddenVocab
A term had to be expanded through the vocabulary mapping while
Options::vocab was set to Action::Reject.
Implementations§
Trait Implementations§
Source§impl<E> Error for Error<E>
impl<E> Error for Error<E>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl<E> From<RejectVocab> for Error<E>
impl<E> From<RejectVocab> for Error<E>
Source§fn from(_value: RejectVocab) -> Self
fn from(_value: RejectVocab) -> Self
Auto Trait Implementations§
impl<E> Freeze for Error<E>
impl<E> RefUnwindSafe for Error<E>where
LoadError<E>: RefUnwindSafe,
impl<E> Send for Error<E>
impl<E> Sync for Error<E>
impl<E> Unpin for Error<E>
impl<E> UnsafeUnpin for Error<E>where
LoadError<E>: UnsafeUnpin,
impl<E> UnwindSafe for Error<E>where
LoadError<E>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
Source§fn as_unordered(&self) -> &Unordered<T>
fn as_unordered(&self) -> &Unordered<T>
Unordered reference.impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more