spf 0.0.24 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/spf/error.rb +9 -1
- data/lib/spf/model.rb +2 -2
- data/lib/spf/version.rb +1 -1
- data/spf.gemspec +1 -1
- metadata +1 -1
data/lib/spf/error.rb
CHANGED
@@ -32,7 +32,15 @@ module SPF
|
|
32
32
|
##############################################################################
|
33
33
|
|
34
34
|
class NothingToParseError < Error; end # Nothing to parse
|
35
|
-
class SyntaxError < Error
|
35
|
+
class SyntaxError < Error # Generic syntax error
|
36
|
+
attr_accessor :text, :parse_text
|
37
|
+
def initialize(message, text=nil, parse_text=nil)
|
38
|
+
@text = text
|
39
|
+
@parse_text = parse_text
|
40
|
+
super(message)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
36
44
|
class InvalidRecordVersionError < SyntaxError; end # Invalid record version
|
37
45
|
class InvalidScopeError < SyntaxError; end # Invalid scope
|
38
46
|
class JunkInRecordError < SyntaxError; end # Junk encountered in record
|
data/lib/spf/model.rb
CHANGED
@@ -299,7 +299,7 @@ class SPF::Mech < SPF::Term
|
|
299
299
|
|
300
300
|
def parse_end
|
301
301
|
unless @parse_text == ''
|
302
|
-
error(SPF::JunkInTermError.new("Junk encountered in mechanism '#{@text}'"))
|
302
|
+
error(SPF::JunkInTermError.new("Junk encountered in mechanism '#{@text}'", @text, @parse_text))
|
303
303
|
end
|
304
304
|
@parse_text = nil
|
305
305
|
end
|
@@ -931,7 +931,7 @@ class SPF::Record
|
|
931
931
|
end
|
932
932
|
|
933
933
|
else
|
934
|
-
raise SPF::JunkInRecordError.new("Junk encountered in record '#{@text}'")
|
934
|
+
raise SPF::JunkInRecordError.new("Junk encountered in record '#{@text}'", @text, @parse_text)
|
935
935
|
end
|
936
936
|
@errors.concat(term.errors)
|
937
937
|
return term
|
data/lib/spf/version.rb
CHANGED
data/spf.gemspec
CHANGED