Skip to content

TTP doesn't include a mechanism for validating template syntax #136

Open

Description

@wrgeorge1983

Currently it seems there's no concrete way to be sure a template is valid before you throw data at it. The library currently seems to prefer swallowing errors and returning empty values and maybe logging errors.

as a standalone utility this is reasonable, but for my use case it's unpleasant.

I'm writing code that is going to maintain a library of templates, users can add/remove templates and it'd be very handy if I could explicitly reject obviously invalid templates at the start, rather than waiting for users to try and use them.

Perhaps I can just check the template to see if it's empty, or watch the log stream somehow, but both of those feel pretty messy.

Would you be open to a PR adding a 'strict' parameter making sure most exceptions are raised to the caller, rather than being caught and logged?

Activity

  1. dmulyalin commented on Jan 30, 2026

    @dmulyalin
    Owner

    Hello, if template is invalid TTP with throw an error when trying to load it. Empty values normally returned not because of the template syntaxis is invalid but because parsing given data with the template produced no output. No output produced by parsing depending on the use case could be an indication of a problem or could be not. It is fairly trivial to add a check for empty results and raise an error in your code.

    Do you have examples of error-some data+template combination that don't behave or throw error as expected?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions