From e8aa23866a44d1d93750f42a9c168bcd007eb7bb Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Tue, 17 Jul 2001 21:22:20 +0000 Subject: Clean up some exception misusage. 2001-07-17 Peter Williams Clean up some exception misusage. * providers/imap/camel-imap-command.c (camel_imap_command): Use our own internal exception for sending the string and transfer it to @ex if anything goes wrong. (imap_read_response): Use our own internal exception for reading the untagged responses and blah blah blah. * camel-session.c (get_service): Use our own internal exception when constructing the service and transfer it to @ex if anything goes wrong. * camel-remote-store.c (remote_recv_line): Instead of having gboolean exception, use our own internal exception and copy it to @ex if anything goes wrong. * camel-store.c (store_sync): Create an internal exception because sync_folder() checks it for validity. Transfer it to @ex when done. * camel-exception.c (camel_exception_get_description): If @ex is NULL, complain - passing NULL exceptions to Camel is okay, but there should be no circumstances under which they're then examined. (camel_exception_get_id): Same here, (camel_exception_xfer): NULL-protect and warn if transferring from a NULL exception. svn path=/trunk/; revision=11177 --- camel/camel-remote-store.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'camel/camel-remote-store.c') diff --git a/camel/camel-remote-store.c b/camel/camel-remote-store.c index 823a4673f4..aca833f7f0 100644 --- a/camel/camel-remote-store.c +++ b/camel/camel-remote-store.c @@ -453,7 +453,7 @@ remote_recv_line (CamelRemoteStore *store, char **dest, CamelException *ex) CamelStreamBuffer *stream; GByteArray *bytes; gchar buf[1024], *ret; - gboolean exception = FALSE; + CamelException internal_ex; gint nread; *dest = NULL; @@ -478,18 +478,18 @@ remote_recv_line (CamelRemoteStore *store, char **dest, CamelException *ex) g_byte_array_append (bytes, buf, nread); } while (nread == sizeof (buf) - 1); + camel_exception_init (&internal_ex); if (nread == -1) { - exception = TRUE; if (errno == EINTR) - camel_exception_set(ex, CAMEL_EXCEPTION_USER_CANCEL, _("Operation cancelled")); + camel_exception_set(&internal_ex, CAMEL_EXCEPTION_USER_CANCEL, _("Operation cancelled")); else - camel_exception_set(ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, strerror(errno)); - } else if (bytes->len == 0) { - exception = TRUE; - camel_exception_set(ex, CAMEL_EXCEPTION_SERVICE_NOT_CONNECTED, + camel_exception_set(&internal_ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, strerror(errno)); + } else if (bytes->len == 0) + camel_exception_set(&internal_ex, CAMEL_EXCEPTION_SERVICE_NOT_CONNECTED, _("Server unexpectedly disconnected")); - } - if (camel_exception_is_set (ex) || exception) { + + if (camel_exception_is_set (&internal_ex)) { + camel_exception_xfer (ex, &internal_ex); g_byte_array_free(bytes, TRUE); camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL); return -1; -- cgit v1.2.3