X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fapi%2FNetconfDocumentedException.java;h=1ecbc55b2a02ac7af0757e777d960956cfddc0a0;hb=1895c1473b803a53ad5e2a092c4dacb4ffed2ee2;hp=ceeca51defdff65016a842faaa97bfcdc165d6ae;hpb=4eb724db3877173d502ba38c6d83bec780b38bb2;p=controller.git diff --git a/opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfDocumentedException.java b/opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfDocumentedException.java index ceeca51def..1ecbc55b2a 100644 --- a/opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfDocumentedException.java +++ b/opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfDocumentedException.java @@ -62,6 +62,14 @@ public class NetconfDocumentedException extends Exception { private final ErrorSeverity errorSeverity; private final Map errorInfo; + public NetconfDocumentedException(String message) { + this(message, + NetconfDocumentedException.ErrorType.application, + NetconfDocumentedException.ErrorTag.invalid_value, + NetconfDocumentedException.ErrorSeverity.error + ); + } + public NetconfDocumentedException(final String message, final ErrorType errorType, final ErrorTag errorTag, final ErrorSeverity errorSeverity) { this(message, errorType, errorTag, errorSeverity, Collections. emptyMap()); @@ -90,6 +98,12 @@ public class NetconfDocumentedException extends Exception { this.errorInfo = errorInfo; } + public static NetconfDocumentedException wrap(E exception) throws NetconfDocumentedException { + final Map errorInfo = new HashMap<>(); + errorInfo.put(ErrorTag.operation_failed.name(), "Exception thrown"); + throw new NetconfDocumentedException(exception.getMessage(), exception, ErrorType.application, ErrorTag.operation_failed, + ErrorSeverity.error, errorInfo); + } public static NetconfDocumentedException wrap(ValidationException e) throws NetconfDocumentedException { final Map errorInfo = new HashMap<>(); errorInfo.put(ErrorTag.operation_failed.name(), "Validation failed");