/usr/lib/python2.7/dist-packages/doit/exceptions.py is in python-doit 0.25.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | """Handle exceptions generated from 'user' code"""
import sys
import traceback
class InvalidCommand(Exception):
"""Invalid command line argument."""
pass
class InvalidDodoFile(Exception):
"""Invalid dodo file"""
pass
class InvalidTask(Exception):
"""Invalid task instance. User error on specifying the task."""
pass
class CatchedException(object):
"""This used to save info from catched exceptions
The traceback from the original exception is saved
"""
def __init__(self, msg, exception=None):
self.message = msg
self.traceback = ''
if isinstance(exception, CatchedException):
self.traceback = exception.traceback
elif exception is not None:
# TODO remove doit-code part from traceback
self.traceback = traceback.format_exception(
exception.__class__, exception, sys.exc_info()[2])
def get_msg(self):
"""return full exception description (includes traceback)"""
return "%s\n%s" % (self.message, "".join(self.traceback))
def get_name(self):
"""get Exception name"""
return self.__class__.__name__
def __repr__(self):
return "(<%s> %s)" % (self.get_name(), self.message)
def __str__(self):
return "%s\n%s" % (self.get_name(), self.get_msg())
class TaskFailed(CatchedException):
"""Task execution was not successful."""
pass
class UnmetDependency(TaskFailed):
"""Task was not executed because a dependent task failed or is ignored"""
pass
class TaskError(CatchedException):
"""Error while trying to execute task."""
pass
class SetupError(CatchedException):
"""Error while trying to execute setup object"""
pass
class DependencyError(CatchedException):
"""Error while trying to check if task is up-to-date"""
pass
|