nex3/rb-inotify — pull request #37 by AnchorCat (2014-09-22 07:44:43+00:00)
Title: Use a specific exception class for queue overflows

6ea8bf75c974a6caf1868518e0d5b19182e1faa9 caused INotify::Event to raise
an Exception if the event queue overflows. Since Exception is the
parent of all exceptions in Ruby, including language errors, this makes
that failure case difficult to handle in applications, since
"rescue Exception" will catch *any* exception that is raised.

Here, we create a new exception class, INotify::QueueOverflowError, and
raise an instance of that if the queue overflows. Handling this error
in a client application is now as simple as:

begin
inotify.process
rescue INotify::QueueOverflowError
(re-read all watched files, or whatever is appropriate)
end