should use console.error for logging errors