[Conkeror] [PATCH] Show errors from completers, etc.
David Kettler
kettler at internode.on.net
Fri May 8 05:37:05 PDT 2009
If an interactive_error was thrown in a minibuffer completer function,
the error was previously lost. This commit ensures that the error
message is displayed in the minibuffer.
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.
---
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 1426acf..7d7d9c7 100644
--- a/modules/download-manager.js
+++ b/modules/download-manager.js
@@ -452,6 +452,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 be57beb..c6bf106 100644
--- a/modules/help.js
+++ b/modules/help.js
@@ -53,12 +53,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 */, false /* allow untrusted */);
diff --git a/modules/minibuffer-read.js b/modules/minibuffer-read.js
index 743181f..53ec922 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.2.4
More information about the Conkeror
mailing list