Changing console.log to throw new Error