- this.errorType = errorType;
- this.errorTag = errorTag;
- this.errorSeverity = errorSeverity;
- this.errorInfo = errorInfo;
- }
-
- public NetconfDocumentedException(final String message, final Exception cause, final ErrorType errorType,
- final ErrorTag errorTag, final ErrorSeverity errorSeverity) {
- this(message, cause, errorType, errorTag, errorSeverity, Collections.<String, String> emptyMap());
- }
-
- public NetconfDocumentedException(final String message, final Exception cause, final ErrorType errorType,
- final ErrorTag errorTag, final ErrorSeverity errorSeverity, final Map<String, String> errorInfo) {
- super(message, cause);
- this.errorType = errorType;
- this.errorTag = errorTag;
- this.errorSeverity = errorSeverity;
- this.errorInfo = errorInfo;
- }
-
- public static <E extends Exception> NetconfDocumentedException wrap(E exception) throws NetconfDocumentedException {
- final Map<String, String> 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<String, String> errorInfo = new HashMap<>();
- errorInfo.put(ErrorTag.operation_failed.name(), "Validation failed");
- throw new NetconfDocumentedException(e.getMessage(), e, ErrorType.application, ErrorTag.operation_failed,
- ErrorSeverity.error, errorInfo);