@@ -27,11 +27,58 @@ class NoScenariosFound(Exception):
27
27
"""No scenarios found."""
28
28
29
29
30
- class FeatureError (Exception ):
31
- """Feature parse error ."""
30
+ class GherkinParseError (Exception ):
31
+ """Base class for all Gherkin parsing errors ."""
32
32
33
- message = "{0}.\n Line number: {1}.\n Line: {2}.\n File: {3}"
33
+ def __init__ (self , message , line , line_content , filename ):
34
+ super ().__init__ (message )
35
+ self .message = message
36
+ self .line = line
37
+ self .line_content = line_content
38
+ self .filename = filename
39
+ self .line = line
40
+ self .line_content = line_content
41
+ self .filename = filename
34
42
35
- def __str__ (self ) -> str :
36
- """String representation."""
37
- return self .message .format (* self .args )
43
+ def __str__ (self ):
44
+ return f"{ self .__class__ .__name__ } : { self .message } \n Line number: { self .line } \n Line: { self .line_content } \n File: { self .filename } "
45
+
46
+
47
+ class FeatureError (GherkinParseError ):
48
+ pass
49
+
50
+
51
+ class BackgroundError (GherkinParseError ):
52
+ pass
53
+
54
+
55
+ class ScenarioOutlineError (GherkinParseError ):
56
+ pass
57
+
58
+
59
+ class ScenarioError (GherkinParseError ):
60
+ pass
61
+
62
+
63
+ class ExamplesError (GherkinParseError ):
64
+ pass
65
+
66
+
67
+ class StepError (GherkinParseError ):
68
+ pass
69
+
70
+
71
+ class TagError (GherkinParseError ):
72
+ pass
73
+
74
+
75
+ class RuleError (GherkinParseError ):
76
+ pass
77
+
78
+
79
+ class DocStringError (GherkinParseError ):
80
+ pass
81
+
82
+
83
+ class TokenError (GherkinParseError ):
84
+ pass
0 commit comments