public async checkWebAppName()

in src/extension/src/azure/azure-app-service/appServiceProvider.ts [88:117]


  public async checkWebAppName(appName: string, subscriptionItem: SubscriptionItem): Promise<string | undefined> {
    try {
      this.setWebClient(subscriptionItem);
    } catch (error) {
      return error.message;
    }

    const validationStatus: AppNameValidationResult = NameValidator.validateAppName(appName);
    if (!validationStatus.isValid) {
      // returns error message
      return validationStatus.message;
    }
    if (this.webClient === undefined) {
      return MESSAGES.ERRORS.WEBSITE_CLIENT_NOT_DEFINED;
    }
    return await this.webClient
      .checkNameAvailability(appName + CONSTANTS.APP_SERVICE_DOMAIN, "Site", {
        isFqdn: true,
      })
      .then((res) => {
        if (res.nameAvailable) {
          return undefined;
        } else {
          return MESSAGES.ERRORS.WEB_APP_NAME_NOT_AVAILABLE(appName);
        }
      })
      .catch((error) => {
        return error.message;
      });
  }