Wednesday 15 February 2012

ruby on rails - How to deal with API raises in general but more specifically from Twitter -


So I'm really new to this thing, which are errors that can increase the API,

For example, I am using Twitter GEM, and if I want to like the tweet, then delete my page in tweet and I get 500 and I get it:

  ActionView :: Template :: Error (No status was found with that ID.)  

What I'm thinking is that I How to write codes, which can deal with these errors, say that I give an array of 2 aids, where the first does not work and the second is not. Ideally I want to leave it one before, though with the current situation all this will be closed together.

There is some problem that I can, but I'm not sure what it is called.

Usually you will write something to handle the exception. An example would be:

  get started go_get_tweet Rescue Twitter :: BadRequest = & gt; E logger Terror e.message # ... to protect the code from envy: timeout error => E do_something_that_retries rescue = & gt; E logger Terror "..." end  

In this really flawless example it will match with some specific exceptions and also for any person who you did not specify in the form of a catch is.


No comments:

Post a Comment