Skip to content

Commit

Permalink
Display exitcode upon InvocationError.
Browse files Browse the repository at this point in the history
Thanks go to Daniel Hahler (blueyed): Issue tox-dev#290.
  • Loading branch information
ederag committed Jan 31, 2018
1 parent cd469df commit 17f0e6f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ class InterpreterNotFound(Error):

class InvocationError(Error):
""" an error while invoking a script. """
def __init__(self, *args):
super(exception.Error, self).__init__(*args)
self.command = args[0]
try:
self.exitcode = args[1]
except IndexError:
self.exitcode = None

def __str__(self):
if self.exitcode:
return "%s: %s (exitcode %d)" % (self.__class__.__name__,
self.command, self.exitcode)
return "%s: %s" % (self.__class__.__name__, self.command)

class MissingFile(Error):
""" an error while invoking a script. """
Expand Down

0 comments on commit 17f0e6f

Please sign in to comment.