changeset 6021:f40d16eed722 HEAD

Give better error messages if storage creation fails.
author Timo Sirainen <tss@iki.fi>
date Sun, 15 Jul 2007 14:44:23 +0300
parents b94fc6e80bae
children 8da2881df0dc
files src/lib-storage/mail-namespace.c
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/mail-namespace.c	Sun Jul 15 14:34:57 2007 +0300
+++ b/src/lib-storage/mail-namespace.c	Sun Jul 15 14:44:23 2007 +0300
@@ -70,8 +70,8 @@
 
 	ns->prefix = p_strdup(pool, prefix);
 	if (mail_storage_create(ns, NULL, data, user, flags, lock_method) < 0) {
-		i_error("Failed to create storage for '%s' with data: %s",
-			ns->prefix, data);
+		i_error("Namespace '%s' mail storage creation failed "
+			"with mail location: %s", ns->prefix, data);
 		return NULL;
 	}
 
@@ -213,16 +213,17 @@
 	ns->prefix = "";
 
 	if (mail_storage_create(ns, NULL, mail, user, flags, lock_method) < 0) {
-		if (mail != NULL && *mail != '\0')
-			i_error("Failed to create storage with data: %s", mail);
-		else {
+		if (mail != NULL && *mail != '\0') {
+			i_error("Mail storage creation failed with "
+				"mail_location: %s", mail);
+		} else {
 			const char *home;
 
 			home = getenv("HOME");
-			if (home == NULL) home = "not set";
+			if (home == NULL || *home == '\0') home = "(not set)";
 
-			i_error("MAIL environment missing and "
-				"autodetection failed (home %s)", home);
+			i_error("mail_location not set and "
+				"autodetection failed with home=%s", home);
 		}
 		return -1;
 	}