diff options
Diffstat (limited to 'lib/api/repositories.rb')
-rw-r--r-- | lib/api/repositories.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb index 295d1d5ab16..4131f41743f 100644 --- a/lib/api/repositories.rb +++ b/lib/api/repositories.rb @@ -95,6 +95,10 @@ module API params ] end + + def rescue_not_found? + Feature.disabled?(:handle_structured_gitaly_errors) + end end desc 'Get a project repository tree' do @@ -123,13 +127,16 @@ module API end end get ':id/repository/tree', urgency: :low do - tree_finder = ::Repositories::TreeFinder.new(user_project, declared_params(include_missing: false)) + tree_finder = ::Repositories::TreeFinder.new(user_project, declared_params(include_missing: false).merge(rescue_not_found: rescue_not_found?)) not_found!("Tree") unless tree_finder.commit_exists? tree = Gitlab::Pagination::GitalyKeysetPager.new(self, user_project).paginate(tree_finder) present tree, with: Entities::TreeObject + + rescue Gitlab::Git::Index::IndexError => e + not_found!(e.message) end desc 'Get raw blob contents from the repository' |