From: Peter Vandenabeele Date: 2012-01-13T06:33:45+09:00 Subject: Re: Problem with "Exception" - suddenly stopped working --00235447105c96dc0504b65b808d Content-Type: text/plain; charset=UTF-8 On Thu, Jan 12, 2012 at 10:04 PM, Abinoam Jr. wrote: > IMHO ~PERHAPS~ the begin rescue is not working because the exception > is not being propagated or the process is being abruptly terminated > (without raising exceptions). (Note: no experience with this gem) > > Let's see if somebody else more experienced knows the answer. > > Meantime, look at this code as an example. > > http://codepad.org/f4g9BIEa > > Abinoam Jr. > Hi Abinoam, it is easier to follow the thread if you would write your reply on the bottom (ref. "no top quoting"). I continue below. > On Thu, Jan 12, 2012 at 2:01 PM, Panagiotis Atmatzidis > wrote: > > Hello, > > > > I'm having a hard time with an exception handling. It's part of a simple > ruby script which fetches user's tweets and dumps into an SQLite3 database. > > > > The code and the error can be found here: > http://codepad.org/WQN2cYfi#comment-5lrGPpKo > > > > The strange thing is that it was working fine and suddenly stopped. I > can't recall making an changes related to this code snippet which could > affect it's behavior. > > > > Any help/thoughts would be welcome, > It looks like the actual "exception" (I quote it because I am not sure _what_ it is), is called: Twitter::Error::BadGateway Very speculative ... could you ask it's ancestor tree? Twitter::Error::BadGateway.class Like this: peterv@ASUS:~$ irb 001:0> Exception.ancestors => [Exception, Object, Kernel, BasicObject] 002:0> RuntimeError => RuntimeError 003:0> RuntimeError.ancestors => [RuntimeError, StandardError, Exception, Object, Kernel, BasicObject] 004:0> RuntimeError.new.kind_of?(Exception) => true 005:0> RUBY_VERSION => "1.9.3" Maybe (??) it does not inherit from Exception (the actual class) ?? Very speculative ... I believe an exception will only be trapped by the `rescue Something` if the "exception.is_a?(Something)" HTH (but not sure), Peter -- Peter Vandenabeele http://twitter.com/peter_v http://rails.vandenabeele.com --00235447105c96dc0504b65b808d--