Diagnostic codes
Every error thrown by, and every diagnostic returned by, @tmlmt/cooklang-parser has a stable code of the form COOKLANG_<L><T><D><NN>:
Lis the letter:Efor an error,Wfor a warning, orIfor an internal/library bug.Tis a tier digit used only forEcodes:0for recoverable errors, which are collected while parsing continues and do not make the call throw, so the partial result stays available.9for fatal errors, where it is not safe to continue and the call throws. It is always0forWandIcodes.Dis the domain:0generic/internal,1recipe syntax,2references,3metadata,4quantities and units,5shopping list,6shopping cart and product catalog, or7pantry and category configuration.NNis a two-digit sequence number.
Warnings never make a call fail. Internal errors indicate a library bug and behave like fatal errors. Fatal errors stop the affected work when detected and make the call throw a DiagnosticError, which carries the diagnostics collected up to that point.
See the parse diagnostics guide to learn how to consume them.
| Code | Level | Title |
|---|---|---|
COOKLANG_E0101 | error | Invalid quantity |
COOKLANG_E0102 | error | Timer missing unit |
COOKLANG_E0201 | error | Referenced ingredient not found |
COOKLANG_E0202 | error | Referenced cookware not found |
COOKLANG_E0203 | error | Referenced cookware flags do not match |
COOKLANG_E0204 | error | Referenced ingredient properties do not match |
COOKLANG_E0301 | error | Tab used for indentation |
COOKLANG_E0302 | error | Inconsistent indentation |
COOKLANG_E0701 | error | Invalid date |
COOKLANG_E0702 | error | Duplicate category |
COOKLANG_E9401 | error(fatal) | Ratio cannot be computed |
COOKLANG_E9402 | error(fatal) | Division by zero |
COOKLANG_E9501 | error(fatal) | Unresolved alternatives |
COOKLANG_E9502 | error(fatal) | Index out of bounds |
COOKLANG_E9503 | error(fatal) | Unknown recipe path |
COOKLANG_E9504 | error(fatal) | Invalid pantry |
COOKLANG_E9505 | error(fatal) | Invalid category configuration |
COOKLANG_E9601 | error(fatal) | Invalid product catalog TOML |
COOKLANG_E9602 | error(fatal) | Invalid product catalog format |
COOKLANG_E9603 | error(fatal) | No product catalog for cart |
COOKLANG_E9604 | error(fatal) | No shopping list for cart |
COOKLANG_E9701 | error(fatal) | Invalid pantry TOML |
COOKLANG_I0401 | error(internal) | Incompatible units |
COOKLANG_W0101 | warning | Unterminated block comment |
COOKLANG_W0201 | warning | Duplicate ingredient without reference |
COOKLANG_W0202 | warning | Duplicate cookware without reference |
COOKLANG_W0301 | warning | Servings is not a number |
COOKLANG_W0401 | warning | Text quantities kept separate |
COOKLANG_W0601 | warning | No product match |
COOKLANG_W0701 | warning | Ingredient without category |
COOKLANG_W0702 | warning | Duplicate ingredient or alias |