catching errors from server