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_r274506410
 
 

 ##########
 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:
   In `nf-error-handler.handleAjaxError` anywhere we show the `message-pane` 
the canvas will be hidden. Probably the most common scenario would be if your 
terminated your NiFi instance. The next request from the browser will fail and 
we show that message that indicates
   
   > Please ensure the application is running and check the logs for any errors.

----------------------------------------------------------------
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

Reply via email to