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 CHANGED
@@ -32,7 +32,15 @@ module SPF
32
32
  ##############################################################################
33
33
 
34
34
  class NothingToParseError < Error; end # Nothing to parse
35
- class SyntaxError < Error; end # Generic syntax 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
@@ -1,5 +1,5 @@
1
1
  module SPF
2
- VERSION = '0.0.24'
2
+ VERSION = '0.0.25'
3
3
  end
4
4
 
5
5
  # vim:sw=2 sts=2
data/spf.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "spf"
8
- s.version = "0.0.24"
8
+ s.version = "0.0.25"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrew Flury", "Julian Mehnle"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.24
4
+ version: 0.0.25
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: