[PATCH] When a search query triggers a Xapian exception, log what the query was.

classic Classic list List threaded Threaded
2 messages Options
Eric Anholt Eric Anholt
Reply | Threaded
Open this post in threaded view
|

[PATCH] When a search query triggers a Xapian exception, log what the query was.

In my script containing a series of queries to be run on new mail for
setting up tags, it's nice to see which query I typed wrong.

Signed-off-by: Eric Anholt <[hidden email]>
---
 lib/query.cc |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/query.cc b/lib/query.cc
index 75f22b3..ea521dd 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -151,6 +151,7 @@ notmuch_query_search_messages (notmuch_query_t *query,
     } catch (const Xapian::Error &error) {
  fprintf (stderr, "A Xapian exception occurred: %s\n",
  error.get_msg().c_str());
+ fprintf (stderr, "Query string was: %s\n", query->query_string);
     }
 
     return _notmuch_messages_create (message_list);
--
1.6.4.3


Carl Worth-2 Carl Worth-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] When a search query triggers a Xapian exception, log what the query was.

On Fri, 20 Nov 2009 14:00:42 +0100, Eric Anholt <[hidden email]> wrote:
> In my script containing a series of queries to be run on new mail for
> setting up tags, it's nice to see which query I typed wrong.

Good point. Pushed.

Thanks,

-Carl