“Twitter::Error::ClientError” - when no internet connection is available
and
“Twitter::Error::NotFound” - when username is not found, the supplied
twitter username does not exist.
However, no matter what the program goes with the 1st exception. Even
when the error is “Twitter::Error::NotFound”.
However, no matter what the program goes with the 1st exception. Even when the
error is “Twitter::Error::NotFound”.
What am I doing wrong?
You are not doing anything wrong. This is happening because
Twitter::Error::NotFound inherits from Twitter::Error::ClientError and rescue will rescue any subclasses of the provided class.
“Twitter::Error::NotFound” - when username is not found, the supplied twitter
username does not exist.
However, no matter what the program goes with the 1st exception. Even when the
error is “Twitter::Error::NotFound”.
What am I doing wrong?
You are not doing anything wrong. This is happening because
Twitter::Error::NotFound inherits from Twitter::Error::ClientError and rescue
will rescue any subclasses of the provided class.
Try reversing the order of your rescue clauses.
Thanks for the prompt reply! It worked fine!
-Justin
Panagiotis A.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.