For my abbreviations functionality I’d like to halt compilation when an abbreviation is detected that is not available in the global dictionary. I do this with an assert:
#assert(abbr in GLOBALDICT.keys(), message: "
!!!!!!!!! ABBREVIATION MISSING !!!!!!!!!!
The abbreviation " + abbr + " does not exist in the abbreviation dictionary.
")
The problem is that the user sees redundant information when they forget to supply an abbreviation:
[typst]: Compiling scratch.typ to scratch.pdf...error: assertion failed:
!!!!!!!!! ABBREVIATION MISSING !!!!!!!!!!
The abbreviation CTROUGHT does not exist in the abbreviation dictionary.
┌─ scratch/scratch.typ:352:0
│
352 │ ╭ assert(abbr in GLOBALDICT.keys(), message: "
353 │ │
354 │ │ !!!!!!!!! ABBREVIATION MISSING !!!!!!!!!!
355 │ │
356 │ │ The abbreviation " + abbr + " does not exist in the abbreviation dictionary.
357 │ │
358 │ │ ")
│ ╰──^
For the user, it really does not matter in what function the assert is triggered, they should just see the notice. Is that possible in Typst?
Thanks, I had also found panic but it has the same problem. I might open an issue as stopping a render without it looking like a bug would be a good feature I think.