Guest User

Untitled

a guest
Jul 17th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. Begin
  2.  
  3. # My (omitted) very long ruby task
  4. # filled with Twitter API requests
  5.  
  6. rescue Errno::ENOENT
  7. sleep(5)
  8. logger.info "ENOENT error - attempting to retry"
  9. retry
  10. rescue Errno::ETIMEDOUT
  11. sleep(5)
  12. logger.info " Operation timed out - attempting to retry"
  13. retry
  14. rescue Errno::ECONNRESET
  15. sleep(5)
  16. logger.info "Connection reset by peer - attempting to retry"
  17. retry
  18. end
  19.  
  20. begin
  21.  
  22. # My (omitted) very long ruby task
  23. # filled with Twitter API requests
  24.  
  25. rescue Errno::ENOENT
  26. sleep(5)
  27. logger.info "ENOENT error - attempting to retry"
  28. retry
  29. rescue Errno::ETIMEDOUT
  30. sleep(5)
  31. logger.info " Operation timed out - attempting to retry"
  32. retry
  33. rescue Errno::ECONNRESET
  34. sleep(5)
  35. logger.info "Connection reset by peer - attempting to retry"
  36. retry
  37. rescue # This rescues StandardError and its children
  38. sleep(5)
  39. # The next line is somewhat pseudocode, because I don't use logger
  40. logger.this_is_somewhat_bad "Somewhat bad exception #{$!.class} #{$!} happened - I'm giving up"
  41. raise
  42. rescue Exception
  43. sleep(5)
  44. # The next line is somewhat pseudocode, because I don't use logger
  45. logger.omg_wtf_bbq "Really bad exception #{$!.class} #{$!} happened - I'm giving up"
  46. raise
  47. end
Add Comment
Please, Sign In to add comment