Error in MiniFB, how to bypass?

36 views
Skip to first unread message

GT

unread,
Apr 6, 2012, 6:54:33 AM4/6/12
to mini_fb
Hey.
I am attempting the following:

fb = MiniFB::OAuthSession.new(client.fb_token, 'en_EN')
begin
success = fb.post(fb.me.id, :type => :feed, :params => {:message
=> message})
rescue MiniFB::FaceBookError => exception
# Some Error Handling.
end


This works in 90% of cases and if there is an error it is caught by
the RESCUE case in the code.
BUT now i am getting an error which is not being caught by the RESCUE
and is stopping the rest of the routine from running.
Here is the stack trace...

If anyone can suggest a way to get around this, that would be great.
Thanks


/.gem/ruby/1.8/gems/rails-2.3.8/lib/commands/runner.rb:48: undefined
method `[]' for nil:NilClass (NoMethodError)
from /home/sansserifgrafik/admin.gigatools.com/vendor/gems/
mini_fb-1.1.7/lib/mini_fb.rb:554:in `get'
from /home/sansserifgrafik/admin.gigatools.com/vendor/gems/
mini_fb-1.1.7/lib/mini_fb.rb:386:in `get'
from /home/sansserifgrafik/admin.gigatools.com/vendor/gems/
mini_fb-1.1.7/lib/mini_fb.rb:432:in `initialize'
from /home/sansserifgrafik/admin.gigatools.com/vendor/gems/
mini_fb-1.1.7/lib/mini_fb.rb:407:in `new'
from /home/sansserifgrafik/admin.gigatools.com/vendor/gems/
mini_fb-1.1.7/lib/mini_fb.rb:407:in `graph_object'
from /home/sansserifgrafik/admin.gigatools.com/vendor/gems/
mini_fb-1.1.7/lib/mini_fb.rb:412:in `me'

Travis Reeder

unread,
Apr 6, 2012, 6:23:38 PM4/6/12
to min...@googlegroups.com
If you just want to catch it and continue, add:

rescue Exception => exception 

GT

unread,
Apr 7, 2012, 6:41:52 AM4/7/12
to min...@googlegroups.com
Hey Travis
Thanks for getting back.
Are you suggesting i replace my existing:

rescue MiniFB::FaceBookError => exception 

or add it as a 2nd Rescue?

Thanks!

Travis Reeder

unread,
Apr 7, 2012, 7:09:53 PM4/7/12
to min...@googlegroups.com
It's up to you, either will work, it just depends if you want to deal with the exceptions differently. 
Reply all
Reply to author
Forward
0 new messages