catch exceptions during flush for web responses

fix #53