Skip to content
Snippets Groups Projects
Commit 32ed70ef authored by Shinya Maeda's avatar Shinya Maeda :two:
Browse files

Improve the unauthorized error message after cutoff

parent ce8f7334
No related branches found
No related tags found
2 merge requests!170053Security patch upgrade alert: Only expose to admins 17-4,!168027Improve the unauthorized error message after cutoff
......@@ -70,6 +70,15 @@ This error occurs when you try to access a tool of GitLab Duo Chat that is not b
Ensure your [GitLab Duo subscription tier](https://about.gitlab.com/gitlab-duo/#pricing) includes the selected tool.
## `Error M3006`
You might get an error that states
`I'm sorry, you don't have the GitLab Duo subscription required to use Duo Chat. Please contact your administrator. Error code: M3006`.
This error occurs when GitLab Duo Chat is not included in your GitLab Duo subscription.
Ensure your [GitLab Duo subscription tier](https://about.gitlab.com/gitlab-duo/#pricing) includes GitLab Duo Chat.
## `Error M4000`
You might get an error that states
......
......@@ -110,6 +110,15 @@ def error_answer(error)
error_code: "A1004"
)
end
when Gitlab::AiGateway::ForbiddenError
Answer.error_answer(
error: error,
context: context,
content: _("I'm sorry, you don't have the GitLab Duo subscription required " \
"to use Duo Chat. Please contact your administrator."),
source: "chat_v2",
error_code: "M3006"
)
else
Answer.error_answer(
error: error,
......
......@@ -412,6 +412,26 @@
end
end
context "when forbidden error is raised" do
let(:error) { ::Gitlab::AiGateway::ForbiddenError.new }
before do
allow(Gitlab::ErrorTracking).to receive(:track_exception)
allow_next_instance_of(Gitlab::Duo::Chat::StepExecutor) do |react_agent|
allow(react_agent).to receive(:step).and_raise(error)
end
end
it "returns an error" do
expect(answer.is_final).to eq(true)
expect(answer.content).to include("I'm sorry, you don't have the GitLab Duo subscription required " \
"to use Duo Chat. Please contact your administrator.")
expect(answer.error_code).to include("M3006")
expect(Gitlab::ErrorTracking).to have_received(:track_exception).with(error)
end
end
context "when eof error is raised" do
let(:error) { EOFError.new }
......
......@@ -27500,6 +27500,9 @@ msgstr ""
msgid "I'm sorry, I couldn't respond in time. Please try again."
msgstr ""
 
msgid "I'm sorry, you don't have the GitLab Duo subscription required to use Duo Chat. Please contact your administrator."
msgstr ""
msgid "I'm sorry, you've entered too many prompts. Please run /clear or /reset before asking the next question."
msgstr ""
 
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment