Jollywatt / typst-fletcher

Typst package for drawing diagrams with arrows, built on top of CeTZ.
MIT License
270 stars 6 forks source link

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

Closed tingerrr closed 3 months ago

tingerrr commented 3 months ago

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.

tingerrr commented 3 months ago

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.

Jollywatt commented 3 months ago

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.

tingerrr commented 3 months ago

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.