From d8abd39cb2e8bcd9ca7d89b622801e09358f1751 Mon Sep 17 00:00:00 2001 From: Huihui Wu Date: Mon, 8 Sep 2025 12:38:02 +0800 Subject: [PATCH] fix: add help link when user meet error for uploading da package --- packages/fx-core/src/component/m365/constants.ts | 1 + packages/fx-core/src/component/m365/errors.ts | 3 ++- packages/fx-core/src/component/m365/packageService.ts | 8 ++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/fx-core/src/component/m365/constants.ts b/packages/fx-core/src/component/m365/constants.ts index 3696b37f20e..e1a0ea5700d 100644 --- a/packages/fx-core/src/component/m365/constants.ts +++ b/packages/fx-core/src/component/m365/constants.ts @@ -11,3 +11,4 @@ export const outlookCopilotAppId = "d870f6cd-4aa5-4d42-9626-ab690c041429"; export const outlookBaseUrl = "https://outlook.office.com"; export const officeBaseUrl = "https://www.office.com"; export const advancedDASettingUrl = "https://aka.ms/atk-actions/teamsapp-extendToM365"; +export const M365HelpLink = "https://aka.ms/teamsfx-actions/teamsapp-extendToM365"; diff --git a/packages/fx-core/src/component/m365/errors.ts b/packages/fx-core/src/component/m365/errors.ts index 85c73dcd837..032607c32bb 100644 --- a/packages/fx-core/src/component/m365/errors.ts +++ b/packages/fx-core/src/component/m365/errors.ts @@ -4,6 +4,7 @@ import { UserError } from "@microsoft/teamsfx-api"; import { getDefaultString, getLocalizedString } from "../../common/localizeUtils"; +import { M365HelpLink } from "./constants"; export class NotExtendedToM365Error extends UserError { constructor(source: string) { @@ -12,7 +13,7 @@ export class NotExtendedToM365Error extends UserError { name: "NotExtendedToM365Error", message: getDefaultString("error.m365.NotExtendedToM365Error"), displayMessage: getLocalizedString("error.m365.NotExtendedToM365Error"), - helpLink: "https://aka.ms/teamsfx-actions/teamsapp-extendToM365", + helpLink: M365HelpLink, }); } } diff --git a/packages/fx-core/src/component/m365/packageService.ts b/packages/fx-core/src/component/m365/packageService.ts index 55758a5a6b6..5d3dc284312 100644 --- a/packages/fx-core/src/component/m365/packageService.ts +++ b/packages/fx-core/src/component/m365/packageService.ts @@ -35,7 +35,7 @@ import { NotExtendedToM365Error } from "./errors"; import { M365AppDefinition, M365AppEntity } from "./interface"; import { MosServiceEndpoint } from "./serviceConstant"; import { getDefaultString, getLocalizedString } from "../../common/localizeUtils"; -import { advancedDASettingUrl } from "./constants"; +import { advancedDASettingUrl, M365HelpLink } from "./constants"; const M365ErrorSource = "M365"; const M365ErrorComponent = "PackageService"; @@ -257,7 +257,11 @@ export class PackageService { if (error.response) { error = this.traceError(error); } - throw assembleError(error, M365ErrorSource); + const err = assembleError(error, M365ErrorSource); + if (err instanceof UserError) { + err.helpLink = M365HelpLink; + } + throw err; } }