Re: Slightly better error codes



And here is yet another patch.

I'd rather keep these errors completely away from the application's
callback implementations, but for now I don't want to risk disturbing
how they might be used internally.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com
Index: libtinymail-camel/tny-camel-transport-account.c
===================================================================
--- libtinymail-camel/tny-camel-transport-account.c	(revision 2430)
+++ libtinymail-camel/tny-camel-transport-account.c	(working copy)
@@ -175,6 +175,9 @@
 		return TNY_TRANSPORT_ACCOUNT_ERROR_SEND_SERVICE_UNAVAILABLE;
 	case CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE:
 		return TNY_TRANSPORT_ACCOUNT_ERROR_SEND_AUTHENTICATION_NOT_SUPPORTED;
+	case CAMEL_EXCEPTION_USER_CANCEL:
+		/* TODO: This really shouldn't be shown to the user: */
+		return TNY_TRANSPORT_ACCOUNT_ERROR_SEND_USER_CANCEL;
 	case CAMEL_EXCEPTION_SYSTEM:
 	default:
 		/* A generic exception. 
Index: libtinymail-camel/tny-camel-account.c
===================================================================
--- libtinymail-camel/tny-camel-account.c	(revision 2430)
+++ libtinymail-camel/tny-camel-account.c	(working copy)
@@ -148,7 +148,6 @@
 			camel_exception_clear (&ex);
 
 		camel_service_connect (apriv->service, &ex);
-
 		if (apriv->service->reconnection)
 		{
 			if (!camel_exception_is_set (&ex))
@@ -316,7 +315,7 @@
 TnyError
 _tny_camel_account_get_tny_error_code_for_camel_exception_id (CamelException* ex)
 {
-	printf ("DEBUG: %s: ex->id=%d, ex->desc=%s\n", __FUNCTION__, ex->id, ex->desc);
+	/* printf ("DEBUG: %s: ex->id=%d, ex->desc=%s\n", __FUNCTION__, ex->id, ex->desc); */
 	if (!ex) {
 		g_warning ("%s: The exception was NULL.\n", __FUNCTION__);
 		return TNY_ACCOUNT_ERROR_TRY_CONNECT;
@@ -335,6 +334,9 @@
 		return TNY_ACCOUNT_ERROR_TRY_CONNECT_AUTHENTICATION_NOT_SUPPORTED;
 	case CAMEL_EXCEPTION_SERVICE_CERTIFICATE:
 		return TNY_ACCOUNT_ERROR_TRY_CONNECT_CERTIFICATE;
+	case CAMEL_EXCEPTION_USER_CANCEL:
+		/* TODO: This really shouldn't be shown to the user: */
+		return TNY_ACCOUNT_ERROR_TRY_CONNECT_USER_CANCEL;
 	case CAMEL_EXCEPTION_SYSTEM:
 	default:
 		/* A generic exception. 
@@ -351,13 +353,12 @@
 	TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self);
 
 	TNY_CAMEL_ACCOUNT_GET_CLASS (self)->prepare_func (TNY_CAMEL_ACCOUNT (self), for_online, TRUE);
-
 	if (camel_exception_is_set (priv->ex))
 	{
 		g_set_error (err, TNY_ACCOUNT_ERROR, 
 			_tny_camel_account_get_tny_error_code_for_camel_exception_id (priv->ex),
 			camel_exception_get_description (priv->ex));
-		printf ("DEBUG: %s: camel exception: message=%s\n", __FUNCTION__, (*err)->message);
+		/* printf ("DEBUG: %s: camel exception: message=%s\n", __FUNCTION__, (*err)->message); */
 	}
 
 	return;
Index: libtinymail/tny-error.c
===================================================================
--- libtinymail/tny-error.c	(revision 2430)
+++ libtinymail/tny-error.c	(working copy)
@@ -80,13 +80,15 @@
       { TNY_TRANSPORT_ACCOUNT_ERROR_SEND_HOST_LOOKUP_FAILED, "TNY_TRANSPORT_ACCOUNT_ERROR_SEND_HOST_LOOKUP_FAILED", "transport_account_error_send_host_lookup_failed" },
       { TNY_TRANSPORT_ACCOUNT_ERROR_SEND_SERVICE_UNAVAILABLE, "TNY_TRANSPORT_ACCOUNT_ERROR_SEND_SERVICE_UNAVAILABLE", "transport_account_error_send_service_unavailable" },
       { TNY_TRANSPORT_ACCOUNT_ERROR_SEND_AUTHENTICATION_NOT_SUPPORTED, "TNY_TRANSPORT_ACCOUNT_ERROR_SEND_AUTHENTICATION_NOT_SUPPORTED", "transport_account_error_send_authentication_not_supported" },
