Skip to content

Commit

Permalink
Update msg for WCA model not found error and create a new error no or…
Browse files Browse the repository at this point in the history
…g linked
  • Loading branch information
TamiTakamiya committed May 9, 2024
1 parent 72412cb commit 35b2e23
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/features/lightspeed/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,18 @@ ERRORS.addError(
"Could not find an API Key for IBM watsonx Code Assistant. Please contact your administrator.",
),
);
ERRORS.addError(
403,
new Error(
"error__wca_no_organization",
"Your user Id is not linked to an organization Id. Please contact your administrator.",
),
);
ERRORS.addError(
403,
new Error(
"error__wca_model_id_not_found",
"Could not find a Model Id for IBM watsonx Code Assistant. Please contact your administrator.",
"Your organization does not have an IBM watsonx Code Assistant model configured. Contact your Red Hat organization administrator to configure a model, or provide a model id override in your VSCode Ansible extension settings",
),
);
ERRORS.addError(
Expand Down
14 changes: 13 additions & 1 deletion test/units/lightspeed/handleApiError.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,18 @@ describe("testing the error handling", () => {
);
});

it("err no organization linked", () => {
const error = mapError(
createError(403, {
code: "error__wca_no_organization",
}),
);
assert.equal(
error.message,
"Your user Id is not linked to an organization Id. Please contact your administrator.",
);
});

it("err WCA Model Id missing", () => {
const error = mapError(
createError(403, {
Expand All @@ -277,7 +289,7 @@ describe("testing the error handling", () => {
);
assert.equal(
error.message,
"Could not find a Model Id for IBM watsonx Code Assistant. Please contact your administrator.",
"Your organization does not have an IBM watsonx Code Assistant model configured. Contact your Red Hat organization administrator to configure a model, or provide a model id override in your VSCode Ansible extension settings",
);
});

Expand Down

0 comments on commit 35b2e23

Please sign in to comment.