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

Update msg for WCA model not found error and create a new error no org linked #1309

Merged
merged 2 commits into from
Jun 4, 2024
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
9 changes: 8 additions & 1 deletion src/features/lightspeed/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,18 @@ ERRORS.addError(
"Could not find an API Key for IBM watsonx Code Assistant. Please contact your administrator.",
),
);
ERRORS.addError(
403,
new Error(
"error__no_default_model_id",
"Ansible Lightspeed does not have a model configured. Contact your Ansible administrator to configure a model, or specify a model in your Ansible extension settings under Lightspeed: Model Id Override.",
),
);
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 specify a model in your Ansible extension settings under Lightspeed: Model Id Override.",
),
);
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 @@ -217,6 +217,18 @@ describe("testing the error handling", () => {
);
});

it("err no default WCA Model Id found", () => {
const error = mapError(
createError(403, {
code: "error__no_default_model_id",
}),
);
assert.equal(
error.message,
"Ansible Lightspeed does not have a model configured. Contact your Ansible administrator to configure a model, or specify a model in your Ansible extension settings under Lightspeed: Model Id Override.",
);
});

it("err WCA Model Id missing", () => {
const error = mapError(
createError(403, {
Expand All @@ -225,7 +237,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 specify a model in your Ansible extension settings under Lightspeed: Model Id Override.",
);
});

Expand Down
Loading