title: Uninitialized Constant Error when catching Exception
body: <p>I need to post articles to Wordpress via XMLRPC and catch any exceptions:</p>
  
  <pre><code>connection = XMLRPC::Client.new('mysite.com', '/xmlrpc.php', 80)
    connection.call(
    'metaWeblog.newPost',
    1,
    'user',
    'password',
    post,
    true
  )
  </code></pre>
  
  <p>There is en error:</p>
  
  <pre><code>C:/Ruby192/lib/ruby/1.9.1/rexml/parsers/baseparser.rb:441:in `rescue in pull': #&lt;NoMethodError: undefined method `[]' for nil:NilClass&gt; (REXML::ParseException)
  C:/Ruby192/lib/ruby/1.9.1/rexml/parsers/baseparser.rb:341:in `pull'
  C:/Ruby192/lib/ruby/1.9.1/rexml/parsers/streamparser.rb:16:in `parse'
  C:/Ruby192/lib/ruby/1.9.1/rexml/document.rb:204:in `parse_stream'
  C:/Ruby192/lib/ruby/1.9.1/xmlrpc/parser.rb:717:in `parse'
  C:/Ruby192/lib/ruby/1.9.1/xmlrpc/parser.rb:460:in `parseMethodResponse'
  C:/Ruby192/lib/ruby/1.9.1/xmlrpc/client.rb:421:in `call2'
  C:/Ruby192/lib/ruby/1.9.1/xmlrpc/client.rb:410:in `call'
  </code></pre>
  
  <p>I successfully caught the exception with:</p>
  
  <pre><code>connection = XMLRPC::Client.new('mysite.com', '/xmlrpc.php', 80)
  begin
    connection.call(
      'metaWeblog.newPost',
      1,
      'user',
      'password',
      post,
      true
    )
  rescue REXML::ParseException
    puts "Skipping error"
  end
  </code></pre>
  
  <p>Post is OK, article is in Wordpress.</p>
  
  <p>Next I needed to catch an exception about site availability (when site is not accessible)
  I tried to catch the exception with:</p>
  
  <pre><code>connection = XMLRPC::Client.new('notaccessibleSite.com', '/xmlrpc.php', 80)
  begin
    connection.call(
      'metaWeblog.newPost',
      1,
      'user',
      'password',
      post,
      true
    )
  rescue REXML::ParseException
    puts "Skipping error"
  rescue
    puts "Others errors"
  end
  </code></pre>
  
  <p>But this does not work:</p>
  
  <pre><code>myscript.rb:47:in `rescue in makeRpc': uninitialized constant Object::REXML (NameError)
  from myscript.rb:38:in `makeRpc'
  from myscript.rb:62:in `block in postContent'
  from myscript.rb:58:in `each'
  from myscript.rb:58:in `postContent'
  from myscript.rb:71:in `&lt;top (required)&gt;'
  from -e:1:in `load'
  from -e:1:in `&lt;main&gt;'
  </code></pre>
  
  <p>Any suggestions?</p>