package org.opendaylight.netconf.mdsal.connector.ops;
import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableMap;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
+import java.util.Map;
import org.opendaylight.controller.config.util.xml.DocumentedException;
import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorSeverity;
import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorTag;
final NodeList elementsByTagName = operationElement.getDomElement().getElementsByTagName(TARGET_KEY);
// Direct lookup instead of using XmlElement class due to performance
if (elementsByTagName.getLength() == 0) {
- throw new DocumentedException("Missing target element", ErrorType.RPC, ErrorTag.MISSING_ATTRIBUTE, ErrorSeverity.ERROR);
+ Map<String, String> errorInfo = ImmutableMap.of("bad-attribute", TARGET_KEY, "bad-element", OPERATION_NAME);
+ throw new DocumentedException("Missing target element",
+ ErrorType.PROTOCOL, ErrorTag.MISSING_ATTRIBUTE, ErrorSeverity.ERROR, errorInfo);
} else if (elementsByTagName.getLength() > 1) {
throw new DocumentedException("Multiple target elements", ErrorType.RPC, ErrorTag.UNKNOWN_ATTRIBUTE, ErrorSeverity.ERROR);
} else {
return;
}
- throw new DocumentedException("Missing attribute" + rootNode.getNodeName(),
- DocumentedException.ErrorType.PROTOCOL, DocumentedException.ErrorTag.MISSING_ATTRIBUTE,
+ throw new DocumentedException("Missing attribute " + rootNode.getNodeName(),
+ DocumentedException.ErrorType.RPC, DocumentedException.ErrorTag.MISSING_ATTRIBUTE,
DocumentedException.ErrorSeverity.ERROR,
- ImmutableMap.of(DocumentedException.ErrorTag.MISSING_ATTRIBUTE.toString(),
- XmlNetconfConstants.MESSAGE_ID));
+ ImmutableMap.of("bad-attribute", XmlNetconfConstants.MESSAGE_ID,
+ "bad-element", XmlNetconfConstants.RPC_KEY));
}
}