summaryrefslogtreecommitdiff
path: root/message-file.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2009-10-25 10:22:41 -0700
committerCarl Worth <cworth@cworth.org>2009-10-25 10:54:49 -0700
commit7b227a6bf7eb409b4353adc430b2545166e0c4cd (patch)
tree9b82d6e3bec4596fdbbec6a7c449e00e3e19ad03 /message-file.c
parent3b8e3ab666a54407f9596a53c66ba8ce623ac91d (diff)
Add an INTERNAL_ERROR macro and use it for all internal errors.
We were previously just doing fprintf;exit at each point, but I wanted to add file and line-number details to all messages, so it makes sense to use a single macro for that.
Diffstat (limited to 'message-file.c')
-rw-r--r--message-file.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/message-file.c b/message-file.c
index fd7e68b..cb2bf66 100644
--- a/message-file.c
+++ b/message-file.c
@@ -125,10 +125,8 @@ notmuch_message_file_restrict_headersv (notmuch_message_file_t *message,
{
char *header;
- if (message->parsing_started ) {
- fprintf (stderr, "Error: notmuch_message_file_restrict_headers called after parsing has started\n");
- exit (1);
- }
+ if (message->parsing_started)
+ INTERNAL_ERROR ("notmuch_message_file_restrict_headers called after parsing has started");
while (1) {
header = va_arg (va_headers, char*);
@@ -305,11 +303,9 @@ notmuch_message_file_get_header (notmuch_message_file_t *message,
! g_hash_table_lookup_extended (message->headers,
header_desired, NULL, NULL))
{
- fprintf (stderr,
- "Internal error: Attempt to get header \"%s\" which was not\n"
- "included in call to notmuch_message_file_restrict_headers\n",
- header_desired);
- exit (1);
+ INTERNAL_ERROR ("Attempt to get header \"%s\" which was not\n"
+ "included in call to notmuch_message_file_restrict_headers\n",
+ header_desired);
}
return NULL;