diff --git a/lib/ri_cal/parser.rb b/lib/ri_cal/parser.rb index 99d3dd10..fcb177c6 100644 --- a/lib/ri_cal/parser.rb +++ b/lib/ri_cal/parser.rb @@ -2,6 +2,8 @@ module RiCal #- ©2009 Rick DeNatale #- All rights reserved. Refer to the file README.txt for the license # + class ParseError < StandardError; end + class Parser # :nodoc: attr_reader :last_line_str #:nodoc: def next_line #:nodoc: @@ -87,7 +89,7 @@ def self.parse(io = StringIO.new("")) #:nodoc: end def invalid #:nodoc: - raise Exception.new("Invalid icalendar file") + raise ParseError.new("Invalid icalendar file") end def still_in(component, separated_line) #:nodoc: @@ -142,4 +144,4 @@ def parse_one(start, parent_component) #:nodoc: result end end -end \ No newline at end of file +end diff --git a/spec/ri_cal/parser_spec.rb b/spec/ri_cal/parser_spec.rb index dd8656d3..d135927b 100644 --- a/spec/ri_cal/parser_spec.rb +++ b/spec/ri_cal/parser_spec.rb @@ -120,7 +120,7 @@ def self.describe_named_property(entity_name, prop_text, prop_name, params, valu it "should reject a file which doesn't start with BEGIN" do parser = RiCal::Parser.new(StringIO.new("END:VCALENDAR")) - lambda {parser.parse}.should raise_error + lambda {parser.parse}.should raise_error(RiCal::ParseError) end describe "parsing an event" do