mcgilman commented on a change in pull request #3401: NIFI-6160 NIFI-6170 Apply
config error handling convention
URL: https://github.com/apache/nifi/pull/3401#discussion_r274110475
##########
File path:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-error-handler.js
##########
@@ -142,6 +142,36 @@
// show the error pane
$('#message-pane').show();
}
+ },
+
+ /**
+ * Method for handling ajax errors when submitting configuration
update (PUT/POST) requests.
+ * In addition to what handleAjaxError does, this function splits
+ * the error message text to display them as an unordered list.
+ *
+ * @argument {object} xhr The XmlHttpRequest
+ * @argument {string} status The status of the request
+ * @argument {string} error The error
+ */
+ handleConfigurationUpdateAjaxError: function (xhr, status, error) {
+ if (xhr.status === 400) {
+ var errors = xhr.responseText.split('\n');
+
+ var content;
+ if (errors.length === 1) {
+ content = $('<span></span>').text(errors[0]);
+ } else {
+ content = nfCommon.formatUnorderedList(errors);
+ }
+
+ nfDialog.showOkDialog({
+ dialogContent: content,
+ headerText: 'Configuration Error'
+ });
+ } else {
+ self.handleAjaxError(xhr, status, error);
Review comment:
If this condition happens on the canvas (through `nf-canvas-error-handler`)
I think we would actually want to invoke that `handleAjaxError` so that we can
run those specific actions when we hide the canvas. This may not be possible
from here so we may need additional logic in `nf-canvas-error-handler`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services