Skip to content

Not great build errors when directives fail #622

Closed

Description

@valencik

We currently have a couple of directives that can throw errors, and because we are throwing within DirectivePart#map instead of returning a Left in DirectivePart#evalMap (directives.scala) we don't get nice error messages.

If we break some LaTeX in a blog post somewhere, we get:

ParseError: ParseError: KaTeX parse error: Undefined control sequence: \meow at position 6:  (G, \̲m̲e̲o̲w̲)
  at <js> ParseError(Unnamed:108:3648-3663)
  at <js> parseGroup(Unnamed:18595:607334-607402)
  at <js> parseAtom(Unnamed:18023:591421-591461)
  at <js> parseExpression(Unnamed:17877:587964-587995)
  at <js> parse(Unnamed:17809:585880-585906)
  at <js> parseTree(Unnamed:18829:614302-614315)
  at <js> renderToDomTree(Unnamed:18939:617371-617405)
  at <js> renderToString(Unnamed:18900:616258-616293)
  at org.graalvm.polyglot.Value.invokeMember(Value.java:1159)
  at KaTeX$.apply(build.scala:448)
  at LaikaCustomizations$Directives$.$init$$$anonfun$7(build.scala:290)

A good error message from KaTeX, but with no additional context from Laika.

This also applies to our svg directive.

Activity

  1. self-assigned this
    on Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions