Discarding meaningless error messages for AJAX requests
authorAlexander Ebert <ebert@woltlab.com>
Tue, 11 Jun 2013 23:36:13 +0000 (01:36 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 11 Jun 2013 23:36:13 +0000 (01:36 +0200)
Some requests do not return anything, which is perfectly fine but causes empty error messages to be displayed.

wcfsetup/install/files/js/WCF.js

index 25c912838eed583e6940214125cbc5f3f9a5bd18..99c5278017d1d378b0d9e0ab5f2d1727ed8ecaf5 100755 (executable)
@@ -1863,7 +1863,11 @@ WCF.Action.Proxy = Class.extend({
                        
                        if (!this._suppressErrors && $showError !== false) {
                                var $message = (textStatus === 'timeout') ? WCF.Language.get('wcf.global.error.timeout') : jqXHR.responseText;
-                               $('<div class="ajaxDebugMessage"><p>' + $message + '</p></div>').wcfDialog({ title: WCF.Language.get('wcf.global.error.title') });
+                               
+                               // validate if $message is neither empty nor 'undefined'
+                               if ($message && $message != 'undefined') {
+                                       $('<div class="ajaxDebugMessage"><p>' + $message + '</p></div>').wcfDialog({ title: WCF.Language.get('wcf.global.error.title') });
+                               }
                        }
                }