Skip to content

Exceptions

tilttek/generator

Every exception of the library implements Tilttek\Generator\Exception\GeneratorException.

ExceptionWhenMessage
InvalidDefinitionA document, a list, an entry, a Markov chain, a generator, a state, a limit or a draw of the wrong shape; an unknown file or table; a language without grammarinn.yaml > lists > weapon > 2: an entry has a text, and its weight is a whole number
InvalidCatalogTemplates that do not compile, leave the sandbox, or name lists, tags or generators that do not exist; problems() lists themOne Problem by line: inn:template:0: the list "nope" does not exist
UnknownGeneratorA generator asked for by name that the catalog does not haveNo generator is named "npc".
UnknownListA list named by a variable that the catalog does not haveNo list is named "weapon".
UnknownTagA filter on a tag that no entry of the list carriesNo entry of the list "weapon" has the tag "era".
ExhaustedListA single pick with no entry left, or no new word a Markov list could inventNo entry of the list "weapon" is left to pick., The list "name.elf" invented no word that fits in 50 attempts.
LimitExceededA draw past one of the limits, or a value of a state too long to bring backThe limit of 1000 picks per result is exceeded., The limit of 1024 characters per state value is exceeded.
GenerationFailedA template that fails while it renders: an undefined variable or field, a dice expression that does not roll, an access the sandbox refusesThe template "inn:field:name" failed: Variable "keeper" does not exist in "inn:field:name" at line 1.

A template is named by its generator and its place: name:template:0, name:var:gender, name:field:keeper, name:cell, name:state:weather:start, name:state:weather:next. An exception of the library thrown inside a template — UnknownList, ExhaustedList, LimitExceeded — reaches the caller as it is, not wrapped in Twig's errors.