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

add some HTML error pages #4735

Merged
merged 10 commits into from Jan 9, 2014
Merged

add some HTML error pages #4735

merged 10 commits into from Jan 9, 2014

Conversation

minrk
Copy link
Member

@minrk minrk commented Dec 23, 2013

Among other things, this should allow users to see what happened when nbconvert fails.

CSS could probably use some love, but it's a starting point.

try:
from IPython.nbconvert.exporters.export import exporter_map
except ImportError:
exporter_map = {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this mask real errors importing that module?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should mask them - you can't start the notebook server right now without nbconvert's dependencies.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or rather, there should be a log message, but no error.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly the try/except should be happening where the exporter_map is populated, though, so that if dependencies for one part of nbconvert are missing, other exporters are still available. It would also be nice to tell the user what's missing when they try to export to a given format, rather than logging the information when the server starts.

ensures things are always importable, and delays ImportErrors until they are actually relevant.
same treatment as pygments in previous commit
pygments is the only such example at this time
@minrk
Copy link
Member Author

minrk commented Jan 8, 2014

I think I addressed @takluyver's review thus far. Now, when nbconvert fails due to missing dependencies, you get an informative error.

{% if message %}
<p>The error was:</p>
<div class="traceback-wrapper">
<pre class="traceback">{{message | replace('\n', '<br/>')}}</pre>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this replacement required? I thought line breaks inside pre tags were displayed anyway.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this doesn't make sense - I think I was using a div tag when I added the replacement, and just forgot to remove it. Removed now.

@takluyver
Copy link
Member

👍

relic from when I was using div, not pre
takluyver added a commit that referenced this pull request Jan 9, 2014
@takluyver takluyver merged commit ae073a1 into ipython:master Jan 9, 2014
@minrk minrk deleted the better-errors branch March 31, 2014 23:36
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
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

Successfully merging this pull request may close these issues.

None yet

2 participants