fix(pdf): return a conversion error when the PDF parser panics

GA
9d ago
+58-0

Fixes #189.

A PDF with a missing inline-image colour-space field can trigger a panic in the PDF parser and abort the Node host process.

Catch unwinding panics at the PDF conversion boundary and return a malformed conversion error. Add regressions for the reported failure and an inline image with a valid colour space.

Validation on Windows:

  • Full Rust suite: 300 tests passed; one existing test ignored.
  • Node suite: 22 tests passed using the rebuilt native debug binding.
  • Native file and byte APIs return catchable errors, subsequent conversions succeed, and the CLI exits with code 1.
  • Workspace Clippy, Rust formatting, and whitespace checks passed.

The default panic diagnostic still appears on stderr. Browser/Wasm runtime behavior has not been verified.


Summary by cubic

Catches a PDF parser panic on inline images that miss a colour-space field, returning a malformed conversion error instead of unwinding across a native binding and aborting the Node host process.

  • The panic is caught at the conversion boundary, so no partial conversion state escapes and subsequent conversions succeed.
  • Adds regression tests for the reported failure and an inline image with a valid colour space.
  • The default panic diagnostic still appears on stderr, and browser/Wasm behavior is not verified.