2 * Copyright (c) 2013 Cisco Systems, Inc. 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 org.eclipse.jdt.annotation.NonNullByDefault;
13 * Representation of an error.
15 public interface RpcError {
16 // FIXME: 8.0.0: remove this in favor of Netconf.ErrorSeverity
21 public org.opendaylight.yangtools.yang.common.ErrorSeverity toNetconf() {
22 return org.opendaylight.yangtools.yang.common.ErrorSeverity.ERROR;
27 public org.opendaylight.yangtools.yang.common.ErrorSeverity toNetconf() {
28 return org.opendaylight.yangtools.yang.common.ErrorSeverity.WARNING;
32 public abstract org.opendaylight.yangtools.yang.common.ErrorSeverity toNetconf();
36 * Enumeration of {@code error-type} values. These provide glue between {@link NetconfLayer} and various sources of
39 // FIXME: 8.0.0: remove this in favor of common.ErrorType
43 * Indicates an error occurred during transport of data, eg over the network.
47 public org.opendaylight.yangtools.yang.common.ErrorType toNetconf() {
48 return org.opendaylight.yangtools.yang.common.ErrorType.TRANSPORT;
52 * Indicates an error occurred during a remote procedure call.
56 public org.opendaylight.yangtools.yang.common.ErrorType toNetconf() {
57 return org.opendaylight.yangtools.yang.common.ErrorType.RPC;
61 * Indicates an error at a protocol layer, eg if invalid data was passed by the caller.
65 public org.opendaylight.yangtools.yang.common.ErrorType toNetconf() {
66 return org.opendaylight.yangtools.yang.common.ErrorType.PROTOCOL;
70 * Indicates an error occurred during internal processing.
74 public org.opendaylight.yangtools.yang.common.ErrorType toNetconf() {
75 return org.opendaylight.yangtools.yang.common.ErrorType.APPLICATION;
79 public abstract org.opendaylight.yangtools.yang.common.ErrorType toNetconf();
83 * Returns the error severity, as determined by the application reporting the error.
85 * @return an {@link ErrorSeverity} enum.
87 ErrorSeverity getSeverity();
90 * Returns a short string that identifies the general type of error condition.
93 * The following outlines suggested values as defined by
94 * (<a href="https://tools.ietf.org/html/rfc6241#page-89">RFC6241</a>):
109 * operation-not-supported
117 * @return a string if available or null otherwise.
119 // FIXME: 8.0.0: return ErrorTag here
123 * Returns a short string that identifies the specific type of error condition as
124 * determined by the application reporting the error.
126 * @return a string if available or null otherwise.
128 String getApplicationTag();
131 * Returns a string suitable for human display that describes the error
134 * @return a message string.
139 * Returns a string containing additional information to provide extended
140 * and/or implementation-specific debugging information.
142 * @return a string if available or null otherwise.
144 // FIXME: YANGTOOLS-765: this is wrong and needs to be modeled at data-api layer with YangErrorInfo
148 * Returns an exception cause.
150 * @return a Throwable if the error was triggered by exception, null otherwise.
152 Throwable getCause();
155 * Returns the conceptual layer at which the error occurred.
157 * @return an {@link ErrorType} enum.
159 ErrorType getErrorType();