add error handler for server