Skip to content

Commit

Permalink
Merge pull request JelteF#184 from HassenPy/master
Browse files Browse the repository at this point in the history
raise a descriptive error when no compiler is installed
  • Loading branch information
JelteF authored Jun 10, 2017
2 parents 47a5bd4 + 7572ee2 commit 73d9a9e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pylatex/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from .base_classes import Environment, Command, Container, LatexObject, \
UnsafeCommand
from .package import Package
from .errors import CompilerError
from .utils import dumps_list, rm_temp_dir, NoEscape
import pylatex.config as cf

Expand Down Expand Up @@ -270,8 +271,12 @@ def generate_pdf(self, filepath=None, *, clean=True, clean_tex=True,
break

else:
# If none of the compilers worked, raise the last error
raise(os_error)
# Notify user that none of the compilers worked.
raise(CompilerError(
'No LaTex compiler was found\n' +
'Either specify a LaTex compiler ' +
'or make sure you have latexmk or pdfLaTex installed.'
))

os.chdir(cur_dir)

Expand Down
4 changes: 4 additions & 0 deletions pylatex/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class PyLaTeXError(Exception):
"""A Base class for all PyLaTeX Exceptions."""


class CompilerError(PyLaTeXError):
"""A Base class for all PyLaTeX compiler related Exceptions."""


class TableError(PyLaTeXError):
"""A Base class for all errors concerning tables."""

Expand Down

0 comments on commit 73d9a9e

Please sign in to comment.