Line data Source code
1 : // Copyright (C) 2021 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.server.git; 16 : 17 : import com.google.gerrit.entities.Project; 18 : import java.io.IOException; 19 : 20 : /** Thrown when trying to create a repository that exist. */ 21 : public class RepositoryExistsException extends IOException { 22 : private static final long serialVersionUID = 1L; 23 : 24 : /** 25 : * @param projectName name of the project that cannot be created 26 : * @param reason reason why the project cannot be created 27 : */ 28 : public RepositoryExistsException(Project.NameKey projectName, String reason) { 29 1 : super( 30 1 : String.format("Repository %s exists and cannot be created. %s", projectName.get(), reason)); 31 1 : } 32 : 33 : /** @param projectName name of the project that cannot be created */ 34 : public RepositoryExistsException(Project.NameKey projectName) { 35 1 : super(String.format("Repository %s exists and cannot be created.", projectName.get())); 36 1 : } 37 : }