pub enum Error {
    Pest(Error<Rule>),
    IO(Error),
    Expansion(ExpansionError),
    InvalidFacet(String),
    Unsupported(&'static str, &'static str),
}
Expand description

The error type for this crate.

Variants

Pest(Error<Rule>)

An error that occurred at the pest parser level.

This is returned from any parsing methods when the input is written with invalid syntax, or when attempting to parse an incomplete input.

Example:

use horned_functional::FromFunctional;

let res = SetOntology::from_ofn("Ontology(");
assert_matches!(res, Err(horned_functional::Error::Pest(_)));

IO(Error)

An error that happened at the I/O level.

Example:

let res = horned_functional::from_file::<SetOntology, _>("/some/missing/file")
    .map(|x| x.0);
assert_matches!(res, Err(horned_functional::Error::IO(_)));

Expansion(ExpansionError)

A CURIE expansion went wrong.

This error can be encountered in documents where a CURIE used an undefined prefix, or when attempting to parse an abbreviated IRI without providing a prefix mapping.

Example

use horned_functional::FromFunctional;

let res = IRI::from_ofn("example:Entity");
assert_matches!(res, Err(horned_functional::Error::Expansion(_)));

InvalidFacet(String)

An unknown IRI was used as a facet.

Example

use horned_functional::FromFunctional;

let res = Facet::from_ofn("<http://example.com/thing>");
assert_matches!(res, Err(horned_functional::Error::InvalidFacet(_)));

Unsupported(&'static str, &'static str)

An unsupported construct was used.

See the relevant issue for each unsupported syntax construct; if the issue has been resolved, please open an issue on the fastobo/horned-functional repository so that it can be fixed.

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Performs the conversion.

Performs the conversion.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.