Skip to content

Commit

Permalink
Merge branch 'hotfix/5.0.1' into chyuan/detail-error-message-for-bot
Browse files Browse the repository at this point in the history
  • Loading branch information
adashen authored Jun 5, 2023
2 parents 4667859 + 6cf3b73 commit d4187d7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/fx-core/src/component/driver/aad/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ export class CreateAadAppDriver implements StepDriver {
);
if (error.response!.status >= 400 && error.response!.status < 500) {
return {
result: err(new UnhandledUserError(error as Error, actionName, helpLink)),
result: err(new UnhandledUserError(new Error(message), actionName, helpLink)),
summaries: summaries,
};
} else {
return {
result: err(new UnhandledError(error as Error, actionName)),
result: err(new UnhandledError(new Error(message), actionName)),
summaries: summaries,
};
}
Expand Down
4 changes: 2 additions & 2 deletions packages/fx-core/src/component/driver/aad/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ export class UpdateAadAppDriver implements StepDriver {
);
if (error.response!.status >= 400 && error.response!.status < 500) {
return {
result: err(new UnhandledUserError(error as Error, actionName, helpLink)),
result: err(new UnhandledUserError(new Error(message), actionName, helpLink)),
summaries: summaries,
};
} else {
return {
result: err(new UnhandledError(error as Error, actionName)),
result: err(new UnhandledError(new Error(message), actionName)),
summaries: summaries,
};
}
Expand Down
8 changes: 6 additions & 2 deletions packages/fx-core/tests/component/driver/aad/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,9 @@ describe("aadAppCreate", async () => {
expect(result.result._unsafeUnwrapErr())
.is.instanceOf(UnhandledUserError)
.and.has.property("message")
.and.contains("An unexpected error has occurred while performing the aadApp/create task");
.and.equals(
'An unexpected error has occurred while performing the aadApp/create task. The reason for this error is: {"error":{"code":"Request_BadRequest","message":"Invalid value specified for property \'displayName\' of resource \'Application\'."}}. Welcome to report this issue by clicking on the provided "Issue Link", so that we can investigate and resolve the problem as soon as possible.'
);
});

it("should throw system error when AadAppClient failed with non 4xx error", async () => {
Expand All @@ -354,7 +356,9 @@ describe("aadAppCreate", async () => {
expect(result.result._unsafeUnwrapErr())
.is.instanceOf(UnhandledError)
.and.has.property("message")
.and.contains("An unexpected error has occurred while performing the aadApp/create task");
.and.equals(
'An unexpected error has occurred while performing the aadApp/create task. The reason for this error is: {"error":{"code":"InternalServerError","message":"Internal server error"}}. Welcome to report this issue by clicking on the provided "Issue Link", so that we can investigate and resolve the problem as soon as possible.'
);
});

it("should send telemetries when success", async () => {
Expand Down
8 changes: 6 additions & 2 deletions packages/fx-core/tests/component/driver/aad/update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,9 @@ describe("aadAppUpdate", async () => {
expect(result.result._unsafeUnwrapErr())
.is.instanceOf(UnhandledUserError)
.and.property("message")
.contain("An unexpected error has occurred while performing the aadApp/update task");
.equals(
'An unexpected error has occurred while performing the aadApp/update task. The reason for this error is: {"error":{"code":"Request_BadRequest","message":"Invalid value specified for property \'displayName\' of resource \'Application\'."}}. Welcome to report this issue by clicking on the provided "Issue Link", so that we can investigate and resolve the problem as soon as possible.'
);
});

it("should throw system error when AadAppClient failed with non 4xx error", async () => {
Expand Down Expand Up @@ -540,7 +542,9 @@ describe("aadAppUpdate", async () => {
expect(result.result._unsafeUnwrapErr())
.is.instanceOf(UnhandledError)
.and.property("message")
.contain("An unexpected error has occurred while performing the aadApp/update task");
.equals(
'An unexpected error has occurred while performing the aadApp/update task. The reason for this error is: {"error":{"code":"InternalServerError","message":"Internal server error"}}. Welcome to report this issue by clicking on the provided "Issue Link", so that we can investigate and resolve the problem as soon as possible.'
);
});

it("should send telemetries when success", async () => {
Expand Down

0 comments on commit d4187d7

Please sign in to comment.