Rename binding-runtime-dynamic to binding-loader
[yangtools.git] / common / 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 public interface RpcError {
14     /**
15      * Returns the error severity, as determined by the application reporting the error.
16      *
17      * @return an {@link ErrorSeverity} enum.
18      */
19     ErrorSeverity getSeverity();
20
21     /**
22      * Returns a short string that identifies the general type of error condition.
23      *
24      * <p>
25      * The following outlines suggested values as defined by
26      * (<a href="https://www.rfc-editor.org/rfc/rfc6241#page-89">RFC6241</a>):
27      *
28      * <pre>
29      *    access-denied
30      *    bad-attribute
31      *    bad-element
32      *    data-exists
33      *    data-missing
34      *    in-use
35      *    invalid-value
36      *    lock-denied
37      *    malformed-message
38      *    missing-attribute
39      *    missing-element
40      *    operation-failed
41      *    operation-not-supported
42      *    resource-denied
43      *    rollback-failed
44      *    too-big
45      *    unknown-attribute
46      *    unknown-element
47      *    unknown-namespace
48      * </pre>
49      * @return a string if available or null otherwise.
50      */
51     ErrorTag getTag();
52
53     /**
54      * Returns a short string that identifies the specific type of error condition as
55      * determined by the application reporting the error.
56      *
57      * @return a string if available or null otherwise.
58      */
59     String getApplicationTag();
60
61     /**
62      * Returns a string suitable for human display that describes the error
63      * condition.
64      *
65      * @return a message string.
66      */
67     String getMessage();
68
69     /**
70      * Returns a string containing additional information to provide extended
71      * and/or implementation-specific debugging information.
72      *
73      * @return a string if available or null otherwise.
74      */
75     // FIXME: YANGTOOLS-765: this is wrong and needs to be modeled at data-api layer with YangErrorInfo
76     String getInfo();
77
78     /**
79      * Returns an exception cause.
80      *
81      * @return a Throwable if the error was triggered by exception, null otherwise.
82      */
83     Throwable getCause();
84
85     /**
86      * Returns the conceptual layer at which the error occurred.
87      *
88      * @return an {@link ErrorType} enum.
89      */
90     ErrorType getErrorType();
91 }