aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog12
-rw-r--r--camel/camel-exception.c25
-rw-r--r--camel/camel-folder.c11
-rw-r--r--camel/providers/local/camel-maildir-folder.c16
-rw-r--r--camel/providers/local/camel-mbox-folder.c11
-rw-r--r--camel/providers/local/camel-mh-folder.c16
-rw-r--r--camel/providers/pop3/camel-pop3-folder.c2
7 files changed, 57 insertions, 36 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 613e682fb6..3e94889487 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -28,6 +28,18 @@
2004-05-20 Not Zed <NotZed@Ximian.com>
+ * camel-exception.c (camel_exception_setv): re-arrange the code so
+ exception debug will print the expanded description.
+ (camel_exception_set): print exception debug.
+
+ * providers/pop3/camel-pop3-folder.c (pop3_get_message): same.
+
+ * providers/local/camel-mh-folder.c (mh_get_message) *
+ providers/local/camel-mbox-folder.c (mbox_get_message): *
+ providers/local/camel-maildir-folder.c (maildir_get_message):
+ Don't use INVALID_UID for errors which are more system related.
+ And sync up all the error messages.
+
* providers/nntp/camel-nntp-folder.c (nntp_folder_get_message):
oops, poke the right uid to get the article number.
(nntp_folder_cache_message): & here too. Somehow fixes #58700,
diff --git a/camel/camel-exception.c b/camel/camel-exception.c
index f6e6acf78b..fee7c541aa 100644
--- a/camel/camel-exception.c
+++ b/camel/camel-exception.c
@@ -166,6 +166,9 @@ camel_exception_set (CamelException *ex,
ExceptionId id,
const char *desc)
{
+ if (camel_debug("exception"))
+ printf("CamelException.set(%p, %d, '%s')\n", ex, id, desc);
+
if (!ex)
return;
@@ -209,24 +212,24 @@ camel_exception_setv (CamelException *ex,
...)
{
va_list args;
- char *old;
+ char *desc;
+
+ va_start(args, format);
+ desc = g_strdup_vprintf (format, args);
+ va_end (args);
if (camel_debug("exception"))
- printf("CamelException.setv(%p, %d, '%s')\n", ex, id, format);
+ printf("CamelException.setv(%p, %d, '%s')\n", ex, id, desc);
- if (!ex)
+ if (!ex) {
+ g_free(desc);
return;
+ }
CAMEL_EXCEPTION_LOCK(exception);
-
- old = ex->desc;
-
- va_start(args, format);
- ex->desc = g_strdup_vprintf (format, args);
- va_end (args);
- g_free (old);
-
+ g_free(ex->desc);
+ ex->desc = desc;
ex->id = id;
CAMEL_EXCEPTION_UNLOCK(exception);
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index fcb77723af..feeaab6d09 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -1777,8 +1777,8 @@ folder_changed (CamelObject *obj, gpointer event_data)
GPtrArray *recents = NULL;
gboolean ret = TRUE;
- d(printf ("folder_changed(%p, %p), frozen=%d\n", obj, event_data, folder->priv->frozen));
- d(printf(" added %d remoded %d changed %d recent %d\n",
+ (printf ("folder_changed(%p, %p), frozen=%d\n", obj, event_data, folder->priv->frozen));
+ (printf(" added %d remoded %d changed %d recent %d\n",
changed->uid_added->len, changed->uid_removed->len,
changed->uid_changed->len, changed->uid_recent->len));
@@ -1808,8 +1808,9 @@ folder_changed (CamelObject *obj, gpointer event_data)
camel_folder_set_message_flags (folder, changed->uid_changed->pdata [i], CAMEL_MESSAGE_JUNK_LEARN, 0);
}
}
- d(if (junk || notjunk) printf("** Have '%d' messages for junk filter to learn, launching thread to process them\n",
- (junk ? junk->len : 0) + (notjunk ? notjunk->len : 0)));
+ ((junk || notjunk)
+ && printf("** Have '%d' messages for junk filter to learn, launching thread to process them\n",
+ (junk ? junk->len : 0) + (notjunk ? notjunk->len : 0)));
}
if ((folder->folder_flags & (CAMEL_FOLDER_FILTER_RECENT|CAMEL_FOLDER_FILTER_JUNK))
@@ -1827,7 +1828,7 @@ folder_changed (CamelObject *obj, gpointer event_data)
for (i=0;i<changed->uid_recent->len;i++)
g_ptr_array_add(recents, g_strdup(changed->uid_recent->pdata[i]));
- d(printf("** Have '%d' recent messages, launching thread to process them\n", changed->uid_recent->len));
+ (printf("** Have '%d' recent messages, launching thread to process them\n", changed->uid_recent->len));
}
if (driver || junk || notjunk) {
diff --git a/camel/providers/local/camel-maildir-folder.c b/camel/providers/local/camel-maildir-folder.c
index eca07efbef..3caa91d771 100644
--- a/camel/providers/local/camel-maildir-folder.c
+++ b/camel/providers/local/camel-maildir-folder.c
@@ -208,7 +208,9 @@ static CamelMimeMessage *maildir_get_message(CamelFolder * folder, const gchar *
/* get the message summary info */
if ((info = camel_folder_summary_uid(folder->summary, uid)) == NULL) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, _("Cannot get message: %s\n %s"), uid, _("No such message"));
+ camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+ _("Cannot get message: %s from folder %s\n %s"),
+ uid, lf->folder_path, _("No such message"));
return NULL;
}
@@ -220,18 +222,18 @@ static CamelMimeMessage *maildir_get_message(CamelFolder * folder, const gchar *
camel_folder_summary_info_free(folder->summary, info);
if ((message_stream = camel_stream_fs_new_with_name(name, O_RDONLY, 0)) == NULL) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- _("Cannot get message: %s\n %s"),
- name, g_strerror (errno));
+ camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Cannot get message: %s from folder %s\n %s"),
+ uid, lf->folder_path, g_strerror(errno));
g_free(name);
return NULL;
}
message = camel_mime_message_new();
if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)message, message_stream) == -1) {
- camel_exception_setv(ex, (errno==EINTR)?CAMEL_EXCEPTION_USER_CANCEL:CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- _("Cannot get message: %s\n %s"),
- name, _("Invalid message contents"));
+ camel_exception_setv(ex, (errno==EINTR)?CAMEL_EXCEPTION_USER_CANCEL:CAMEL_EXCEPTION_SYSTEM,
+ _("Cannot get message: %s from folder %s\n %s"),
+ uid, lf->folder_path, _("Invalid message contents"));
g_free(name);
camel_object_unref((CamelObject *)message_stream);
camel_object_unref((CamelObject *)message);
diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c
index eeeb974a52..0d86b6d766 100644
--- a/camel/providers/local/camel-mbox-folder.c
+++ b/camel/providers/local/camel-mbox-folder.c
@@ -414,7 +414,8 @@ retry:
if (info == NULL) {
camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- _("Cannot get message: %s\n %s"), uid, _("No such message"));
+ _("Cannot get message: %s from folder %s\n %s"),
+ uid, lf->folder_path, _("No such message"));
goto fail;
}
@@ -431,7 +432,7 @@ retry:
fd = open(lf->folder_path, O_RDONLY);
if (fd == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Cannot get message: %s from folder %s\n %s"),
uid, lf->folder_path, g_strerror (errno));
goto fail;
@@ -462,7 +463,7 @@ retry:
goto retry;
}
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+ camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID,
_("Cannot get message: %s from folder %s\n %s"), uid, lf->folder_path,
_("The folder appears to be irrecoverably corrupted."));
goto fail;
@@ -470,9 +471,9 @@ retry:
message = camel_mime_message_new();
if (camel_mime_part_construct_from_parser((CamelMimePart *)message, parser) == -1) {
- camel_exception_setv(ex, errno==EINTR?CAMEL_EXCEPTION_USER_CANCEL:CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+ camel_exception_setv(ex, errno==EINTR?CAMEL_EXCEPTION_USER_CANCEL:CAMEL_EXCEPTION_SYSTEM,
_("Cannot get message: %s from folder %s\n %s"), uid, lf->folder_path,
- _("Message construction failed: Corrupt mailbox?"));
+ _("Message construction failed."));
camel_object_unref((CamelObject *)message);
message = NULL;
goto fail;
diff --git a/camel/providers/local/camel-mh-folder.c b/camel/providers/local/camel-mh-folder.c
index 25dbacc49a..83a11e24e2 100644
--- a/camel/providers/local/camel-mh-folder.c
+++ b/camel/providers/local/camel-mh-folder.c
@@ -197,7 +197,9 @@ static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid,
/* get the message summary info */
if ((info = camel_folder_summary_uid(folder->summary, uid)) == NULL) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, _("Cannot get message: %s\n %s"), uid, _("No such message"));
+ camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+ _("Cannot get message: %s from folder %s\n %s"), uid, lf->folder_path,
+ _("No such message"));
return NULL;
}
@@ -206,18 +208,18 @@ static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid,
name = g_strdup_printf("%s/%s", lf->folder_path, uid);
if ((message_stream = camel_stream_fs_new_with_name(name, O_RDONLY, 0)) == NULL) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- _("Cannot get message: %s\n %s"),
- name, g_strerror (errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Cannot get message: %s from folder %s\n %s"), name, lf->folder_path,
+ g_strerror (errno));
g_free(name);
return NULL;
}
message = camel_mime_message_new();
if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)message, message_stream) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- _("Cannot get message: %s\n %s"),
- name, _("Invalid message contents"));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Cannot get message: %s from folder %s\n %s"), name, lf->folder_path,
+ _("Message construction failed."));
g_free(name);
camel_object_unref((CamelObject *)message_stream);
camel_object_unref((CamelObject *)message);
diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c
index edb71802bc..1c17079006 100644
--- a/camel/providers/pop3/camel-pop3-folder.c
+++ b/camel/providers/pop3/camel-pop3-folder.c
@@ -497,7 +497,7 @@ pop3_get_message (CamelFolder *folder, const char *uid, CamelException *ex)
}
if (camel_stream_read(stream, buffer, 1) != 1 || buffer[0] != '#') {
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+ camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
_("Cannot get message %s: %s"), uid, _("Unknown reason"));
goto done;
}