When there is something wrong in my DSL, I like to write code that uses expectLen, expectKind, expectMinLen, whenever possible, because these procedures not only check for the condition, but I also get proper highlighting in my editor, where in my DSL I have the wrong node. Sadly there are only a few condition that I can check with this methods, on all other cases where something is wrong with the dsl I have to use error, where I loose the positional information of the node that did something wrong.
If error had a parameter, where I could pass a node, to define the source of the problem, I would instantly have something that covers all use cases of all "expect" functions, and even extends to many more use cases:
proc error(msg: string; n: NimNode = nil) [...]
proc expectKind(n: NimNode; k: NimNodeKind): =
if n.kind != k:
error("expected kind: " & $k, n)