On 10/3/07, David Flanagan <david / davidflanagan.com> wrote:
> I finally figured this out. The problem in is
> lib/rdoc/parsers/parse_rb.rb.  That file tries to catch NameError (for
> undefined constants) with a bare rescue clause.  But in Ruby 1.9,
> NameError has moved to ScriptError instead of StandardError, so it no
> longer gets caught.
>
> The attached patch fixes the problem for me, and I can now successfully
> run 'make install'
>
>         David
>
>
>
> Index: lib/rdoc/parsers/parse_rb.rb
> ===================================================================
> --- lib/rdoc/parsers/parse_rb.rb        (revision 13610)
> +++ lib/rdoc/parsers/parse_rb.rb        (working copy)
> @@ -1909,9 +1909,13 @@
>            container = container.find_module_named(name_t.name)
>            if !container
>              added_container = true
> -            obj = name_t.name.split("::").inject(Object) do |state, item|
> -              state.const_get(item)
> -            end rescue nil
> +            begin
> +              obj = name_t.name.split("::").inject(Object) do |state, item|
> +                state.const_get(item)
> +              end
> +            rescue Exception
> +              nil  # Ignore any exception in the above
> +            end
>
>              type = obj.class == Class ? NormalClass : NormalModule
>              if not [Class, Module].include?(obj.class)
>
>

Do we really want to be catching and suppressing all Exceptions there?
I would think that specifically rescuing from NameError would be
better...

Jacob Fugal