Changed an error throw to use logger.error instead of console.log