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

Indicate the page where rendering failed #135

Closed
anatoly-scherbakov opened this issue Apr 8, 2022 · 7 comments
Closed

Indicate the page where rendering failed #135

anatoly-scherbakov opened this issue Apr 8, 2022 · 7 comments
Labels
enhancement New feature or request fixed A fix has been submitted

Comments

@anatoly-scherbakov
Copy link
Contributor

I greatly appreciate #133 which helps to be certain that the site builds correctly, and to prevent errors from sneaking into production. There is one little caveat though: if, while rendering, the process fails it might be hard to understand on which page the failure happened.

I propose to print the page path in the error message.

@github-actions
Copy link

github-actions bot commented Apr 8, 2022

Welcome to this project and thank you!' first issue

@fralau
Copy link
Owner

fralau commented Apr 8, 2022

Yes it makes sense.

For the record, could you provide an example of the error message you are getting (without the filename)?

@fralau fralau added the enhancement New feature or request label Apr 8, 2022
@anatoly-scherbakov
Copy link
Contributor Author

@fralau yes:

INFO     -  [macros] - ERROR # _Macro Rendering Error_

            **TypeError**: sequence item 65: expected str instance, span found


            ```
            Traceback (most recent call last):
              File "/home/anatoly/.pyenv/versions/3.8.12/envs/yeti.sh/lib/python3.8/site-packages/mkdocs_macros/plugin.py", line 480, in render
                return md_template.render(**page_variables)
              File "/home/anatoly/.pyenv/versions/3.8.12/envs/yeti.sh/lib/python3.8/site-packages/jinja2/environment.py", line 1291, in render
                self.environment.handle_exception()
              File "/home/anatoly/.pyenv/versions/3.8.12/envs/yeti.sh/lib/python3.8/site-packages/jinja2/environment.py", line 925, in handle_exception
                raise rewrite_traceback_stack(source=source)
              File "<template>", line 9, in top-level template code
              File "/home/anatoly/.pyenv/versions/3.8.12/envs/yeti.sh/lib/python3.8/site-packages/dominate/dom_tag.py", line 334, in __unicode__
                return self.render()
              File "/home/anatoly/.pyenv/versions/3.8.12/envs/yeti.sh/lib/python3.8/site-packages/dominate/dom_tag.py", line 340, in render
                return u''.join(data)
            TypeError: sequence item 65: expected str instance, span found

This is an error raised by my own code (a macro that I am calling).

I am preparing a PR right now.

@anatoly-scherbakov
Copy link
Contributor Author

anatoly-scherbakov commented Apr 8, 2022

After the change:

INFO     -  [macros] - ERROR # _Macro Rendering Error_

            _File_: `index.md`

            _UndefinedError_: 'badoom' is undefined

            ```
            Traceback (most recent call last):
              File "/home/anatoly/research/mkdocs_macros_plugin/mkdocs_macros/plugin.py", line 481, in render
                return md_template.render(**page_variables)
              File "/home/anatoly/.pyenv/versions/3.8.12/envs/octadocs/lib/python3.8/site-packages/jinja2/environment.py", line 1291, in render
                self.environment.handle_exception()
              File "/home/anatoly/.pyenv/versions/3.8.12/envs/octadocs/lib/python3.8/site-packages/jinja2/environment.py", line 926, in handle_exception
                raise rewrite_traceback_stack(source=source)
              File "<template>", line 13, in top-level template code
              File "/home/anatoly/.pyenv/versions/3.8.12/envs/octadocs/lib/python3.8/site-packages/jinja2/environment.py", line 456, in getitem
                return obj[argument]
            jinja2.exceptions.UndefinedError: 'badoom' is undefined

            ```

anatoly-scherbakov added a commit to octadocs/mkdocs_macros_plugin that referenced this issue Apr 8, 2022
@anatoly-scherbakov
Copy link
Contributor Author

The PR: #136

@fralau
Copy link
Owner

fralau commented Apr 9, 2022

@anatoly-scherbakov Thanks for PR #136. My first impression is that it is a darn good job; let me check it in detail.

@fralau fralau added the planned This is planned for correction label Apr 9, 2022
anatoly-scherbakov added a commit to octadocs/mkdocs_macros_plugin that referenced this issue Apr 9, 2022
anatoly-scherbakov added a commit to octadocs/mkdocs_macros_plugin that referenced this issue Apr 9, 2022
@anatoly-scherbakov
Copy link
Contributor Author

I have spotted some issues there, pushed new commits :)

fralau added a commit that referenced this issue May 15, 2022
@fralau fralau added fixed A fix has been submitted and removed planned This is planned for correction labels Jul 22, 2022
@fralau fralau closed this as completed Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed A fix has been submitted
Projects
None yet
Development

No branches or pull requests

2 participants