exceptions.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. class RopeError(Exception):
  2. """Base exception for rope"""
  3. class ResourceNotFoundError(RopeError):
  4. """Resource not found exception"""
  5. class RefactoringError(RopeError):
  6. """Errors for performing a refactoring"""
  7. class InterruptedTaskError(RopeError):
  8. """The task has been interrupted"""
  9. class HistoryError(RopeError):
  10. """Errors for history undo/redo operations"""
  11. class ModuleNotFoundError(RopeError):
  12. """Module not found exception"""
  13. class AttributeNotFoundError(RopeError):
  14. """Attribute not found exception"""
  15. class NameNotFoundError(RopeError):
  16. """Name not found exception"""
  17. class BadIdentifierError(RopeError):
  18. """The name cannot be resolved"""
  19. class ModuleSyntaxError(RopeError):
  20. """Module has syntax errors
  21. The `filename` and `lineno` fields indicate where the error has
  22. occurred.
  23. """
  24. def __init__(self, filename, lineno, message):
  25. self.filename = filename
  26. self.lineno = lineno
  27. self.message_ = message
  28. super(ModuleSyntaxError, self).__init__(
  29. 'Syntax error in file <%s> line <%s>: %s' %
  30. (filename, lineno, message))
  31. class ModuleDecodeError(RopeError):
  32. """Cannot decode module"""
  33. def __init__(self, filename, message):
  34. self.filename = filename
  35. self.message_ = message
  36. super(ModuleDecodeError, self).__init__(
  37. 'Cannot decode file <%s>: %s' % (filename, message))