pub struct QpdfExc { /* private fields */ }Expand description
Structured counterpart of qpdf’s public QPDFExc exception.
qpdf stores the error code, source filename, object description, signed
file position, and detail as independent values, while what() is a
derived diagnostic string (include/qpdf/QPDFExc.hh:29-77,
libqpdf/QPDFExc.cc:3-51). Keep each field as bytes because qpdf’s
std::string accepts arbitrary bytes, including embedded NULs.
Self::what_bytes intentionally models the observable C-string returned
by std::runtime_error::what(): it ends at the first NUL. The getters retain
the complete original fields, so this distinction is not lost. std::fmt::Display
is only a lossy UTF-8 projection of those observable bytes and must not be
used as a replacement for byte-oriented qpdf logging.
Implementations§
Source§impl QpdfExc
impl QpdfExc
Sourcepub fn new(
error_code: QpdfErrorCode,
filename: impl AsRef<[u8]>,
object: impl AsRef<[u8]>,
offset: i64,
message: impl AsRef<[u8]>,
) -> Self
pub fn new( error_code: QpdfErrorCode, filename: impl AsRef<[u8]>, object: impl AsRef<[u8]>, offset: i64, message: impl AsRef<[u8]>, ) -> Self
Construct a qpdf-shaped exception from its independent raw fields.
Sourcepub fn get_error_code(&self) -> QpdfErrorCode
pub fn get_error_code(&self) -> QpdfErrorCode
Return qpdf’s independent error code.
Sourcepub fn get_filename(&self) -> &[u8] ⓘ
pub fn get_filename(&self) -> &[u8] ⓘ
Return the complete original filename bytes.
Sourcepub fn get_object(&self) -> &[u8] ⓘ
pub fn get_object(&self) -> &[u8] ⓘ
Return the complete original object-description bytes.
Sourcepub fn get_file_position(&self) -> i64
pub fn get_file_position(&self) -> i64
Return qpdf’s signed file position.
Sourcepub fn get_message_detail(&self) -> &[u8] ⓘ
pub fn get_message_detail(&self) -> &[u8] ⓘ
Return the complete original detail-message bytes.
Sourcepub fn what_bytes(&self) -> &[u8] ⓘ
pub fn what_bytes(&self) -> &[u8] ⓘ
Return the observable what() bytes, truncated at the first NUL.
Trait Implementations§
impl Eq for QpdfExc
Source§impl Error for QpdfExc
impl Error for QpdfExc
1.30.0 · 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()