diff --git a/src/features/lightspeed/errors.ts b/src/features/lightspeed/errors.ts index a1f411a0c..992d6fd1c 100644 --- a/src/features/lightspeed/errors.ts +++ b/src/features/lightspeed/errors.ts @@ -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__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( diff --git a/test/units/lightspeed/handleApiError.test.ts b/test/units/lightspeed/handleApiError.test.ts index 3bcc53d43..e2f6aa178 100644 --- a/test/units/lightspeed/handleApiError.test.ts +++ b/test/units/lightspeed/handleApiError.test.ts @@ -269,6 +269,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, { @@ -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 specify a model in your Ansible extension settings under Lightspeed: Model Id Override.", ); });