'rbuf_fill': execution expired (Timeout::Error)
2007-12-09 04:41:00 +0000
This is a fun little exception in Ruby that you have to catch explicitly in order to get hold of it in a rescue block.
Say you had the following:
1 2 3 4 5 6 7 |
require 'net/pop3' begin Net::POP3.auth_only(@server, @port, @username, @password) rescue => e write_error_to_logfile(e) do_something_sensible end |
And the mail server could not be reached due to transient network problems -> that is, you are getting a socket timeout error.
Well, your code in the rescue block won’t get executed! Even though the script raises an Error!
Why is this?
Simple answer, because Timeout::Error is not a subclass of StandardError, it is a subclass of the Interrupt class.
So, that means you have to catch it explicitly, like so:
1 2 3 4 5 6 7 8 9 10 |
require 'net/pop3' begin Net::POP3.auth_only(@server, @port, @username, @password) rescue => e write_error_to_logfile(e) do_something_sensible rescue Timeout::Error => e write_error_to_logfile(e) do_something_sensible_for_timeout end |
And all will be good again, error caught!
blogLater
Mikel
Leave a Reply
Latest posts
- Rails Security Alert
- Encrypting Another Partition Using FileVault 2 on OSX Lion
- Installing Home Folder on Second Drive on OSX Lion
- undefined local variable or method `version_requirements'
- A New World of Resources
- Rails Static Pages
- Twitter Replacing Rails? So?
- Engine Yard Cloud Backups Generating Zero Length Backups
- Our Rails Rumble Entry - StillAlive.com
- Renaming a controller and redirection in Rails 3
- Updating RailsPlugins.org to Rails 3 - Part 1
- A new protocol for social interaction
- What is a distributed social network?
- Bundler and Public Git Sources
- Getting Heroku, memcached and Rails 3 working
- Why Bundler?
- Rails Commit Access
- Introducing TellThemWhen
- rake RSpec & Cucumber uninitialized constant Rails::Boot::Bundler
- This Relationship is Worth Nothing
- Thank YOU...
- Inline Attachments for ActionMailer
- Upgrading RailsPlugins.org to Rails 3 - Part 1
- Stripping dollar signs and commas from a string
- Getting Rails 3 Edge with jQuery, RSpec and Cucumber using RVM
- Action Mailer, go Proc thyself
- The Real News Donation Drive
- ActionMailer ScreenCast and Article
- Installing RSpec for Rails 3
- I am speaking at RailsConf 2010
- Rails 3 Session Secret and Session Store
- If you're lazy and you know it write your specs!
- Bundler - uninitialized constant ActionController
- Bundle Me Some Sanity
- How to use Mail / ActionMailer 3 with GMail SMTP
- Put your mailer where the action is!
- Why Force a Choice?
- How to make an RSS feed in Rails
- Rails 3 Routing with Rack
- Bundle me some Rails
- Helping out in Haiti
- Watch your self
- Is Rails 3.0 a Game Changer?
- Where did the scripts go?
- validates :rails_3, :awesome => true
- New Rails Version 3.0 Guides Online
- New ActionMailer API in Rails 3.0
- Mail gem version 2 released
- How to rename a Rails 3 Application
- Rails 3.0 Examples
Latest comments
Categories
Tag Cloud
AJAX ARGH! ActiveRecord Ajax Apache Apple Asterisk Australia Copy Database Development Feedburner Gem server Google Human Rights Javascript L. Ron Hubbard MS SQL Server MacOSX Mail Mephisto Not Programming OpenBSD Opensource Performance Personal Integrity PostgreSQL Programming Prototype Puzzle RDoc REST RESTful Rails RSPec RSpec Rails Rails Tips Rspec Ruby Ruby on Rails Ruby on Rails Tips Ruby on rails Tips SQL SQLServer SVN Scientologist Scientology Site Stats Soekris Soekris net5501 TMail Textmate Tips Windows World about mikel anti drug apache contributing daemon documentation drugs illustrator javascript lambda mail mephisto newspapers nitro open source opensource photoshop productivity programming railscasts rspec ruby ruby on rails rubyforge scientology seo sitemap sqlserver tips tmail tom cruise unix tricks vector graphicsArchives
- November 2009 (1)
- October 2009 (2)
- September 2009 (2)
- August 2009 (0)
- July 2009 (1)
- June 2009 (0)
- May 2009 (1)
- April 2009 (0)
- March 2009 (0)
- February 2009 (0)
- January 2009 (2)
- December 2008 (0)
- November 2008 (5)
- October 2008 (0)
- September 2008 (1)
- August 2008 (0)
- July 2008 (2)
- June 2008 (13)
- May 2008 (7)
- April 2008 (18)
- March 2008 (8)
- February 2008 (5)
- January 2008 (7)
- December 2007 (20)
- November 2007 (22)




2008-01-10 17:14:02 +0000
Thanks, I had this same error and this cleared up my incorrect expectation that everything derived from a root Exception class.
2008-08-25 23:20:00 +0000
that was very helpful, thanks!
2008-02-20 02:14:41 +0000
this was a huge help!
2008-03-13 21:01:33 +0000
Thanks, this error was really driving me crazy.
2008-06-12 20:23:40 +0000
Thanks !
2008-02-29 14:43:10 +0000
This was e great help to me too… Thanks a lot!
2008-09-10 17:54:23 +0000
Thanks. this saved my debugging time.
2008-09-25 07:54:57 +0000
Thx!!!
2008-12-06 07:06:08 +0000
This was a great help. Small, concise, exactly what I needed. Thx alot
2009-06-10 04:36:57 +0000
Thanks! Found this on first google search, instantly fixed!
2009-07-06 15:57:55 +0000
Thank you very much. But…. so lame…
2012-08-28 05:45:45 +0000
You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant!
brisbane bathroom renovations
2012-09-15 03:55:29 +0000
Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging,
http://www.roulette-fr.net/
2012-05-19 08:16:49 +0000
Hello, I have browsed most of your posts. This post is probably where I got the most useful information for my research. Thanks for posting, maybe we can see more on this. Are you aware of any other websites on this subject.
purchase hgh
2009-08-16 23:52:29 +0000
You should not have a catch-all rescue anyway.
“rescue => e” == EVIL.
2009-08-17 03:16:19 +0000
@Colin
You don’t want to rescue Exception, because then even the syntax errors in your code will be rescued by the rescue clause.
I still don’t understand why the Timeout exceptions aren’t a subclass of StandardError…
2008-01-28 22:57:55 +0000
http://blog.nicksieger.com/articles/2006/09/06/rubys-exception-hierarchy
Every exception derives from Exception, so you can do
begin
rescue Exception => e
puts “#{e}\n#{e.backtrace.join(”\n")}"
end
2009-05-11 20:51:54 +0000
Very helpful – accurate and to the point. Thank you!
2011-12-22 17:43:17 +0000
Thanks! Found this on first google search, instantly fixed!
emengpsfon jhf nsvbqxdb dsj nomtchiche ft oreergonst
2012-11-04 02:20:52 +0000
Its a great pleasure reading your post.Its full of information I am looking for and I love to post a comment that “The content of your post is awesome” Great work.
casino-legal.info
2012-11-04 03:29:09 +0000
Hello There. I found your blog using msn. This is an extremely well written article. I will be sure to bookmark it and return to read more of your useful information. Thanks for the post. I’ll certainly comeback.
World Housing & Relationships
2012-11-05 07:32:41 +0000
I am very enjoyed for this blog. Its an informative topic. It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy.
best funny website
2012-11-05 07:36:05 +0000
I am very enjoyed for this blog. Its an informative topic. It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy.
best funny website
2012-11-13 07:32:35 +0000
Great article with excellent idea!Thank you for such a valuable article. I really appreciate for this great information..
Relationship Issues by PB
2012-12-10 18:49:08 +0000
Mostly my oversight, but also if Fieri was hosting on the set of his (hilarious) Food Network cooking show, he’d at least have a big television. And plenty of dippin-aise. And he’d be shouting and there’d be like a Brian Setzer Orchestra album on really loud. So in retrospect I shouldn’t have left it out….. usb safe
2012-12-13 11:52:21 +0000
This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information…
www.blackzonestudio.com
2012-12-15 04:03:38 +0000
I’m not sure why but this weblog is loading very slow for me. Is anyone else having this problem or is it a issue on my end? I’ll check back later and see if the
problem still exists.
2012-12-22 20:14:18 +0000
The drop-shipping program has very advantageous prices, similar to wholesale. You do not need to invest any money to stock products!
hardware keylogger
2013-01-04 09:58:29 +0000
I envy because I never got a chance to have to. However, I am still happy that the parents are spending much of their time for the kids.PS3 Emulator
2013-01-19 10:12:17 +0000
I have explain so many article of this site in which some of them were very intresting and inspiring.This article has good title with good description.Xbox Emulator
2013-03-28 00:14:49 +0000
Hi there, I do think your web site could be having
internet browser compatibility problems. When I look at
your website in Safari, it looks fine however, if opening in IE, it
has some overlapping issues. I merely wanted to provide you with a quick heads up!
Besides that, fantastic site!
2013-04-05 00:34:08 +0000
hey there and thank you for your info – I’ve certainly picked up anything new from right here. I did however expertise a few technical points using this website, since I experienced to reload the site a lot of times previous to I could get it to load properly. I had been wondering if your web host is OK? Not that I am complaining, but slow loading instances times will sometimes affect your placement in google and could damage your high quality score if advertising and marketing with Adwords. Anyway I am adding this RSS to my email and can look out for a lot more of your respective intriguing content. Make sure you update this again very soon.
2013-04-15 23:40:55 +0000
Children’s tooth development begins while the baby is in the womb. Teething usually occurs between the ages of six and nine months. Children usually have their full set of 20 primary teeth (milk teeth, baby teeth or deciduous teeth) by the age of three years. At about the age of six years, the first permanent teeth erupt (push through the gum).
2013-04-24 21:46:45 +0000
This is very interesting, You’re a very skilled blogger. I have joined your feed and look forward to seeking more of your fantastic post. Also, I have shared your site in my social networks! www http://sportsdiviner.net/kosa/
2013-04-25 22:13:40 +0000
This will be a fantastic web site, might you be interested in doing an interview regarding just how you designed it? If so e-mail me! pistolet hukowy http://www.porcja.eu/sztucereu-wykrywacze-metalu
2013-04-29 10:45:47 +0000
Reading this write-up – the present of your time strona firmowa http://mjk-serwis.pl/2013/02/12/
2013-05-07 10:24:38 +0000
It is a great website.. The Design looks very good.. Keep working like that!.
electronic cigarette reviews
2013-05-10 06:07:41 +0000
Great beat ! I would like to apprentice while you amend your site, how could i subscribe for a blog site? The account aided me a acceptable deal. I had been a little bit acquainted of this your broadcast offered bright clear idea Posadzki białystok http://przedszkolezielonagora.com.pl/przydomowe-oczyszczalnie-sciekow-bialystok/
2013-05-13 01:06:04 +0000
Great post. bean bags It’s good to see you to verbalize your heart and your clarity on this important issue can be easily detected. chairs Looking forward to read more. furniture furniture|sofa|beanbagnerd.com sofa
2013-05-13 10:04:38 +0000
I definitely wanted to construct a brief note in order to appreciate you for these lovely guides you are placing on this website. My time intensive internet lookup has at the end of the day been rewarded with sensible information to exchange with my guests. I would point out that we website visitors are very lucky to be in a useful network with very many awesome professionals with very beneficial plans. I feel very blessed to have come across your entire website and look forward to really more cool minutes reading here. Thanks a lot again for everything. www http://www.cyllene.eu/stadnina-kopytko-hotel-dla-koni-pomorskie
2013-05-22 09:49:23 +0000
Does your blog have a contact page? I’m having trouble locating it but, I’d like to shoot you an email. I’ve got some creative ideas for your blog you might be interested in hearing. Either way, great website and I look forward to seeing it grow over time.