我的ruby代码运行正常,但现在我发现了随机异常抛出。我追查到它似乎是一个FB小虫。 往下看。如果我在创建页面帖子时为link参数提供了有效的URL,则会有例外。 如果我把它改成其他随机的东西,那就没关系。 然后经过几次尝试后,如果我回来尝试相同的URL,这次就可以了。
-
[26] pry(FB::Post)> attrs[:link] = 'http://www.groupon.com/deals/new-health-centers'
=> "http://www.groupon.com/deals/new-health-centers"
[27] pry(FB::Post)> graph_post.put_connections(FB.config.page_id, 'feed', attrs)
Koala::Facebook::ClientError: type: OAuthException, code: 1500, message: (#1500) The url you supplied is invalid [HTTP 400]
from /Users/wedeng/.rvm/gems/ruby-1.9.3-p385/gems/koala-1.6.0/lib/koala/api/graph_api.rb:470:in `block in graph_call'
[30] pry(FB::Post)> attrs[:link] = 'http://www.groupon.com/dealx/newshealthscentersxxxxxxxxxxxxxxxxxxxxxxxxxx'
=> "http://www.groupon.com/dealx/newshealthscentersxxxxxxxxxxxxxxxxxxxxxxxxxx"
[31] pry(FB::Post)> graph_post.put_connections(FB.config.page_id, 'feed', attrs)
=> {"id"=>"60004615820_10151782223830821"}