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.
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.
On Thu, Jan 12, 2012 at 10:04 PM, Abinoam Jr. [email protected] wrote:
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.
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?
On Thu, Jan 12, 2012 at 10:33 PM, Peter V. <
Twitter::Error::BadGateway.ancestors
puts Twitter::Error::BadGateway.ancestors
and then you can do usefull things with ‘e’, preferably based on it’s class.
e.to_s
e.class
Thanks for the hint. Doesn’t work though. The script comes out with the
same error.
And there’s much more.
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
Thanks for the explanations. As a result I got a deeper understanding of
exceptions than before. However, I think the problem lies elsewhere.
The prior code had just a ‘rescue’ clause. As Peter said, it should work
with “Exception => e” also, although I don’t have any interest in
printing the error here. I’m using ‘retry’ for 3 times, then the program
exists with a message.
I have the feeling that for some reason the script breaks before
reaching the rescue keyword.
Thanks for the help. I’ll probably re-write the function from scratch,
see if I get the same errors.
Unfortunately (or fortunately) your script is working pretty well in my
setup.
Using /home/abinoam/.rvm/gems/ruby-1.9.2-p290
The installed gem is twitter 2.0.2.
And I couldn’t reproduce your bug.
But, note that you are redefining the update method. Line 36 and line
110.
The last one (the one that is really executed) lacks any begin, rescue
clause.
Unfortunately (or fortunately) your script is working pretty well in my setup.
Using /home/abinoam/.rvm/gems/ruby-1.9.2-p290
The installed gem is twitter 2.0.2.
And I couldn’t reproduce your bug.
But, note that you are redefining the update method. Line 36 and line 110.
The last one (the one that is really executed) lacks any begin, rescue clause.
Thanks for noting. This was pretty stupid of me. I have a second version
of this program which implements support for other protocols. Since
however I needed to calculate some stats just from twitter, I created
this script which will work just for twitter. I write code using
TextMate usually but recently I switched to VIM and I copied two times
the update method without noting, probably removing the begin/rescue
clause… Since I use small terminal window and moving with ‘/keywords’
in terminal I didn’t noticed
Thanks for pointing out, I feel a bit embarrassed. I was even about to
compile ruby-1.9.2 to check it if it was working with that version.
On Fri, Jan 13, 2012 at 1:37 PM, Panagiotis A. [email protected] wrote:
The wise man said: “Never argue with an idiot, he brings you down to his level
and beat you with experience.”
So… did it work this time?
Don’t be embarassed at all. And, I’m glad I could help.
For example, look at PeterVandenabeele, he complained of my
“top-commeting” in this thread. So I began “bottom-commenting” in
respect to him (and the standards fron somewhere).
BUT, he himself, at this same thread, top commented.
(I just could’n let this pass unoticed. Please don’t be upset with
Peter.)
On Fri, Jan 13, 2012 at 2:26 PM, Panagiotis A. [email protected]wrote:
I have the feeling that for some reason the script breaks before reaching
the rescue keyword.
Well, you could put ‘puts’ everywhere to check that …
Thanks for the help. I’ll probably re-write the function from scratch, see
if I get the same errors.
The only thing I can think of now is a bug that was reported some time
ago
where an
exception thrown in an ‘eval’ was not caught correctly … I googled for
it, but couldn’t
find it back immediately.
Also, what happens if you take it out of that “Benchmark” block? Just
guessing …
On Fri, Jan 13, 2012 at 8:32 PM, Abinoam Jr. [email protected] wrote:
…
For example, look at Peter V., he complained of my
“top-commeting” in this thread. So I began “bottom-commenting” in
respect to him (and the standards fron somewhere).
BUT, he himself, at this same thread, top commented.
No worries.
(Firstly) Just for my understanding, could you show me the message
where you saw me top commenting in this thread. I checked the
5 messages I sent earlier in this thread and could not immediately
find the one where I “top quoted”.
(I just could’n let this pass unoticed. Please don’t be upset with Peter.)
(Secondly) No problem again … sometimes, I do “top quote”, when it is
like a global answer on an entire thread (e.g. “OK with everything”).
and …
‘Thirdly, the [pirate] code is more what you’d call “guidelines” than
actual rules.’
(as a sailor I learned this from Captain Barbossa in the Pirates of the
Caribbean Pirate Code - YouTube (@ 0:12) )
(Firstly) Just for my understanding, could you show me the message
where you saw me top commenting in this thread. I checked the
5 messages I sent earlier in this thread and could not immediately
find the one where I “top quoted”.
No, I just can’t show you the message.
Just because now you made me notice that I was mistaken!!! (._.)
Peter, you’re completly right.
What a shame of mine.
The new layout of GMail has fooled me a little.
It has hidden the text before you’re reply, so it seemed to me that
you had top commented (because the text before it was hidden).
By the way, I was just joking/kidding.
And I really thank you your advise.
I’m pretty “hard wired” on top-commenting and it’ll be hard to get
used to bottom-commenting.
But, as a proof, look at this message… https://www.ruby-forum.com/topic/3426196#1040756
It was after your advise to bottom-comment. It was me trying to get
used to it.
No, I just can’t show you the message.
used to bottom-commenting.
But, as a proof, look at this message… Undefined method `[]=' for nil:NilClass - Ruby - Ruby-Forum
It was after your advise to bottom-comment. It was me trying to get
used to it.
Just to add my two cents on this off-topic thread, in mailing lists like
“sikurezza” [1] you don’t get passed through the moderator using top
quoting. It’s standard netiquette.
On hindsight, no one will moderate your emails if you do it here hehe,
so don’t bother, it’s not a big deal imho.