Error with the PUTS and invalid variables

Discussion in 'Ruby' started by Ramza Brown, Apr 18, 2006.

  1. Ramza Brown

    Ramza Brown Guest

    Ignore the code itself.
    puts "ERR: Could not parse document #{truncate(url)}"

    But, I have noticed that whenever I have errors for example with
    variables inside a string like above.

    #{truncate(url)}

    Here, I don't have a truncate method, so basically Ruby just stops. I
    don't get an error and just guessed that is where the problem was?

    That ruby hangs and doesnt produce an error. For example; I am also
    working with threads so I can continue it is just hard to debug.

    In anycase; why wouldnt an error be produced. Is there anything else
    there that might just make Ruby stop?

    def connect_http(url, id)
    begin
    puts "#{' '*8} #{id} process #{url}"
    fetch_http_document(url)
    rescue
    puts "ERR: Could not parse document #{truncate(url)}"
    puts "ERR: " + $!
    end
    end


    --
    Berlin Brown
    (ramaza3 on freenode)
    http://www.newspiritcompany.com
    http://www.newspiritcompany.com/newforums
    also checkout alpha version of botverse:
    http://www.newspiritcompany.com:8086/universe_home
    Ramza Brown, Apr 18, 2006
    #1
    1. Advertising

  2. Ramza Brown

    ts Guest

    >>>>> "R" == Ramza Brown <> writes:

    R> That ruby hangs and doesnt produce an error. For example; I am also
    R> working with threads so I can continue it is just hard to debug.

    Use Thread#abort_on_exception with threads

    moulon% ruby -e 'Thread.new { puts "#{truncate(1)}" }'
    moulon%

    moulon% ruby -e 'Thread.abort_on_exception = true; Thread.new { puts "#{truncate(1)}" }'
    -e:1: undefined method `truncate' for main:Object (NoMethodError)
    from -e:1
    moulon%

    --

    Guy Decoux
    ts, Apr 18, 2006
    #2
    1. Advertising

  3. Ramza Brown

    Berlin Brown Guest

    Hmm, didnt know about this.
    Berlin Brown, Apr 19, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick.O.Ige
    Replies:
    1
    Views:
    1,939
    Patrick.O.Ige
    Jul 2, 2006
  2. Java Guy
    Replies:
    1
    Views:
    665
    Manish Pandit
    Oct 15, 2006
  3. kevin
    Replies:
    0
    Views:
    954
    kevin
    Jan 16, 2008
  4. Michael Brooks
    Replies:
    22
    Views:
    392
    Rick DeNatale
    Mar 27, 2007
  5. Raj Singh
    Replies:
    4
    Views:
    134
    Ryan Ingram
    Jan 29, 2008
Loading...

Share This Page