summaryrefslogtreecommitdiffstats
path: root/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/template/NameAlreadyExistsTemplateException.java
blob: dd92af1460916dc3c5afdfc16a45680ec16a4df8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.task.util.template;

import com.yahoo.vespa.hosted.node.admin.task.util.text.Cursor;
import com.yahoo.vespa.hosted.node.admin.task.util.text.CursorRange;

/**
 * @author hakonhall
 */
public class NameAlreadyExistsTemplateException extends TemplateException {
    public NameAlreadyExistsTemplateException(String name, CursorRange range) {
        super("Name '" + name + "' already exists in the " + describeSection(range));
    }

    public NameAlreadyExistsTemplateException(String name, Cursor firstNameLocation,
                                              Cursor secondNameLocation) {
        super("Section named '" + name + "' at " +
              firstNameLocation.calculateLocation().lineAndColumnText() +
              " conflicts with earlier section with the same name at " +
              secondNameLocation.calculateLocation().lineAndColumnText());
    }
}