Better error handling in pseudowire implementation.
I refactored the pw handler to return meaningful very specific
errors for failures. As a result, I modified also the cli and rest
api implementations to use these fine grain errors accordingly.
Change-Id: I2429532f747c4560378c40be325b039ca0f5c925
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireRemoveCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireRemoveCommand.java
index 305f0be..362ebbb 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireRemoveCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireRemoveCommand.java
@@ -56,11 +56,15 @@
L2TunnelHandler.Result res = mngr.removePseudowire(pwIntId);
switch (res) {
- case REMOVAL_ERROR:
- error("Error in deletion, pseudowire not found!");
+ case WRONG_PARAMETERS:
+ error("Pseudowire could not be removed , wrong parameters: \n\t %s\n",
+ res.getSpecificError());
break;
- case CONFIG_NOT_FOUND:
- error("Could not fetch pseudowire class configuration!");
+ case INTERNAL_ERROR:
+ error("Pseudowire could not be removed, internal error : \n\t %s\n",
+ res.getSpecificError());
+ break;
+ case SUCCESS:
break;
default:
break;