dovecot: Treat unknown errors as temporary errors.

dovecot at dovecot.org dovecot at dovecot.org
Thu Jun 14 21:52:24 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/7d9edc094ec7
changeset: 5742:7d9edc094ec7
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jun 14 21:52:08 2007 +0300
description:
Treat unknown errors as temporary errors.

diffstat:

1 file changed, 17 insertions(+), 6 deletions(-)
src/lib-storage/mail-storage.c |   23 +++++++++++++++++------

diffs (34 lines):

diff -r 7a57631e2d6c -r 7d9edc094ec7 src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Thu Jun 14 15:01:09 2007 +0300
+++ b/src/lib-storage/mail-storage.c	Thu Jun 14 21:52:08 2007 +0300
@@ -318,13 +318,24 @@ const char *mail_storage_get_last_error(
 const char *mail_storage_get_last_error(struct mail_storage *storage,
 					enum mail_error *error_r)
 {
+	/* We get here only in error situations, so we have to return some
+	   error. If storage->error is NONE, it means we forgot to set it at
+	   some point.. */
+	if (storage->error == MAIL_ERROR_NONE) {
+		*error_r = MAIL_ERROR_TEMP;
+		return storage->error_string != NULL ? storage->error_string :
+			"BUG: Unknown internal error";
+	}
+
+	if (storage->error_string == NULL) {
+		/* This shouldn't happen.. */
+		storage->error_string =
+			i_strdup_printf("BUG: Unknown 0x%x error",
+					storage->error);
+	}
+
 	*error_r = storage->error;
-
-	/* We get here only in error situations, so we have to return some
-	   error. If storage->error is NULL, it means we forgot to set it at
-	   some point.. */
-	return storage->error_string != NULL ? storage->error_string :
-		"Unknown internal error";
+	return storage->error_string;
 }
 
 const char *mail_storage_get_mailbox_path(struct mail_storage *storage,


More information about the dovecot-cvs mailing list