aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Austin Clements <amdragon@MIT.EDU>2013-01-03 16:47:49 -0500
committerGravatar David Bremner <bremner@debian.org>2013-01-06 22:47:35 -0400
commit401dbebd4803477563eff03d719605ed37a8e44d (patch)
treee4ad1803db370bdc913da6ad14ac97759dd0abed /test
parentc31a91bc5c270a9f416b63bb75c95f6274fce978 (diff)
emacs: Use the minibuffer for CLI error reporting
We recently switched to popping up a buffer to report CLI errors, but this was too intrusive, especially for transient errors and especially since we made fewer things ignore errors. This patch changes this to display a basic error message in the minibuffer (using Emacs' usual error handling path) and, if there are additional details, to log these to a separate error buffer and reference the error buffer from the minibuffer message. This is more in line with how Emacs typically handles errors, but makes the details available to the user without flooding them with the details. Given this split, we pare down the basic message and make it more user-friendly, and also make the verbose message even more detailed (and more debugging-oriented).
Diffstat (limited to 'test')
-rwxr-xr-xtest/emacs19
-rwxr-xr-xtest/emacs-show26
2 files changed, 33 insertions, 12 deletions
diff --git a/test/emacs b/test/emacs
index 6b189688..f033bdf5 100755
--- a/test/emacs
+++ b/test/emacs
@@ -862,18 +862,27 @@ exit 1
EOF
chmod a+x notmuch_fail
test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))
+ (with-current-buffer \"*Messages*\" (erase-buffer))
(notmuch-search \"tag:inbox\")
(notmuch-test-wait)
- (test-output)
+ (with-current-buffer \"*Messages*\"
+ (test-output \"MESSAGES\"))
(with-current-buffer \"*Notmuch errors*\"
- (test-output \"ERROR\")))"
-test_expect_equal "$(cat OUTPUT ERROR)" "\
+ (test-output \"ERROR\"))
+ (test-output))"
+sed -i -e 's/^\[.*\]$/[XXX]/' ERROR
+test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\
Error: Unexpected output from notmuch search:
This is output
Error: Unexpected output from notmuch search:
This is an error
End of search results.
-Error invoking notmuch. $PWD/notmuch_fail search --format=json --format-version=1 --sort=newest-first tag:inbox exited with status 1."
-
+---
+$PWD/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)
+---
+[XXX]
+$PWD/notmuch_fail exited with status 1
+command: $PWD/notmuch_fail search --format\=json --format-version\=1 --sort\=newest-first tag\:inbox
+exit status: 1"
test_done
diff --git a/test/emacs-show b/test/emacs-show
index ebf530bc..9f2ccb0e 100755
--- a/test/emacs-show
+++ b/test/emacs-show
@@ -172,16 +172,28 @@ exit 1
EOF
chmod a+x notmuch_fail
test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))
- (ignore-errors (notmuch-show \"*\"))
+ (with-current-buffer \"*Messages*\" (erase-buffer))
+ (condition-case err
+ (notmuch-show \"*\")
+ (error (message \"%s\" (second err))))
(notmuch-test-wait)
- (test-output)
+ (with-current-buffer \"*Messages*\"
+ (test-output \"MESSAGES\"))
(with-current-buffer \"*Notmuch errors*\"
- (test-output \"ERROR\")))"
-test_expect_equal "$(cat OUTPUT ERROR)" "\
-Error invoking notmuch. $PWD/notmuch_fail show --format=json --format-version=1 --exclude=false ' * ' exited with status 1.
-Error:
+ (test-output \"ERROR\"))
+ (test-output))"
+sed -i -e 's/^\[.*\]$/[XXX]/' ERROR
+test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\
+---
+This is an error (see *Notmuch errors* for more details)
+---
+[XXX]
This is an error
-Output:
+command: $PWD/notmuch_fail show --format\\=json --format-version\\=1 --exclude\\=false \\' \\* \\'
+exit status: 1
+stderr:
+This is an error
+stdout:
This is output"