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.
Ruby code by abinoam - 15 lines - codepad
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.
> 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:
Ruby code - 40 lines - codepad
>
> 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
···
On Thu, Jan 12, 2012 at 10:04 PM, Abinoam Jr. <abinoam@gmail.com> wrote:
On Thu, Jan 12, 2012 at 2:01 PM, Panagiotis Atmatzidis > <ml@convalesco.org> wrote:
--
Peter Vandenabeele
http://twitter.com/peter_v
http://rails.vandenabeele.com