-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
feat: Nicer error outputs - no tracebacks from mkdocstrings #230
Conversation
(though definitely not nicer-looking in terms of code)
Well indeed that's much better. Just a question: for the warning log, "Output for missing reference with this change", did you forget to write the |
No, it is really missing! Good catch! It's a regression from https://github.com/mkdocstrings/mkdocstrings/pull/220/files#diff-1681abe3d10f2ea6f96879d51ae21d3bdf7a87ec42cf2a533f761a4d9f53449bR14 |
Ah yes, since they were split, they don't share the loggers module anymore. Hmmm. I wonder if we should make the loggers utilities a new package 😅 It could be reused in our plugins, and others as well, normalizing a bit how logging is done for MkDocs plugins. If it gains traction it could be merged back into MkDocs, just what we initially wanted @oprypin |
No, I think that's too tiny to split out. I went for what I'd call a pragmatic solution... |
Want to rebase so we get the CI fix in here? |
I merged master separately (without pushing it here) and it passed here https://github.com/oprypin/mkdocstrings/actions/runs/556025752 I'd prefer merging as is. |
I still get some pretty unhelpful error messages at times. I don't understand what is doing wrong here. I can import the package fine.
|
Hi @jmrgibson, please open a new issue with additional information, like your project structure and your mkdocs config 🙂 |
My apologies, new issue created here: mkdocstrings/pytkdocs#102 |
(though definitely not nicer-looking in terms of code)
Warning output from missing autorefs
The important thing I want to address is actually a kind of regression from #217: now
collect()
can be called from an "implicit" operation such as generating an cross-reference, and even though errors in that operation are suppressed, the explicitlog.error()
insidecollect()
is not suppressed, so I just fold that into the exception message.Output for missing reference on 0.14.0
Output for missing reference on master
Output for missing reference with this change
Error output from missing autodocs
But I also want to finally tackle the issue that mkdocstrings prints a useless traceback to its own implementation whenever an error happens. Sure, normally you'd think that that is blocked on mkdocs/mkdocs#2103 having been released, but actually we can """polyfill""" it by just raising
SystemExit
. The difference is only that MkDocs has no opportunity to print the"Error reading page '{}'"
message but I polyfill that too.Output for missing autodoc on 0.14.0 (same on master)
Output for missing autodoc with this change, with MkDocs master
Note: I'll send a pull request to MkDocs to deduplicate and change the bottom part to
Output for missing autodoc with this change, with MkDocs 1.1.2
Output for unparsable JSON
This is in "should never happen" territory, but it was affected too, so here's how it looks:
Output for bad JSON on master
Output for bad JSON with this change, with MkDocs 1.1.2