6.4 Summary
The basic exception handling rules are as follows:
- All MuPDF functions except those that explicitly state otherwise,
throw exceptions on errors, and must therefore be called from within a
fz_try/fz_catch construct.
- A fz_try block must be paired with a fz_catch block, and optionally a
fz_always block can appear between them.
- Never return from a fz_try block.
- A fz_try block will terminate when control reaches the end of the block,
or when break is called.
- Any local variable that is changed within a fz_try block may lose its
value if an exception occurs, unless protected by fz_var call.
- The contents of the fz_always block will always be executed (after the
fz_try block and before the fz_catch block, if appropriate).
- If an exception is thrown during the fz_try block, control will jump to
the fz_always block (if there is one) and then continue to the fz_catch
block.