From: Peter Vandenabeele Date: 2012-01-13T21:22:01+09:00 Subject: Re: Problem with "Exception" - suddenly stopped working --20cf300faee358590204b667e93f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, Jan 13, 2012 at 12:23 PM, Abinoam Jr. wrote: > On Thu, Jan 12, 2012 at 8:45 PM, Panagiotis Atmatzidis > wrote: > > Hello, > > > > thanks all for the answers. > > > > On 12 =CE=99=CE=B1=CE=BD 2012, at 22:35 , Peter Vandenabeele wrote: > > > >> On Thu, Jan 12, 2012 at 10:33 PM, Peter Vandenabeele < > peter@vandenabeele.com > >>> wrote: > >> > >>> Very speculative ... could you ask it's ancestor tree? > >>> > >>> Twitter::Error::BadGateway.class > >>> > >> > >> Correction > >> > >> Twitter::Error::BadGateway.ancestors > >> > >> that is ... > >> > >> Peter > > > > > > Here is the ancestors output: > > > > greyjewel:Morula atma$ cat test.rb && ruby1.9 test.rb > > require "twitter" > > puts Twitter::Error::BadGateway.ancestors > > [...] > > Twitter::Error::BadGateway > > Twitter::Error::ServerError > > Twitter::Error > > StandardError > > Exception > > Object > > Kernel > > BasicObject > > greyjewel:Morula atma$ > > > > So my error is "BadGateway" but should I use this like: > > > > [...] > > rescue Exception =3D> (Twitter::Error::BadGateway) > I think that should be (untested) rescue Twitter::Error =3D> e and then you can do usefull things with 'e', preferably based on it's class= . e.to_s e.class > [...] > > > > I'm not sure where to go from here. > > (Bottom commenting. Thanks Peter). > > If you put Twitter::Error::BadGateway it'll treat only this particular > error. > > And there's much more. > > Look at the ones raised by the twitter gem itself. > > https://github.com/jnunemaker/twitter/tree/master/lib/twitter/error > > Indeed. Thanks for that pointer. So it seems rescue Twitter::Error should catch all exceptions from the Twitter gem. Curious if the OP was able to solve the problem now with mentioning an explicit Exception class? HTH, Peter --=20 Peter Vandenabeele http://twitter.com/peter_v http://rails.vandenabeele.com --20cf300faee358590204b667e93f--