First cut at REST errors
- Added a new client-facing class to hold a formatted error
- Renamed the existing RestError to be RestErrorCatalogEntry
- Modified the Intent POST operation to return an actual error if the
POST can't parse the inbound object
Change-Id: I05d8919626f1a9350262d4aee7919c0fc8a4fa09
diff --git a/src/main/java/net/onrc/onos/api/rest/RestErrorFormatter.java b/src/main/java/net/onrc/onos/api/rest/RestErrorFormatter.java
index edc39b2..b9b2ba5 100644
--- a/src/main/java/net/onrc/onos/api/rest/RestErrorFormatter.java
+++ b/src/main/java/net/onrc/onos/api/rest/RestErrorFormatter.java
@@ -14,19 +14,19 @@
private RestErrorFormatter() { }
/**
- * Takes a RestError template and formats the description using a supplied
+ * Takes a RestErrorCatalogEntry template and formats the description using a supplied
* list of replacement parameters.
*
- * @param error the RestError to format
+ * @param error the RestErrorCatalogEntry to format
* @param parameters parameter list to use as positional parameters in the
* result string
*
* @return the String object for the formatted message.
*/
- static String formatErrorMessage(final RestError error,
+ static String formatErrorMessage(final RestErrorCatalogEntry error,
final Object... parameters) {
final FormattingTuple formattingResult =
- MessageFormatter.arrayFormat(error.getDescription(), parameters);
+ MessageFormatter.arrayFormat(error.getDescriptionFormatString(), parameters);
return formattingResult.getMessage();
}
}