pub fn catch_decode<T>(
path: &Path,
decode: impl FnOnce() -> Result<T, String>,
) -> Result<T, String>Expand description
Run a decoder, turning a panic inside it into an ordinary error.
Image, HEIC and RAW decoders are fed arbitrary files from users’ drives; one malformed file must fail that file, not the job or the app. The panic hook still records the panic in the crash log.