public
Fork of rubys/mars
Description: Yet Another Planet Refactoring
Homepage: http://intertwingly.net/blog/2007/12/19/Yet-Another-Planet-Refactoring
Clone URL: git://github.com/technomancy/mars.git
be a bit more careful about raising Exception
technomancy (author)
Thu Jun 26 17:49:48 -0700 2008
commit  d03e9bcd0a0b3a07c01d4db6647695589e5d5576
tree    bcf24f9d341ccba6fa185f129624a92ba9e3bc65
parent  71c625aa563b43acff9a6594e50253c22b91caec
...
32
33
34
35
36
 
 
 
 
 
37
38
39
...
142
143
144
145
 
146
147
148
149
 
150
151
152
...
32
33
34
 
 
35
36
37
38
39
40
41
42
...
145
146
147
 
148
149
150
151
 
152
153
154
155
0
@@ -32,8 +32,11 @@ module Planet
0
         end
0
         bozo = false
0
       rescue Exception => e
0
- # TODO: never, never, never rescue Exception. This breaks Ctrl-C and a bunch of other things.
0
- # At least only rescue it if expat is being used since other libs are smart enough never to raise it.
0
+ # Rescuing Exception is a Really Bad Idea, but unfortunately
0
+ # Expat raises it when it shouldn't. So we re-raise exceptions
0
+ # that aren't subclasses of StandardError unless Expat is
0
+ # being used.
0
+ raise e unless @@parser == :expat or e.is_a? StandardError
0
         
0
         # If everything is being bozo'd, enable this to see why.
0
         # print "PARSE ERROR: #{$!}\n #{$!.backtrace.join("\n ")}\n"
0
@@ -142,11 +145,11 @@ module Planet
0
         end
0
 
0
         def on_parser_error(message)
0
- raise Exception.new(message)
0
+ raise message
0
         end
0
 
0
         def on_parser_fatal_error(message)
0
- raise Exception.new(message)
0
+ raise message
0
         end
0
 
0
         def on_external_subset(name, externalId, systemId)

Comments

    No one has commented yet.