Jollywatt / typst-fletcher

Typst package for drawing diagrams with arrows, built on top of CeTZ.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

type auto has no method `at` on missing node coordiante

tingerrr opened this issue · comments

The following throws a rather unhelpful error message because of the missing coordinate.

#import "@preview/fletcher:0.4.2" as fletcher: node
#fletcher.diagram(node(`label`))

This came up when I was automating some graph creation, where it was not easily apparent that I was missing the coordinate.

A similar thing can be observed with #fletcher.diagram(node((0, 0), "label", "additional")) where additional is an unnecessary argument. The error message talks about expecting content but receiving auto.

I’ve added some assertions to validate node arguments to catch these weird errors — thanks! Because this is you, the creator of typst-test, this made me think: have you thought about error handling tests in typst-test? I know that errors and logging in typst are still very basic, and packages like this one and cetz generally don’t fail gracefully… in part because you can’t yet unit test code that doesn’t compile.

have you thought about error handling tests in typst-test

Indeed, I have, I'm working on a typst-test rework locally to add a lot of the are quested features as well as an extended standard library to allow this, but it's still a while off as I first need to reimplement typst-cli's World impl to test the new stuff.