2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.data.tree.impl;
10 import java.util.List;
11 import org.opendaylight.yangtools.yang.common.ErrorSeverity;
12 import org.opendaylight.yangtools.yang.common.ErrorTag;
13 import org.opendaylight.yangtools.yang.common.ErrorType;
14 import org.opendaylight.yangtools.yang.data.api.ImmutableYangNetconfError;
15 import org.opendaylight.yangtools.yang.data.api.YangNetconfError;
16 import org.opendaylight.yangtools.yang.data.api.YangNetconfErrorAware;
17 import org.opendaylight.yangtools.yang.data.tree.api.SchemaValidationFailedException;
18 import org.opendaylight.yangtools.yang.data.tree.api.UniqueConstraintException;
21 * Exception thrown when unique constraints would be violated and we cannot throw a {@link UniqueConstraintException}.
23 final class UniqueValidationFailedException extends SchemaValidationFailedException implements YangNetconfErrorAware {
24 private static final long serialVersionUID = 1L;
26 UniqueValidationFailedException(final String message) {
31 public List<YangNetconfError> getNetconfErrors() {
32 return List.of(ImmutableYangNetconfError.builder()
33 .severity(ErrorSeverity.ERROR)
34 .type(ErrorType.APPLICATION)
35 .tag(ErrorTag.OPERATION_FAILED)
36 .appTag("data-not-unique")
37 // FIXME: 8.0.0: we are missing path information which should be filled in here. Constructor call site needs