changeset 5742:7d9edc094ec7 HEAD

Treat unknown errors as temporary errors.
author Timo Sirainen <tss@iki.fi>
date Thu, 14 Jun 2007 21:52:08 +0300
parents 7a57631e2d6c
children 1fa32e040ea5
files src/lib-storage/mail-storage.c
diffstat 1 files changed, 17 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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(struct mail_storage *storage,
 					enum mail_error *error_r)
 {
-	*error_r = storage->error;
+	/* 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";
+	}
 
-	/* 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";
+	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;
+	return storage->error_string;
 }
 
 const char *mail_storage_get_mailbox_path(struct mail_storage *storage,