1
我有一段很有用的代碼。我試圖推文相同的文本,我的劇本結束,因爲/lib/ruby/gems/1.8/gems/twitter-0.9.4/lib/twitter.rb:87:in 'raise_errors': (403): Forbidden - Status is a duplicate. (Twitter::General)
如何處理與twitter.com溝通的「錯誤」? (ruby + twitter gem)
我知道我不能推特相同的文本兩次,但我想我會得到響應變量內的錯誤。
我該如何處理錯誤?所以我的腳本會很好地完成,而不是因爲錯誤?
oauth = Twitter::OAuth.new('consumer token', 'consumer secret')
oauth.authorize_from_access('access token', 'access secret')
client = Twitter::Base.new(oauth)
response = client.update('Heeeyyyyoooo from Twitter Gem!')
獲得一個錯誤可能是一件壞事,你可能想要解決這個問題而不是壓制錯誤 - 我不太確定它的出現。 – 2010-04-21 14:13:45
@JP:謝謝,我會試試... – Radek 2010-04-21 14:50:00