Commit 526901e8 authored by Ignacy Moryc's avatar Ignacy Moryc

Improve error message for project not found

parent 8c2ab295
---
title: Improve message for :project_not_found error to indicate possible cause
merge_request: 58945
author: Ignacy Moryc @ignacy
type: changed
......@@ -534,7 +534,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
it 'returns a 404' do
is_expected.to have_gitlab_http_status(:not_found)
expect(response.body).to eql('The project you were looking for could not be found.')
expect(response.body).to eql("The project you were looking for could not be found or you don't have permission to view it.")
end
end
......
......@@ -22,7 +22,7 @@ module Gitlab
auth_download: 'You are not allowed to download code.',
deploy_key_upload: 'This deploy key does not have write access to this project.',
no_repo: 'A repository for this project does not exist yet.',
project_not_found: 'The project you were looking for could not be found.',
project_not_found: "The project you were looking for could not be found or you don't have permission to view it.",
command_not_allowed: "The command you're trying to execute is not allowed.",
upload_pack_disabled_over_http: 'Pulling over HTTP is not allowed.',
receive_pack_disabled_over_http: 'Pushing over HTTP is not allowed.',
......
......@@ -554,19 +554,19 @@ RSpec.describe Gitlab::GitAccess do
context 'when the repository is public' do
let(:options) { %i[repository_enabled] }
it { expect { pull_access_check }.to raise_error('The project you were looking for could not be found.') }
it { expect { pull_access_check }.to raise_error("The project you were looking for could not be found or you don't have permission to view it.") }
end
context 'when the repository is private' do
let(:options) { %i[repository_private] }
it { expect { pull_access_check }.to raise_error('The project you were looking for could not be found.') }
it { expect { pull_access_check }.to raise_error("The project you were looking for could not be found or you don't have permission to view it.") }
end
context 'when the repository is disabled' do
let(:options) { %i[repository_disabled] }
it { expect { pull_access_check }.to raise_error('The project you were looking for could not be found.') }
it { expect { pull_access_check }.to raise_error("The project you were looking for could not be found or you don't have permission to view it.") }
end
end
end
......@@ -596,13 +596,13 @@ RSpec.describe Gitlab::GitAccess do
context 'when the repository is private' do
let(:options) { %i[repository_private] }
it { expect { pull_access_check }.to raise_error('The project you were looking for could not be found.') }
it { expect { pull_access_check }.to raise_error("The project you were looking for could not be found or you don't have permission to view it.") }
end
context 'when the repository is disabled' do
let(:options) { %i[repository_disabled] }
it { expect { pull_access_check }.to raise_error('The project you were looking for could not be found.') }
it { expect { pull_access_check }.to raise_error("The project you were looking for could not be found or you don't have permission to view it.") }
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment