我有一段很好的代码。我试图在推特上发布相同的文本,但我的脚本结束了,因为/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)
我知道我不能两次发布相同的文本,但我认为我会在响应变量中得到错误。
我该如何处理错误?所以我的脚本会很好地完成而不是因为错误?
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!')