From: Austin Ziegler Date: 2005-02-05T07:28:30+09:00 Subject: Re: [BUG] RubyGems: "No such file to load -- rubygems/builder" On Sat, 5 Feb 2005 06:20:15 +0900, Erik Veenstra wrote: >> This is a bug, and I'm not sure the best way to handle this -- >> but the real problem is the way that Debian-family Linuxes >> package Ruby. > I disagree. This example is a result of the strange Ruby packages > on Debian systems. That's true. But the same problem can occur in > other situations as well. The way the require method of RubyGems > catches the LoadError exception is the real problem. It's not the only one. Any time *anything* catches a LoadError, the real exception can be hidden, which is why I said I'm not sure the best way to handle this. I faced something similar to this in Ruwiki (because I have a fairly sophisticated require technique to try to discover things in various places since Ruwiki can be installed in multiple fashions), and I'm not sure I'm happy with the result that I managed there, either. In part, one might argue that silently catching a LoadError is a bad thing. In some testing code that I have for Text::Format, I do: begin require 'text/hyphen' hy = Text::Hyphen.new rescue LoadError begin require 'tex/hyphen' hy = TeX::Hyphen.new rescue LoadError print 'S' return true end end This way, I can exercise the external interfacing of Text::Format with one of the two available hyphenation libraries -- but I lie to test/unit in order to do so, sort of. However, if the require of text/hyphen failed for a reason *other* than text/hyphen not being installed (e.g., text/hyphen required a library that it currently doesn't but is broken because of Debian packaging decisions, for example), this test program would hide that. As I said, I'm not sure *how* it should deal with this. Perhaps a variant of LoadError that chains the pieces together, e.g., class GemLoadError < LoadError; end and set it up to keep track of any other LoadError or GemLoadError caught? -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca