pub struct Error {
pub kind: ErrorKind,
pub offset: Option<u64>,
pub context: Context,
pub reason: &'static str,
}Expand description
A failure visible to native and JavaScript callers: what went wrong, the absolute input offset and the structure it was found in, when known, and a fixed description.
Fields§
§kind: ErrorKind§offset: Option<u64>Absolute byte offset in the input when known. For a Context::Pdf
error it is in the whole input, not in an embedded PDF range.
context: Context§reason: &'static strWhat was wrong or which field; empty when the kind says it all.
Implementations§
Source§impl Error
impl Error
Sourcepub fn invalid(reason: &'static str) -> Self
pub fn invalid(reason: &'static str) -> Self
An invalid caller-supplied range, count or option.
Sourcepub fn malformed(offset: u64, reason: &'static str) -> Self
pub fn malformed(offset: u64, reason: &'static str) -> Self
A structure or field at offset the format does not allow.
Sourcepub fn unsupported(offset: u64, reason: &'static str) -> Self
pub fn unsupported(offset: u64, reason: &'static str) -> Self
A structure or field at offset outside the supported profile.
pub fn cancelled() -> Self
Sourcepub fn truncated(offset: u64, expected: u64, available: u64) -> Self
pub fn truncated(offset: u64, expected: u64, available: u64) -> Self
The source ended at offset with available of expected bytes.
Sourcepub fn limit(resource: &'static str, limit: u64, attempted: u64) -> Self
pub fn limit(resource: &'static str, limit: u64, attempted: u64) -> Self
A configured resource bound would be exceeded.
pub fn in_caj(self, record: Option<u32>) -> Self
pub fn in_pdf(self, object: Option<(u32, u16)>) -> Self
pub fn in_jbig2(self, segment: Option<u32>) -> Self
Trait Implementations§
Source§impl Display for Error
"{kind} {context} at byte {offset}, {location}: {reason}: {details}"
with the pieces present.
impl Display for Error
"{kind} {context} at byte {offset}, {location}: {reason}: {details}"
with the pieces present.
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()
Source§impl From<&Error> for ApplicationInfoDefect
A malformed package names its field before the first ": " of the
reason; any other failure names the field or resource it concerns.
impl From<&Error> for ApplicationInfoDefect
A malformed package names its field before the first ": " of the
reason; any other failure names the field or resource it concerns.
Source§impl From<Error> for Error
An I/O error that carries a core error, as an io::Write adapter in
this crate reports one, converts back to that error.
impl From<Error> for Error
An I/O error that carries a core error, as an io::Write adapter in
this crate reports one, converts back to that error.