hooks for logging errors