private async fetchDownloadFile()

in src/controller/addonController.ts [210:238]


  private async fetchDownloadFile(fileId: string) {
    const url = `${constants.downloadBaseURL}${fileId}`;
    const headers = await this.credentialController.makeAuthHeader();
    const response = await fetch(url, { headers });
    if (!response.ok) {
      const errorMessages: ErrorMessages = {
        window: {
          404: `(Status ${response.status}): XPI download file not found`,
          401: `(Status ${response.status}): Unauthorized request for XPI file`,
          403: `(Status ${response.status}): Inadequate permissions for XPI file`,
          other: `(Status ${response.status}): Could not fetch XPI file`,
        },
        thrown: {
          404: "Download file not found",
          401: "Unauthorized request",
          403: "Forbidden request",
          other: "Download request failed",
        },
      };

      return await NotificationView.showErrorMessage(
        errorMessages,
        response.status,
        this.fetchDownloadFile,
        [fileId]
      );
    }
    return response;
  }