removed duplicate code in send-error.js