Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line number of error for Jinja Templates #391

Open
danfunk opened this issue Oct 7, 2021 · 2 comments
Open

Line number of error for Jinja Templates #391

danfunk opened this issue Oct 7, 2021 · 2 comments

Comments

@danfunk
Copy link
Contributor

danfunk commented Oct 7, 2021

When running documentation through Jinja, if we encounter an error it would help to know on what line the error happened. Some of these templates can be 10's or 100's of lines long. This can also happen with document generation in word docs, it would be worth assuring that line numbers for those errors are included as well.

@cullerton cullerton self-assigned this Oct 12, 2021
@cullerton
Copy link
Collaborator

These errors are raised by Jinja itself, not us.

        try:
            template = Template(raw_doc)
            return template.render(**spiff_task.data)
        except jinja2.exceptions.TemplateError as ue:
            raise ApiError.from_task(code="template_error", 
                                     message="Error processing template for task %s: %s" %
                                     (spiff_task.task_spec.name, str(ue)), task=spiff_task)

I believe we would have to muck with Jinja's code to get the line number

@cullerton
Copy link
Collaborator

Looking into the Jinja code a little, and they don't think in terms of line numbers. It's one big long string to them.

@cullerton cullerton removed their assignment Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants