Patches: Browse | Submit New | Admin

[#23730] not rescuing correct errors

Date:
2009-01-28 15:46
Priority:
3
Submitted By:
Nobody
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
not rescuing correct errors

Detailed description
I have been using cucumber recently (http://cukes.info/). It indirectly depends on the Polyglot gem that you are maintaining.
I had a problem today! My application uses certain parts of rails that depend on certain errors being raised. When I
took a look at lib/polyglot.rb it seems that it is the intention to re-raise the original error. However, by using just
"rescue" on line 57, only errors that inherit from StandardError are being caught. This means that any errors
that inherit from ScriptError (including LoadError and MissingSourceFile) won't be caught and the original error won't
be re-raised.

I believe the attached patch addresses the issue by specifically rescuing LoadError.

Add A Comment: Notepad

Please login


Followup

Message
Date: 2009-01-28 15:51
Sender: P C

I am sorry that I didn't upload the patch originally. Here it is



Index: lib/polyglot.rb
=================================================================
==
--- lib/polyglot.rb	(revision 9)
+++ lib/polyglot.rb	(working copy)
@@ -54,7 +54,7 @@
   rescue LoadError => load_error
     begin
       Polyglot.load(*a, &b)
-    rescue
+    rescue LoadError 
       # Raise the original exception, possibly a MissingSourceFile
with a path
       raise load_error
     end

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item