catch exception around thread.sleep