server handles errors