#[non_exhaustive]pub enum Error {
Io {
path: PathBuf,
source: Error,
},
Bundle {
message: String,
},
Checksum {
path: String,
expected: String,
actual: String,
},
NotXml {
line: u32,
column: u32,
message: String,
},
Unsupported {
message: String,
},
Limit {
limit: LimitExceeded,
message: String,
},
OptionOutOfRange {
option: &'static str,
value: u32,
max: u32,
},
Transform {
stylesheet: String,
code: String,
line: Option<u32>,
message: String,
},
Internal {
message: String,
},
NotCached {
name: String,
dir: PathBuf,
},
Fetch {
message: String,
},
Pdf(Error),
}Expand description
Why a rule set could not be loaded, or a document could not be validated.
Validity problems of a document (schema errors, failed asserts) are not errors: they
are in the Report. An error means that no complete verdict could
be given.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io
A file could not be read.
Bundle
The bundle is not usable: a manifest that does not follow the format, a missing file, an unknown schema name, a stylesheet that is not well-formed XSLT, or one whose result is not an SVRL report.
Checksum
A file of the bundle does not have the SHA-256 its manifest records.
Fields
NotXml
The document is not well-formed XML (or not namespace-well-formed, or with bytes that are not characters of its encoding, or first bytes and an XML declaration that name different encodings).
Unsupported
The document or a rule-set artefact needs a construct that this engine does not implement (an encoding the validator does not read, a document type declaration, an XSLT or XML Schema construct outside the supported subset). Refused rather than answered differently from the reference engine.
Limit
The document exceeds a limit that keeps its validation within a bounded call
stack: an element nested deeper than ValidateOptions::max_depth
(LimitExceeded::Depth), in the document or in a document a stylesheet loads
with document(); or a stylesheet invoking templates and functions one inside
another beyond the nesting that maximum allows (LimitExceeded::Nesting).
Refused rather than risking a stack overflow, which would abort the process.
Fields
limit: LimitExceededThe limit exceeded, with its value and, for a depth, the line and column of the element.
OptionOutOfRange
An option of the validation beyond what this target allows: on WebAssembly, a
ValidateOptions::max_depth above WASM_MAX_DEPTH or a
ValidateOptions::max_stack above WASM_MAX_STACK, for which the native stack
of the JavaScript engines has no room. Never on other targets.
Fields
Transform
A stylesheet of the rule set raised a dynamic error on the document (the reference engine fails on it as well).
Fields
Internal
A bug of this engine: a result it cannot read back.
NotCached
A fetched rule set (fetched_rule_sets) that is not
in the cache: it must be fetched first (RuleSetCache::fetch, feature fetch;
einvoice-validate rules fetch NAME). Nothing is downloaded without being asked.
Fetch
A rule set could not be fetched: a download failed or did not have its pinned digest, an archive is not as published, or its bundle could not be built (no Java for the Schematron compiler of Peppol BIS Billing, …).
Pdf(Error)
No invoice XML could be extracted from a PDF file (crate::pdf::extract): its
kind is ErrorKind::Unsupported for an encrypted file, a PDF feature outside the
subset read or a limit exceeded, and ErrorKind::Io otherwise (not a PDF, a
malformed file, no embedded file with an invoice name or several, XMP metadata
that is not well-formed): the file cannot be read as an e-invoice.
Implementations§
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()