X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=yang%2Fyang-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fcommon%2FRpcError.java;h=3645637b893af4ba9998922ff86e2f59186d5b4a;hb=481a692d463636bbcf75f023da71703913e1b605;hp=3aad8a77a69454d0d64b86edf219789d98a5c7c1;hpb=238b7740f70a2bb01c03b1ae97557c2dd14a30b8;p=yangtools.git diff --git a/yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/RpcError.java b/yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/RpcError.java index 3aad8a77a6..3645637b89 100644 --- a/yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/RpcError.java +++ b/yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/RpcError.java @@ -1,32 +1,118 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.yangtools.yang.common; - -public interface RpcError { - ErrorSeverity getSeverity(); - - String getTag(); - - String getApplicationTag(); - - String getMessage(); - - String getInfo(); - - Throwable getCause(); - - ErrorType getErrorType(); - - public enum ErrorSeverity { - ERROR, WARNING, - } - - public enum ErrorType { - TRANSPORT, RPC, PROTOCOL, APPLICATION - } -} +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yangtools.yang.common; + +/** + * Representation of an error. + * + */ +public interface RpcError { + + public enum ErrorSeverity { + ERROR, + WARNING + } + + public enum ErrorType { + /** + * Indicates an error occurred during transport of data, eg over the network. + */ + TRANSPORT, + + /** + * Indicates an error occurred during a remote procedure call. + */ + RPC, + + /** + * Indicates an error at a protocol layer, eg if invalid data was passed by the caller. + */ + PROTOCOL, + + /** + * Indicates an error occurred during internal processing. + */ + APPLICATION + } + + /** + * Returns the error severity, as determined by the application reporting the error. + * + * @return an {@link ErrorSeverity} enum. + */ + ErrorSeverity getSeverity(); + + /** + * Returns a short string that identifies the general type of error condition. + *

+ * The following outlines suggested values as defined by netconf (RFC 6241): + *

+     *    access-denied
+     *    bad-attribute
+     *    bad-element
+     *    data-exists
+     *    data-missing
+     *    in-use
+     *    invalid-value
+     *    lock-denied
+     *    malformed-message
+     *    missing-attribute
+     *    missing-element
+     *    operation-failed
+     *    operation-not-supported
+     *    resource-denied
+     *    rollback-failed
+     *    too-big
+     *    unknown-attribute
+     *    unknown-element
+     *    unknown-namespace
+     * 
+ * @return a string if available or null otherwise. + */ + String getTag(); + + /** + * Returns a short string that identifies the specific type of error condition as + * determined by the application reporting the error. + * + * @return a string if available or null otherwise. + */ + String getApplicationTag(); + + /** + * Returns a string suitable for human display that describes the error + * condition. + * + * @return a message string. + */ + String getMessage(); + + /** + * + * Returns a string containing additional information to provide extended + * and/or implementation-specific debugging information. + * + * @return a string if available or null otherwise. + */ + String getInfo(); + + /** + * + * Returns an exception cause. + * + * @return a Throwable if the error was triggered by exception, null otherwise. + */ + Throwable getCause(); + + /** + * Returns the conceptual layer at which the error occurred. + * + * @return an {@link ErrorType} enum. + */ + ErrorType getErrorType(); +}