Anydoc.Error exception (anydoc_ex v0.1.0)

Copy Markdown View Source

A conversion failure.

An error is returned (or raised, from the bang variants) only when no meaningful Markdown could come out of the input. Recoverable producer quirks never surface here — anydoc recovers or skips them and conversion continues.

The :code field is the stable, machine-readable name a caller branches on; :message carries the human-readable detail. The codes mirror the upstream ConvertError::code() values, snake-cased:

CodeMeaning
:unsupportedUnknown format, or one that cannot be converted (an image-only PDF)
:malformedStructurally unusable: no meaningful content could be extracted
:encryptedEncrypted or password-protected
:resource_limitCrossed a fixed safety limit (decompression, nesting, node count)
:missing_partA part required for any meaningful output is absent
:ioThe file could not be read, from Anydoc.to_markdown/1 only

:part names the package part or stream at fault when the format identifies one (:malformed and :missing_part errors); :limit names the safety limit crossed (:resource_limit errors). Both are nil otherwise.

Summary

Types

Stable, machine-readable name for what went wrong.

t()

Types

code()

@type code() ::
  :unsupported | :malformed | :encrypted | :resource_limit | :missing_part | :io

Stable, machine-readable name for what went wrong.

t()

@type t() :: %Anydoc.Error{
  __exception__: term(),
  code: code(),
  limit: String.t() | nil,
  message: String.t(),
  part: String.t() | nil
}