/
exceptions.py
60 lines (36 loc) · 1.34 KB
/
exceptions.py
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
class RopeError(Exception):
"""Base exception for rope"""
class ResourceNotFoundError(RopeError):
"""Resource not found exception"""
class RefactoringError(RopeError):
"""Errors for performing a refactoring"""
class InterruptedTaskError(RopeError):
"""The task has been interrupted"""
class HistoryError(RopeError):
"""Errors for history undo/redo operations"""
class ModuleNotFoundError(RopeError):
"""Module not found exception"""
class AttributeNotFoundError(RopeError):
"""Attribute not found exception"""
class NameNotFoundError(RopeError):
"""Name not found exception"""
class BadIdentifierError(RopeError):
"""The name cannot be resolved"""
class ModuleSyntaxError(RopeError):
"""Module has syntax errors
The `filename` and `lineno` fields indicate where the error has
occurred.
"""
def __init__(self, filename, lineno, message):
self.filename = filename
self.lineno = lineno
self.message_ = message
super().__init__(
f"Syntax error in file <{filename}> line <{lineno}>: {message}"
)
class ModuleDecodeError(RopeError):
"""Cannot decode module"""
def __init__(self, filename, message):
self.filename = filename
self.message_ = message
super().__init__(f"Cannot decode file <{filename}>: {message}")