add error function to server listen method