catch exceptions while sending data