File tree Expand file tree Collapse file tree 4 files changed +12
-5
lines changed Expand file tree Collapse file tree 4 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 6
6
from ..formatter .annotation import STANDALONE_ANNOTATIONS
7
7
8
8
from .utils import find_name_token_among_children , find_tree_among_children
9
+ from .exceptions import GDToolkitError
9
10
10
11
11
12
# pylint: disable-next=too-few-public-methods
@@ -113,7 +114,7 @@ def __init__(self, parse_tree: Tree):
113
114
elif parse_tree .data == "class_def" :
114
115
self ._load_data_from_class_def (parse_tree )
115
116
else :
116
- raise Exception ("Cannot load class from that node" )
117
+ raise GDToolkitError ("Cannot load class from that node" )
117
118
118
119
def _load_data_from_node_children (self , node : Tree ) -> None :
119
120
offset = 1 if node .data == "class_def" else 0
Original file line number Diff line number Diff line change 1
1
import lark
2
2
3
3
4
+ class GDToolkitError (Exception ):
5
+ pass
6
+
7
+
4
8
def lark_unexpected_input_to_str (exception : lark .exceptions .UnexpectedInput ):
5
9
return str (exception ).strip ()
6
10
Original file line number Diff line number Diff line change 1
1
from dataclasses import dataclass
2
2
3
+ from ..common .exceptions import GDToolkitError
4
+
3
5
4
6
@dataclass
5
- class TreeInvariantViolation (Exception ):
7
+ class TreeInvariantViolation (GDToolkitError ):
6
8
diff : str
7
9
8
10
def __str__ (self ):
9
11
return '{}(diff="{}")' .format ("TreeInvariantViolation" , self .diff )
10
12
11
13
12
14
@dataclass
13
- class FormattingStabilityViolation (Exception ):
15
+ class FormattingStabilityViolation (GDToolkitError ):
14
16
diff : str
15
17
16
18
def __str__ (self ):
17
19
return '{}(diff="{}")' .format ("FormattingStabilityViolation" , self .diff )
18
20
19
21
20
22
@dataclass
21
- class CommentPersistenceViolation (Exception ):
23
+ class CommentPersistenceViolation (GDToolkitError ):
22
24
missing_comment : str
23
25
24
26
def __str__ (self ):
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ def test_parsing_failure(gdscript_nok_path):
58
58
parser .parse (code )
59
59
except : # pylint: disable=bare-except
60
60
return
61
- raise Exception ( "shall fail" )
61
+ assert True , "shall fail"
62
62
63
63
64
64
@pytest .mark .skipif (shutil .which (GODOT_SERVER ) is None , reason = "requires godot server" )
You can’t perform that action at this time.
0 commit comments