If an interactive_error was thrown in a minibuffer completer function, the error was previously lost. For complicated completers, for instance when completions are dynamically loaded from a file, it is useful for the user to see any error messages. This commit ensures that the error message is displayed briefly in the minibuffer. The user can continue with typing in the minibuffer as usual.
The problem arises because direct uses of co_call do not propagate exceptions. The same fix is applied to the two other places in conkeror that could lose an error message. One other place, in download_helper.handle_show, already handled the problem in the same way. --- An alternative fix would be to provide an interactive_co_call to do the wrappering. The last time I submitted this, Jeremy commented that he had "specifically intended that an exception being thrown would just result in no completions being generated." This patch displays an error, but does not change the user interaction; no completions are generated and the user is still in the minibuffer read. http://thread.gmane.org/gmane.comp.mozilla.conkeror/1522/focus=1524 --- modules/download-manager.js | 2 ++ modules/help.js | 8 +++++++- modules/minibuffer-read.js | 2 ++ 3 files changed, 11 insertions(+), 1 deletions(-) diff --git a/modules/download-manager.js b/modules/download-manager.js index 367277f..7e8dceb 100644 --- a/modules/download-manager.js +++ b/modules/download-manager.js @@ -318,6 +318,8 @@ var download_progress_listener = { yield shell_command_with_argument(info.shell_command, info.target_file.path, $cwd = info.shell_command_cwd); + } catch (e) { + handle_interactive_error(info.source_buffer.window, e); } finally { if (info.temporary_status == DOWNLOAD_TEMPORARY_FOR_COMMAND) if(delete_temporary_files_for_command) { diff --git a/modules/help.js b/modules/help.js index be15720..cd231ef 100644 --- a/modules/help.js +++ b/modules/help.js @@ -44,12 +44,18 @@ help_document_generator.prototype = { source_code_reference : function (ref, parent) { var f = this.document.createDocumentFragment(); var module_name = ref.module_name; + var buffer = this.buffer; //f.appendChild(this.text(module_name != null ? "module " : "file ")); var x = this.element("a", "class", "source-code-reference", "href", "javascript:"); x.addEventListener("click", function (event) { - co_call(ref.open_in_editor()); + co_call(function () { + try { + yield ref.open_in_editor(); + } catch (e) { + handle_interactive_error(buffer.window, e); + }}()); event.preventDefault(); event.stopPropagation(); }, false /* capture */); diff --git a/modules/minibuffer-read.js b/modules/minibuffer-read.js index 1849f70..bdcf139 100644 --- a/modules/minibuffer-read.js +++ b/modules/minibuffer-read.js @@ -268,6 +268,8 @@ text_entry_minibuffer_state.prototype = { var x; try { x = yield c; + } catch (e) { + handle_interactive_error(m.window, e); } finally { s.completions_cont = null; already_done = true; -- 1.6.5 _______________________________________________ Conkeror mailing list [email protected] https://www.mozdev.org/mailman/listinfo/conkeror
