Skip to content

Fix 500 error for Tags API when repository is missing

Vasilii Iakliushin requested to merge fix_500_error_for_tags_apoi into master

What does this MR do and why?

Problem

Requests to tags API when the repository is missing return "Internal server error".

Solution

Return 404 page if the repository is missing.

Screenshots or screen recordings

Before After
Screenshot_2022-07-04_at_19.48.01 Screenshot_2022-07-04_at_19.47.42

How to set up and validate locally

  1. Create a project without repository
    FactoryBot.create(:project, path: 'empty-repository-project', namespace: Namespace.first)
  2. Visit http://127.0.0.1:3000/api/v4/projects/root%2Fempty-repository-project/repository/tags
  3. You should see 404 error instead of 500 error

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vasilii Iakliushin

Merge request reports

Loading