Error messages appear in background page, not in dialog
To help those implement @Clive's suggestion you can do the following:

(function ($) {
  $(document).ready(function () {
    $("#dialog").dialog({
        autoOpen: false,
        modal: true,
        width: 400,
        open: function() {
            $('.messages').prependTo('#dialog');
        }
    });
  });
})(jQuery);


Substitute #dialog with the name of the div containing your dialog's components.