hook to email errors