Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: no detailed error message in AAD app actions (#8737) #8911

Merged
merged 3 commits into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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