Fix eclipse/checkstyle warnings
[yangtools.git] / yang / yang-common / src / main / java / org / opendaylight / yangtools / yang / common / RpcError.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.common;
9
10 /**
11  * Representation of an error.
12  *
13  */
14 public interface RpcError {
15
16     enum ErrorSeverity {
17         ERROR,
18         WARNING
19     }
20
21     enum ErrorType {
22         /**
23          * Indicates an error occurred during transport of data, eg over the network.
24          */
25         TRANSPORT,
26
27         /**
28          * Indicates an error occurred during a remote procedure call.
29          */
30         RPC,
31
32         /**
33          * Indicates an error at a protocol layer, eg if invalid data was passed by the caller.
34          */
35         PROTOCOL,
36
37         /**
38          * Indicates an error occurred during internal processing.
39          */
40         APPLICATION
41     }
42
43     /**
44      * Returns the error severity, as determined by the application reporting the error.
45      *
46      * @return an {@link ErrorSeverity} enum.
47      */
48     ErrorSeverity getSeverity();
49
50     /**
51      * Returns a short string that identifies the general type of error condition.
52      *
53      * <p>
54      * The following outlines suggested values as defined by netconf (<a href="https://tools.ietf.org/html/rfc6241#page-89">RFC 6241</a>):
55      * <pre>
56      *    access-denied
57      *    bad-attribute
58      *    bad-element
59      *    data-exists
60      *    data-missing
61      *    in-use
62      *    invalid-value
63      *    lock-denied
64      *    malformed-message
65      *    missing-attribute
66      *    missing-element
67      *    operation-failed
68      *    operation-not-supported
69      *    resource-denied
70      *    rollback-failed
71      *    too-big
72      *    unknown-attribute
73      *    unknown-element
74      *    unknown-namespace
75      * </pre>
76      * @return a string if available or null otherwise.
77      */
78     String getTag();
79
80     /**
81      * Returns a short string that identifies the specific type of error condition as
82      * determined by the application reporting the error.
83      *
84      * @return a string if available or null otherwise.
85      */
86     String getApplicationTag();
87
88     /**
89      * Returns a string suitable for human display that describes the error
90      * condition.
91      *
92      * @return a message string.
93      */
94     String getMessage();
95
96     /**
97      * Returns a string containing additional information to provide extended
98      * and/or implementation-specific debugging information.
99      *
100      * @return a string if available or null otherwise.
101      */
102     String getInfo();
103
104     /**
105      * Returns an exception cause.
106      *
107      * @return a Throwable if the error was triggered by exception, null otherwise.
108      */
109     Throwable getCause();
110
111     /**
112      * Returns the conceptual layer at which the error occurred.
113      *
114      * @return an {@link ErrorType} enum.
115      */
116     ErrorType getErrorType();
117 }