More error backtrace

Ask a Question related to Ruby, Design and Development.

  1. #1

    Default More error backtrace

    I am having trouble tracking down the point at which my program is
    failing. I have a backtrace that looks like this:

    /usr/local/lib/ruby/1.6/net/protocol.rb:468:in `new': wrong argument
    type nil (expected String) (TypeError)
    from /usr/local/lib/ruby/1.6/net/protocol.rb:468:in `connect'
    from /usr/local/lib/ruby/1.6/net/protocol.rb:467:in `timeout'
    from /usr/local/lib/ruby/1.6/net/protocol.rb:467:in `connect'
    from /usr/local/lib/ruby/1.6/net/protocol.rb:449:in `initialize'
    from /usr/local/lib/ruby/1.6/net/protocol.rb:149:in `new'
    from /usr/local/lib/ruby/1.6/net/protocol.rb:149:in
    `conn_socket'
    from /usr/local/lib/ruby/1.6/net/http.rb:499:in `do_start'
    from /usr/local/lib/ruby/1.6/net/protocol.rb:131:in `start'
    ... 6 levels...
    from webcount.rb:556:in `each'
    from webcount.rb:556:in `wayback'
    from webcount.rb:703:in `dosite'
    from webcount.rb:813

    What I need to know are which lines of code are represented by "... 6
    levels...". Is there any way of stopping ruby from abbreviating the
    backtrace like this?

    (I'm using ruby 1.6.8 (2002-12-24) [powerpc-darwin6.6])

    Thanks

    Nigel


    Nigel Gilbert Guest

  2. Similar Questions and Discussions

    1. #40765 [NEW]: calling backtrace inside nested static class functions causes segfault
      From: ndroege at bimp dot de Operating system: linux debian PHP version: 5.2.1 PHP Bug Type: Reproducible crash Bug...
    2. Error 403 Failed to read heders Error for long-runningCFMAIL and CFINDEX command
      I have two different pages with long-running scripts on which I am recieving the following error: Error - 403 Failed to read headers to server:...
    3. Error Creating Control: Parser Error DocHeader does not have a property named 'cc3:MyItems'
      I am having problems getting this webcontrol working properly. Everything else works fine except having items. So here is the low-down on the...
    4. exception backtrace for ruby/tk programs
      Hello, I suffered with really hard debugging sessions when an unexpected exception was thrown from a ruby callback in a ruby/tk application, as...
    5. An error occurred while try to load the string resources (GetModuleHandle failed with error -2147023888)
      Hello, on one of our customers servers we get following error on first ASPX-page: An error occurred while try to load the string resources...
  3. #2

    Default Re: More error backtrace

    It is the default exception handling in Ruby. You can always embrace your
    program
    in

    begin
    ...
    rescure Exception => exception
    p exception.message
    p exception.backtrace # or present it in any other way you like
    end

    Gennady

    ----- Original Message -----
    From: "Nigel Gilbert" <n.gilbert@soc.surrey.ac.uk>
    To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
    Sent: Wednesday, July 02, 2003 2:43 PM
    Subject: More error backtrace

    > I am having trouble tracking down the point at which my program is
    > failing. I have a backtrace that looks like this:
    >
    > /usr/local/lib/ruby/1.6/net/protocol.rb:468:in `new': wrong argument
    > type nil (expected String) (TypeError)
    > from /usr/local/lib/ruby/1.6/net/protocol.rb:468:in `connect'
    > from /usr/local/lib/ruby/1.6/net/protocol.rb:467:in `timeout'
    > from /usr/local/lib/ruby/1.6/net/protocol.rb:467:in `connect'
    > from /usr/local/lib/ruby/1.6/net/protocol.rb:449:in `initialize'
    > from /usr/local/lib/ruby/1.6/net/protocol.rb:149:in `new'
    > from /usr/local/lib/ruby/1.6/net/protocol.rb:149:in
    > `conn_socket'
    > from /usr/local/lib/ruby/1.6/net/http.rb:499:in `do_start'
    > from /usr/local/lib/ruby/1.6/net/protocol.rb:131:in `start'
    > ... 6 levels...
    > from webcount.rb:556:in `each'
    > from webcount.rb:556:in `wayback'
    > from webcount.rb:703:in `dosite'
    > from webcount.rb:813
    >
    > What I need to know are which lines of code are represented by "... 6
    > levels...". Is there any way of stopping ruby from abbreviating the
    > backtrace like this?
    >
    > (I'm using ruby 1.6.8 (2002-12-24) [powerpc-darwin6.6])
    >
    > Thanks
    >
    > Nigel
    >
    >
    >

    Gennady Guest

  4. #3

    Default Re: More error backtrace

    On Thu, 03 Jul 2003 07:43:03 +0900, Nigel Gilbert wrote:
    > What I need to know are which lines of code are represented by "... 6
    > levels...". Is there any way of stopping ruby from abbreviating the
    > backtrace like this?
    You will need to catch ALL exceptions yourself... like this:
    > ruby x.rb
    Fatal-Error in program!
    please report this bug.
    EXCEPTION:
    RuntimeError
    MESSAGE:
    hello world
    BACKTRACE:
    x.rb:2
    >
    > cat x.rb
    begin
    raise "hello world"
    rescue Exception => e
    puts <<MSG
    Fatal-Error in program!
    please report this bug.
    EXCEPTION:
    \t#{e.class.to_s}
    MESSAGE:
    \t#{e.message}
    BACKTRACE:
    #{e.backtrace.map{|t|"\t#{t}\n"}.join}
    MSG
    end
    >

    --
    Simon Strandgaard
    Simon Strandgaard Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139