LangelicEpub.Error exception (langelic_epub v0.1.1)

Copy Markdown View Source

Error returned from LangelicEpub.parse/1 or LangelicEpub.build/1.

The kind field is an atom identifying the error class. The message field is a human-readable string suitable for logging.

Kinds

Parse errors:

  • :invalid_zip — bytes are not a valid ZIP archive
  • :invalid_mimetypemimetype entry is missing or its content is not application/epub+zip (a leading UTF-8 BOM and surrounding whitespace are tolerated)
  • :missing_container — no META-INF/container.xml
  • :missing_opf — OPF file referenced in container.xml not found
  • :malformed_opf — OPF could not be parsed
  • :io — internal I/O failure

Build errors:

  • :missing_required_field — title, identifier, or language is missing
  • :invalid_chapter — a chapter's data is not valid UTF-8 XHTML
  • :duplicate_id — two chapters or assets share the same id

Safety:

  • :panic — Rust side panicked. This should never happen — report a bug.

Summary

Types

kind()

@type kind() ::
  :invalid_zip
  | :invalid_mimetype
  | :missing_container
  | :missing_opf
  | :malformed_opf
  | :io
  | :missing_required_field
  | :invalid_chapter
  | :duplicate_id
  | :panic

t()

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