Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1b393c4

Browse files
committed
Include tex output in pdf LatexError.
This will make it easier to troubleshoot failures on CI.
1 parent 4da4cf9 commit 1b393c4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/matplotlib/backends/backend_pgf.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ def __init__(self, message, latex_output=""):
192192
super().__init__(message)
193193
self.latex_output = latex_output
194194

195+
def __str__(self):
196+
s, = self.args
197+
if self.latex_output:
198+
s += "\n" + self.latex_output
199+
return s
200+
195201

196202
class LatexManager:
197203
"""
@@ -286,7 +292,7 @@ def __init__(self):
286292
stdout, stderr = latex.communicate(test_input)
287293
if latex.returncode != 0:
288294
raise LatexError("LaTeX returned an error, probably missing font "
289-
"or error in preamble:\n%s" % stdout)
295+
"or error in preamble.", stdout)
290296

291297
self.latex = None # Will be set up on first use.
292298
self.str_cache = {} # cache for strings already processed

0 commit comments

Comments
 (0)