Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7652301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:43:56+00:00 2026-05-31T11:43:56+00:00

I have a script that calls the facebook test api to automate test account

  • 0

I have a script that calls the facebook test api to automate test account creation. At seemingly random interval, from either after 50 requests to 6000 requests, I get an exception that isn’t caught. I’m at a loss for how to figure out what the error is, so I’ll start with the relevant code here.

I’m not using the URI library because facebook keys have the pipe character that breaks URI.parse for ruby 1.8.7.

require 'rubygems'
require 'net/https'
require 'json'



http = Net::HTTP.new(domain, 443)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

def request_wrapper(http, request)
  retry_count = 5
  begin
    return http.request(request)
    rescue Exception => e
    retry_count--
    if retry_count < 0
      raise e
    end
  retry
end



for i in 0..500 do
    request = Net::HTTP::Get.new('https://' + domain + path)
    response = request_wrapper(http, request)
end

The code will work for some time, but always inevitably reports the following:

in rescue in request_wrapper': undefined method-@’ for nil:NilClass
(NoMethodError)

Anyone ever seen this undefined method ‘-@’ before? Again, this happens very intermittently, but it’s been a real thorn in my side. It always point to the line in the code where I am calling the request wrapper.

Thanks for taking a look.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T11:43:57+00:00Added an answer on May 31, 2026 at 11:43 am

    The problem is with the line retry_count--. This line gets evaluated only when a failed HTTP request raises an Exception, which explains why it occurs intermittently.

    Ruby does not have a unary decrement (--) or increment (++) operator. Matz has outlined the philosophical reasons behind this here. Also see this thread and this one for more information.

    Instead, retry_count -= 1 should do the job.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script that calls the Google API server to return the top
I have a script that calls an application that requires user input, e.g. run
I have a Python script that calls an executable program with various arguments (in
I have a batch script that calls a process and currently it waits for
I have a bash script that simply calls different calls and redirect stdout and
I have a Perl/POE/Tk script running on Win32 ActivePerl that calls executables using system
I have the following simple python test script that uses Suds to call a
I have a script that calls a bash script that does some processing, but
I have this script that calls a .net WebService msg = $.toJSON( $.ajax({ type:
I have a PowerShell script that calls a CmdLet which in turn reports its

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.