Handle exception when compiling fails
- Change arguments of the constructor of PathNotFoundException
- Change the catched exception in Compiling.execute()
Change-Id: I3b639ffd585900c2a6dd99aeeb313bf20c6104f4
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/PathNotFoundException.java b/core/net/src/main/java/org/onosproject/net/intent/impl/PathNotFoundException.java
index 32f1e35..41b1c8f 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/PathNotFoundException.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/PathNotFoundException.java
@@ -15,23 +15,32 @@
*/
package org.onosproject.net.intent.impl;
+import com.google.common.base.MoreObjects;
+import org.onosproject.net.ElementId;
import org.onosproject.net.intent.IntentException;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* An exception thrown when a path is not found.
*/
public class PathNotFoundException extends IntentException {
private static final long serialVersionUID = -2087045731049914733L;
- public PathNotFoundException() {
- super();
+ private final ElementId source;
+ private final ElementId destination;
+
+ public PathNotFoundException(ElementId source, ElementId destination) {
+ super(String.format("No path from %s to %s", source, destination));
+ this.source = checkNotNull(source);
+ this.destination = checkNotNull(destination);
}
- public PathNotFoundException(String message) {
- super(message);
- }
-
- public PathNotFoundException(String message, Throwable cause) {
- super(message, cause);
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("source", source)
+ .add("destination", destination)
+ .toString();
}
}