mendicant-original / newman

Newman: a microframework for building email-based applications.
116 stars 11 forks source link

Rescue send/receive errors? #25

Closed ericgj closed 12 years ago

ericgj commented 12 years ago

If there are network errors either receiving or sending, it kills the server. Perhaps this is the desired behavior, and in production you just monitor the process and restart it if this happens. But in any case I'd think you'd at least want to log the error.

practicingruby commented 12 years ago

Hi Eric,

For right now I think the right behavior is to rescue all server errors, log them, and then re-raise. This can be done in tick in the following way

def tick
  # ...
rescue StandardError => e
  logger.fatal("Caught exception: #{e}\n\n#{e.backtrace}")
  raise
end

Feel free to prepare a patch if you want, otherwise I'll look into it next time I'm working on this project.

practicingruby commented 12 years ago

@ericgj Do you think #33 is enough to close this for now, or do you want to work on timeout first?