ExHtmltopdf.Error exception (ExHtmltopdf v0.1.0)

Copy Markdown View Source

Error returned (or raised, from the bang variants) by render functions.

kind mirrors the upstream CLI's error classes:

  • :usage — bad options (unknown flag, malformed value, unsupported wkhtmltopdf option)
  • :input — input/resource problems (missing file, unreadable font, output not writable)
  • :render — the engine rejected the document (e.g. [topage] in streaming mode)
  • :timeout — the render deadline was exceeded
  • :panic — a bug in the native engine, contained and reported instead of crashing the VM (please report upstream)

message is upstream's text verbatim, and upstream's own messages are written in Japanese (clap's parse errors are English, so mixes occur). Match on kind, never on message.

Summary

Types

kind()

@type kind() :: :usage | :input | :render | :timeout | :panic

t()

@type t() :: %ExHtmltopdf.Error{
  __exception__: true,
  kind: kind(),
  message: String.t()
}