-
+      { TNY_TRANSPORT_ACCOUNT_ERROR_SEND_USER_CANCEL, "TNY_ACCOUNT_ERROR_TRY_CONNECT_SEND_USER_CANCEL", "transport_account_error_send_user_cancel" },
+     
       { TNY_ACCOUNT_ERROR_TRY_CONNECT, "TNY_ACCOUNT_ERROR_TRY_CONNECT", "account_error_try_connect" },
       { TNY_ACCOUNT_ERROR_TRY_CONNECT_HOST_LOOKUP_FAILED, "TNY_ACCOUNT_ERROR_TRY_CONNECT_HOST_LOOKUP_FAILED", "account_error_try_connect_host_lookup_failed" },
       { TNY_ACCOUNT_ERROR_TRY_CONNECT_SERVICE_UNAVAILABLE, "TNY_ACCOUNT_ERROR_TRY_CONNECT_SERVICE_UNAVAILABLE", "account_error_try_connect_service_unavailable" },
       { TNY_ACCOUNT_ERROR_TRY_CONNECT_AUTHENTICATION_NOT_SUPPORTED, "TNY_ACCOUNT_ERROR_TRY_CONNECT_AUTHENTICATION_NOT_SUPPORTED", "account_error_try_connect_authentication_not_supported" },
       { TNY_ACCOUNT_ERROR_TRY_CONNECT_CERTIFICATE, "TNY_ACCOUNT_ERROR_TRY_CONNECT_CERTIFICATE", "account_error_try_connect_certificate" },
-     
+      { TNY_ACCOUNT_ERROR_TRY_CONNECT_USER_CANCEL, "TNY_ACCOUNT_ERROR_TRY_CONNECT_USER_CANCEL", "account_error_try_connect_user_cancel" },
+    
       { TNY_ACCOUNT_STORE_ERROR_UNKNOWN_ALERT, "TNY_ACCOUNT_STORE_ERROR_UNKNOWN_ALERT", "account_store_error_unknown_alert" },
 
       { TNY_SEND_QUEUE_ERROR_ADD, "TNY_SEND_QUEUE_ERROR_ADD", "send_queue_error_add"},
Index: libtinymail/tny-enums.h
===================================================================
--- libtinymail/tny-enums.h	(revision 2430)
+++ libtinymail/tny-enums.h	(working copy)
@@ -76,12 +76,14 @@
 	TNY_TRANSPORT_ACCOUNT_ERROR_SEND_HOST_LOOKUP_FAILED = 23,
 	TNY_TRANSPORT_ACCOUNT_ERROR_SEND_SERVICE_UNAVAILABLE = 24,
 	TNY_TRANSPORT_ACCOUNT_ERROR_SEND_AUTHENTICATION_NOT_SUPPORTED = 25,
+	TNY_TRANSPORT_ACCOUNT_ERROR_SEND_USER_CANCEL = 26,
 
 	TNY_ACCOUNT_ERROR_TRY_CONNECT = 14,
 	TNY_ACCOUNT_ERROR_TRY_CONNECT_HOST_LOOKUP_FAILED = 19,
 	TNY_ACCOUNT_ERROR_TRY_CONNECT_SERVICE_UNAVAILABLE = 20,
 	TNY_ACCOUNT_ERROR_TRY_CONNECT_AUTHENTICATION_NOT_SUPPORTED = 21,
 	TNY_ACCOUNT_ERROR_TRY_CONNECT_CERTIFICATE = 22,
+	TNY_ACCOUNT_ERROR_TRY_CONNECT_USER_CANCEL = 27,
 
 	TNY_ACCOUNT_STORE_ERROR_UNKNOWN_ALERT = 15,
 
Index: libtinymail/tny-error.h
===================================================================
--- libtinymail/tny-error.h	(revision 2430)
+++ libtinymail/tny-error.h	(working copy)
@@ -110,12 +110,14 @@
 	TNY_TRANSPORT_ACCOUNT_ERROR_SEND_HOST_LOOKUP_FAILED = 23,
 	TNY_TRANSPORT_ACCOUNT_ERROR_SEND_SERVICE_UNAVAILABLE = 24,
 	TNY_TRANSPORT_ACCOUNT_ERROR_SEND_AUTHENTICATION_NOT_SUPPORTED = 25,
+	TNY_TRANSPORT_ACCOUNT_ERROR_SEND_USER_CANCEL = 26,
 
 	TNY_ACCOUNT_ERROR_TRY_CONNECT = 14,
 	TNY_ACCOUNT_ERROR_TRY_CONNECT_HOST_LOOKUP_FAILED = 19,
 	TNY_ACCOUNT_ERROR_TRY_CONNECT_SERVICE_UNAVAILABLE = 20,
 	TNY_ACCOUNT_ERROR_TRY_CONNECT_AUTHENTICATION_NOT_SUPPORTED = 21,
 	TNY_ACCOUNT_ERROR_TRY_CONNECT_CERTIFICATE = 22,
+	TNY_ACCOUNT_ERROR_TRY_CONNECT_USER_CANCEL = 27,
 
 	TNY_ACCOUNT_STORE_ERROR_UNKNOWN_ALERT = 15,
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]