2 * Copyright (c) 2019 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.common;
10 import com.google.common.annotations.Beta;
11 import java.util.Optional;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yangtools.yang.common.RpcError.ErrorSeverity;
14 import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
17 * An error condition raised as a consequence of a YANG-defined contract. This interface should not be directly
18 * implemented, but rather should be attached to a well-defined Exception class.
20 * @author Robert Varga
23 public interface YangError {
25 * Returns the conceptual layer at which the error occurred.
27 * @return an {@link ErrorType} enum.
29 @NonNull ErrorType getErrorType();
32 * Returns the error severity, as determined by the application reporting the error.
34 * @return an {@link ErrorSeverity} enum.
36 @NonNull ErrorSeverity getSeverity();
39 * Returns the value of the argument of YANG <code>error-app-tag</code> keyword.
41 * @return string with the application tag, or empty if it was not provided.
43 Optional<String> getErrorAppTag();
46 * Returns the value of the argument of YANG <code>error-message</code> keyword.
48 * @return string with the error message, or empty if it was not provided.
50 Optional<String> getErrorMessage();