use console.error to log errors instead