J
J. Cooper
So I have some code that routinely checks for email in a cron job. Most
of the time it works great. However, sometimes it gets a timeout error,
which is fine; it happens. The thing is, I don't want it to clog up my
logs when it does, because it's not an exception I'm worried about. So I
tried wrapping the code in question in a begin/rescue block that just
exits on exception, thinking that then it the error would be "caught"
and it wouldn't have to bug me about it... but it continues to do so.
How do I get what I want to achieve here?
(The relevant code, if needed):
begin
Net:OP3.start('foo', 110, 'bar', 'foobar') do |pop|
if pop.mails.empty?
exit
else
# blah blah etc.
end
end
rescue
exit
end
of the time it works great. However, sometimes it gets a timeout error,
which is fine; it happens. The thing is, I don't want it to clog up my
logs when it does, because it's not an exception I'm worried about. So I
tried wrapping the code in question in a begin/rescue block that just
exits on exception, thinking that then it the error would be "caught"
and it wouldn't have to bug me about it... but it continues to do so.
How do I get what I want to achieve here?
(The relevant code, if needed):
begin
Net:OP3.start('foo', 110, 'bar', 'foobar') do |pop|
if pop.mails.empty?
exit
else
# blah blah etc.
end
end
rescue
exit
end