[evolution-data-server] Migrate from CamelException to GError.



commit 46938c348728d1c8bcacf6df9e0788b39783bd07
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun May 9 11:26:48 2010 -0500

    Migrate from CamelException to GError.

 camel/Makefile.am                                  |    3 -
 camel/camel-block-file.c                           |    2 +-
 camel/camel-cipher-context.c                       |   96 ++-
 camel/camel-cipher-context.h                       |   26 +-
 camel/camel-data-cache.c                           |   38 +-
 camel/camel-data-cache.h                           |   11 +-
 camel/camel-data-wrapper.c                         |   54 +-
 camel/camel-data-wrapper.h                         |   18 +-
 camel/camel-db.c                                   |  568 +++++++----
 camel/camel-db.h                                   |  100 +-
 camel/camel-debug.h                                |   34 +
 camel/camel-disco-diary.c                          |   29 +-
 camel/camel-disco-diary.h                          |    4 +-
 camel/camel-disco-folder.c                         |  143 ++-
 camel/camel-disco-folder.h                         |   36 +-
 camel/camel-disco-store.c                          |  123 ++-
 camel/camel-disco-store.h                          |   32 +-
 camel/camel-exception-list.def                     |   41 -
 camel/camel-exception.c                            |  282 ------
 camel/camel-exception.h                            |   80 --
 camel/camel-file-utils.c                           |   93 ++-
 camel/camel-file-utils.h                           |    8 +-
 camel/camel-filter-driver.c                        |  161 ++--
 camel/camel-filter-driver.h                        |   10 +-
 camel/camel-filter-search.c                        |   54 +-
 camel/camel-filter-search.h                        |    4 +-
 camel/camel-folder-search.c                        |  154 ++--
 camel/camel-folder-search.h                        |    6 +-
 camel/camel-folder-summary.c                       |  182 ++--
 camel/camel-folder-summary.h                       |   12 +-
 camel/camel-folder.c                               |  182 +++--
 camel/camel-folder.h                               |   76 +-
 camel/camel-gpg-context.c                          |  298 +++---
 camel/camel-http-stream.c                          |   83 ++-
 camel/camel-index-control.c                        |    4 +-
 camel/camel-index.h                                |    1 -
 camel/camel-lock-client.c                          |   35 +-
 camel/camel-lock-client.h                          |    4 +-
 camel/camel-lock-helper.c                          |   16 +-
 camel/camel-lock.c                                 |  101 +-
 camel/camel-lock.h                                 |   10 +-
 camel/camel-mime-filter-save.c                     |    2 +-
 camel/camel-mime-message.c                         |   19 +-
 camel/camel-mime-parser.c                          |   31 +-
 camel/camel-mime-parser.h                          |    4 +-
 camel/camel-mime-part-utils.c                      |   34 +-
 camel/camel-mime-part-utils.h                      |    5 +-
 camel/camel-mime-part.c                            |   73 +-
 camel/camel-mime-part.h                            |    5 +-
 camel/camel-movemail.c                             |   86 +-
 camel/camel-movemail.h                             |    4 +-
 camel/camel-multipart-signed.c                     |   79 +-
 camel/camel-multipart-signed.h                     |    2 +-
 camel/camel-multipart.c                            |   25 +-
 camel/camel-net-utils.c                            |   58 +-
 camel/camel-net-utils.h                            |    6 +-
 camel/camel-object.c                               |   13 +
 camel/camel-object.h                               |   10 +-
 camel/camel-offline-folder.c                       |   23 +-
 camel/camel-offline-folder.h                       |    4 +-
 camel/camel-offline-journal.c                      |   32 +-
 camel/camel-offline-journal.h                      |    6 +-
 camel/camel-offline-store.c                        |   34 +-
 camel/camel-offline-store.h                        |    8 +-
 camel/camel-provider.c                             |   36 +-
 camel/camel-provider.h                             |    9 +-
 camel/camel-sasl-anonymous.c                       |   22 +-
 camel/camel-sasl-cram-md5.c                        |    2 +-
 camel/camel-sasl-digest-md5.c                      |   32 +-
 camel/camel-sasl-gssapi.c                          |   39 +-
 camel/camel-sasl-login.c                           |   10 +-
 camel/camel-sasl-ntlm.c                            |    2 +-
 camel/camel-sasl-plain.c                           |    2 +-
 camel/camel-sasl-popb4smtp.c                       |   16 +-
 camel/camel-sasl.c                                 |   17 +-
 camel/camel-sasl.h                                 |    7 +-
 camel/camel-search-private.c                       |   11 +-
 camel/camel-search-private.h                       |    2 +-
 camel/camel-seekable-stream.c                      |   31 +-
 camel/camel-seekable-stream.h                      |   12 +-
 camel/camel-seekable-substream.c                   |   27 +-
 camel/camel-service.c                              |   71 +-
 camel/camel-service.h                              |   38 +-
 camel/camel-session.c                              |  116 ++-
 camel/camel-session.h                              |   40 +-
 camel/camel-smime-context.c                        |  198 ++--
 camel/camel-store.c                                |  234 +++--
 camel/camel-store.h                                |   71 +-
 camel/camel-stream-buffer.c                        |   47 +-
 camel/camel-stream-buffer.h                        |    6 +-
 camel/camel-stream-filter.c                        |   34 +-
 camel/camel-stream-fs.c                            |   81 ++-
 camel/camel-stream-fs.h                            |    9 +-
 camel/camel-stream-mem.c                           |    9 +-
 camel/camel-stream-null.c                          |    6 +-
 camel/camel-stream-process.c                       |   20 +-
 camel/camel-stream-vfs.c                           |   50 +-
 camel/camel-stream.c                               |   90 ++-
 camel/camel-stream.h                               |   36 +-
 camel/camel-tcp-stream-raw.c                       |   34 +-
 camel/camel-tcp-stream-ssl.c                       |   47 +-
 camel/camel-tcp-stream.c                           |   11 +-
 camel/camel-tcp-stream.h                           |   15 +-
 camel/camel-text-index.h                           |    1 -
 camel/camel-transport.c                            |   14 +-
 camel/camel-transport.h                            |    4 +-
 camel/camel-uid-cache.c                            |    6 +-
 camel/camel-url.c                                  |    9 +-
 camel/camel-url.h                                  |    4 +-
 camel/camel-vee-folder.c                           |  168 ++--
 camel/camel-vee-folder.h                           |    6 +-
 camel/camel-vee-store.c                            |   37 +-
 camel/camel-vtrash-folder.c                        |   22 +-
 camel/camel.h                                      |    1 -
 camel/providers/groupwise/camel-groupwise-folder.c |  265 +++---
 camel/providers/groupwise/camel-groupwise-folder.h |    4 +-
 .../providers/groupwise/camel-groupwise-journal.c  |   76 +-
 .../providers/groupwise/camel-groupwise-journal.h  |    8 +-
 .../providers/groupwise/camel-groupwise-provider.c |    5 +-
 camel/providers/groupwise/camel-groupwise-store.c  |  249 ++---
 camel/providers/groupwise/camel-groupwise-store.h  |    4 +-
 .../providers/groupwise/camel-groupwise-summary.c  |   12 +-
 .../groupwise/camel-groupwise-transport.c          |   31 +-
 camel/providers/groupwise/camel-groupwise-utils.c  |   18 +-
 camel/providers/imap/camel-imap-command.c          |  154 ++--
 camel/providers/imap/camel-imap-command.h          |   12 +-
 camel/providers/imap/camel-imap-folder.c           |  591 ++++++------
 camel/providers/imap/camel-imap-folder.h           |   19 +-
 camel/providers/imap/camel-imap-journal.c          |   22 +-
 camel/providers/imap/camel-imap-message-cache.c    |   98 +--
 camel/providers/imap/camel-imap-message-cache.h    |   21 +-
 camel/providers/imap/camel-imap-search.c           |   12 +-
 camel/providers/imap/camel-imap-store.c            |  562 +++++------
 camel/providers/imap/camel-imap-store.h            |    4 +-
 camel/providers/imap/camel-imap-summary.c          |   12 +-
 camel/providers/imap/camel-imap-wrapper.c          |   14 +-
 camel/providers/imapx/Makefile.am                  |    2 -
 camel/providers/imapx/camel-imapx-exception.c      |   79 --
 camel/providers/imapx/camel-imapx-exception.h      |   35 -
 camel/providers/imapx/camel-imapx-folder.c         |  135 ++--
 camel/providers/imapx/camel-imapx-folder.h         |    4 +-
 camel/providers/imapx/camel-imapx-provider.c       |    2 -
 camel/providers/imapx/camel-imapx-server.c         | 1031 +++++++++++---------
 camel/providers/imapx/camel-imapx-server.h         |   52 +-
 camel/providers/imapx/camel-imapx-store.c          |  313 +++---
 camel/providers/imapx/camel-imapx-store.h          |    2 +-
 camel/providers/imapx/camel-imapx-stream.c         |  132 ++--
 camel/providers/imapx/camel-imapx-stream.h         |   20 +-
 camel/providers/imapx/camel-imapx-summary.c        |   17 +-
 camel/providers/imapx/camel-imapx-utils.c          |  410 ++++----
 camel/providers/imapx/camel-imapx-utils.h          |   32 +-
 camel/providers/imapx/camel-imapx-view-summary.c   |    2 +-
 camel/providers/imapx/camel-imapx-view-summary.h   |    2 +-
 camel/providers/imapx/test-imapx.c                 |    6 +-
 camel/providers/local/camel-local-folder.c         |   66 +-
 camel/providers/local/camel-local-folder.h         |   10 +-
 camel/providers/local/camel-local-store.c          |  127 ++--
 camel/providers/local/camel-local-summary.c        |   48 +-
 camel/providers/local/camel-local-summary.h        |   16 +-
 camel/providers/local/camel-maildir-folder.c       |  101 +-
 camel/providers/local/camel-maildir-folder.h       |    2 +-
 camel/providers/local/camel-maildir-store.c        |  124 ++--
 camel/providers/local/camel-maildir-summary.c      |   47 +-
 camel/providers/local/camel-mbox-folder.c          |  105 +--
 camel/providers/local/camel-mbox-folder.h          |    2 +-
 camel/providers/local/camel-mbox-store.c           |  156 ++--
 camel/providers/local/camel-mbox-summary.c         |  163 ++--
 camel/providers/local/camel-mbox-summary.h         |    6 +-
 camel/providers/local/camel-mh-folder.c            |   61 +-
 camel/providers/local/camel-mh-folder.h            |    2 +-
 camel/providers/local/camel-mh-store.c             |   92 +-
 camel/providers/local/camel-mh-summary.c           |   23 +-
 camel/providers/local/camel-spool-folder.c         |   25 +-
 camel/providers/local/camel-spool-folder.h         |    2 +-
 camel/providers/local/camel-spool-store.c          |  124 ++--
 camel/providers/local/camel-spool-summary.c        |   73 +-
 camel/providers/local/camel-spool-summary.h        |    8 +-
 camel/providers/nntp/Makefile.am                   |   16 +-
 camel/providers/nntp/camel-nntp-auth.c             |   92 --
 camel/providers/nntp/camel-nntp-auth.h             |   36 -
 camel/providers/nntp/camel-nntp-folder.c           |  159 ++--
 camel/providers/nntp/camel-nntp-folder.h           |    4 +-
 camel/providers/nntp/camel-nntp-grouplist.c        |  221 -----
 camel/providers/nntp/camel-nntp-grouplist.h        |   55 -
 camel/providers/nntp/camel-nntp-newsrc.c           |  647 ------------
 camel/providers/nntp/camel-nntp-newsrc.h           |   36 -
 camel/providers/nntp/camel-nntp-store.c            |  274 +++---
 camel/providers/nntp/camel-nntp-store.h            |    9 +-
 camel/providers/nntp/camel-nntp-stream.c           |   49 +-
 camel/providers/nntp/camel-nntp-stream.h           |    3 +-
 camel/providers/nntp/camel-nntp-summary.c          |   55 +-
 camel/providers/nntp/camel-nntp-summary.h          |    3 +-
 camel/providers/nntp/camel-nntp-utils.c            |  307 ------
 camel/providers/nntp/camel-nntp-utils.h            |   34 -
 camel/providers/pop3/camel-pop3-engine.c           |    4 +-
 camel/providers/pop3/camel-pop3-folder.c           |  120 ++--
 camel/providers/pop3/camel-pop3-folder.h           |    4 +-
 camel/providers/pop3/camel-pop3-store.c            |  210 +++--
 camel/providers/pop3/camel-pop3-store.h            |    6 +-
 camel/providers/pop3/camel-pop3-stream.c           |   40 +-
 .../providers/sendmail/camel-sendmail-transport.c  |   40 +-
 camel/providers/smtp/camel-smtp-transport.c        |  476 +++++-----
 camel/tests/folder/test1.c                         |    4 -
 camel/tests/folder/test10.c                        |   13 +-
 camel/tests/folder/test11.c                        |   64 +-
 camel/tests/folder/test2.c                         |    4 -
 camel/tests/folder/test3.c                         |   65 +-
 camel/tests/folder/test4.c                         |    4 -
 camel/tests/folder/test5.c                         |    4 -
 camel/tests/folder/test6.c                         |    4 -
 camel/tests/folder/test7.c                         |    4 -
 camel/tests/folder/test8.c                         |   53 +-
 camel/tests/folder/test9.c                         |   43 +-
 camel/tests/lib/camel-test-provider.c              |    6 +-
 camel/tests/lib/camel-test.c                       |    5 +-
 camel/tests/lib/camel-test.h                       |    1 +
 camel/tests/lib/folders.c                          |  144 ++--
 camel/tests/lib/messages.c                         |   26 +-
 camel/tests/lib/streams.c                          |   72 +-
 camel/tests/message/test4.c                        |    6 +-
 camel/tests/mime-filter/test-charset.c             |    8 +-
 camel/tests/mime-filter/test-crlf.c                |    8 +-
 camel/tests/mime-filter/test-tohtml.c              |   16 +-
 camel/tests/mime-filter/test1.c                    |    4 +-
 camel/tests/misc/url.c                             |   10 +-
 camel/tests/smime/pgp-mime.c                       |    6 +-
 camel/tests/smime/pgp.c                            |   48 +-
 camel/tests/smime/pkcs7.c                          |    6 +-
 camel/tests/stream/test1.c                         |   20 +-
 camel/tests/stream/test3.c                         |    2 +-
 configure.ac                                       |    2 +-
 .../libecal/tmpl/e-cal-check-timezones.sgml        |   13 +
 docs/reference/camel/camel-docs.sgml               |    1 -
 docs/reference/camel/camel-sections.txt            |   17 -
 .../reference/camel/tmpl/camel-cipher-context.sgml |   69 ++-
 docs/reference/camel/tmpl/camel-data-cache.sgml    |   10 +-
 docs/reference/camel/tmpl/camel-data-wrapper.sgml  |    3 +
 docs/reference/camel/tmpl/camel-db.sgml            |   96 +-
 docs/reference/camel/tmpl/camel-disco-diary.sgml   |    4 +-
 docs/reference/camel/tmpl/camel-disco-folder.sgml  |    6 +-
 docs/reference/camel/tmpl/camel-disco-store.sgml   |    7 +-
 docs/reference/camel/tmpl/camel-exception.sgml     |  110 ---
 docs/reference/camel/tmpl/camel-file-utils.sgml    |    4 +
 docs/reference/camel/tmpl/camel-filter-driver.sgml |   10 +-
 docs/reference/camel/tmpl/camel-filter-search.sgml |    4 +-
 docs/reference/camel/tmpl/camel-folder-search.sgml |    6 +-
 .../reference/camel/tmpl/camel-folder-summary.sgml |   10 +-
 docs/reference/camel/tmpl/camel-folder.sgml        |   24 +-
 docs/reference/camel/tmpl/camel-lock-client.sgml   |    2 +-
 docs/reference/camel/tmpl/camel-lock.sgml          |    8 +-
 docs/reference/camel/tmpl/camel-mime-parser.sgml   |    2 +
 docs/reference/camel/tmpl/camel-mime-part.sgml     |    3 +
 docs/reference/camel/tmpl/camel-movemail.sgml      |    2 +-
 .../camel/tmpl/camel-multipart-signed.sgml         |    2 +-
 docs/reference/camel/tmpl/camel-net-utils.sgml     |    4 +-
 .../reference/camel/tmpl/camel-offline-folder.sgml |    2 +-
 .../camel/tmpl/camel-offline-journal.sgml          |    4 +-
 docs/reference/camel/tmpl/camel-offline-store.sgml |    6 +-
 docs/reference/camel/tmpl/camel-provider.sgml      |    8 +-
 docs/reference/camel/tmpl/camel-sasl.sgml          |    4 +-
 .../camel/tmpl/camel-seekable-stream.sgml          |    2 +
 docs/reference/camel/tmpl/camel-service.sgml       |    8 +-
 docs/reference/camel/tmpl/camel-session.sgml       |   21 +-
 docs/reference/camel/tmpl/camel-store.sgml         |   26 +-
 docs/reference/camel/tmpl/camel-stream-buffer.sgml |    2 +
 docs/reference/camel/tmpl/camel-stream-fs.sgml     |    3 +
 docs/reference/camel/tmpl/camel-stream.sgml        |    7 +
 docs/reference/camel/tmpl/camel-tcp-stream.sgml    |    1 +
 docs/reference/camel/tmpl/camel-transport.sgml     |    2 +-
 docs/reference/camel/tmpl/camel-unused.sgml        |  125 +++
 docs/reference/camel/tmpl/camel-url.sgml           |    2 +-
 docs/reference/camel/tmpl/camel-vee-folder.sgml    |    4 +-
 po/POTFILES.in                                     |    2 +-
 273 files changed, 7338 insertions(+), 8301 deletions(-)
---
diff --git a/camel/Makefile.am b/camel/Makefile.am
index 453a7cd..9a687ce 100644
--- a/camel/Makefile.am
+++ b/camel/Makefile.am
@@ -170,7 +170,6 @@ libcamel_1_2_la_SOURCES = 			\
 	camel-data-wrapper.c			\
 	camel-db.c				\
 	camel-debug.c				\
-	camel-exception.c			\
 	camel-file-utils.c			\
 	camel-html-parser.c			\
 	camel-iconv.c				\
@@ -242,8 +241,6 @@ libcamelinclude_HEADERS =			\
 	camel-data-wrapper.h			\
 	camel-db.h				\
 	camel-debug.h				\
-	camel-exception-list.def		\
-	camel-exception.h			\
 	camel-file-utils.h			\
 	camel-iconv.h				\
 	camel-index.h				\
diff --git a/camel/camel-block-file.c b/camel/camel-block-file.c
index 455975a..38e40c5 100644
--- a/camel/camel-block-file.c
+++ b/camel/camel-block-file.c
@@ -573,7 +573,7 @@ camel_block_file_get_block (CamelBlockFile *bs,
 		bl = g_malloc0(sizeof(*bl));
 		bl->id = id;
 		if (lseek(bs->fd, id, SEEK_SET) == -1 ||
-		    camel_read (bs->fd, (gchar *) bl->data, CAMEL_BLOCK_SIZE) == -1) {
+		    camel_read (bs->fd, (gchar *) bl->data, CAMEL_BLOCK_SIZE, NULL) == -1) {
 			block_file_unuse(bs);
 			CAMEL_BLOCK_FILE_UNLOCK(bs, cache_lock);
 			g_free(bl);
diff --git a/camel/camel-cipher-context.c b/camel/camel-cipher-context.c
index 50c0db3..425bea8 100644
--- a/camel/camel-cipher-context.c
+++ b/camel/camel-cipher-context.c
@@ -29,6 +29,7 @@
 #include <glib/gi18n-lib.h>
 
 #include "camel-cipher-context.h"
+#include "camel-debug.h"
 #include "camel-session.h"
 #include "camel-stream.h"
 #include "camel-operation.h"
@@ -67,10 +68,10 @@ cipher_sign (CamelCipherContext *ctx,
              CamelCipherHash hash,
              CamelMimePart *ipart,
              CamelMimePart *opart,
-             CamelException *ex)
+             GError **error)
 {
-	camel_exception_set (
-		ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 		_("Signing is not supported by this cipher"));
 
 	return -1;
@@ -83,7 +84,7 @@ cipher_sign (CamelCipherContext *ctx,
  * @hash: preferred Message-Integrity-Check hash algorithm
  * @ipart: Input part.
  * @opart: output part.
- * @ex: exception
+ * @error: return location for a #GError, or %NULL
  *
  * Converts the (unsigned) part @ipart into a new self-contained mime part @opart.
  * This may be a multipart/signed part, or a simple part for enveloped types.
@@ -96,7 +97,7 @@ camel_cipher_sign (CamelCipherContext *context,
                    CamelCipherHash hash,
                    CamelMimePart *ipart,
                    CamelMimePart *opart,
-                   CamelException *ex)
+                   GError **error)
 {
 	CamelCipherContextClass *class;
 	gint retval;
@@ -110,7 +111,8 @@ camel_cipher_sign (CamelCipherContext *context,
 
 	CIPHER_LOCK (context);
 
-	retval = class->sign (context, userid, hash, ipart, opart, ex);
+	retval = class->sign (context, userid, hash, ipart, opart, error);
+	CAMEL_CHECK_GERROR (context, sign, retval == 0, error);
 
 	CIPHER_UNLOCK (context);
 
@@ -122,10 +124,10 @@ camel_cipher_sign (CamelCipherContext *context,
 static CamelCipherValidity *
 cipher_verify (CamelCipherContext *context,
                CamelMimePart *sigpart,
-               CamelException *ex)
+               GError **error)
 {
-	camel_exception_set (
-		ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 		_("Verifying is not supported by this cipher"));
 
 	return NULL;
@@ -135,7 +137,7 @@ cipher_verify (CamelCipherContext *context,
  * camel_cipher_verify:
  * @context: Cipher Context
  * @ipart: part to verify
- * @ex: exception
+ * @error: return location for a #GError, or %NULL
  *
  * Verifies the signature. If @istream is a clearsigned stream,
  * you should pass %NULL as the sigstream parameter. Otherwise
@@ -149,7 +151,7 @@ cipher_verify (CamelCipherContext *context,
 CamelCipherValidity *
 camel_cipher_verify (CamelCipherContext *context,
                      CamelMimePart *ipart,
-                     CamelException *ex)
+                     GError **error)
 {
 	CamelCipherContextClass *class;
 	CamelCipherValidity *valid;
@@ -163,7 +165,8 @@ camel_cipher_verify (CamelCipherContext *context,
 
 	CIPHER_LOCK (context);
 
-	valid = class->verify (context, ipart, ex);
+	valid = class->verify (context, ipart, error);
+	CAMEL_CHECK_GERROR (context, verify, valid != NULL, error);
 
 	CIPHER_UNLOCK (context);
 
@@ -178,10 +181,10 @@ cipher_encrypt (CamelCipherContext *context,
                 GPtrArray *recipients,
                 CamelMimePart *ipart,
                 CamelMimePart *opart,
-                CamelException *ex)
+                GError **error)
 {
-	camel_exception_set (
-		ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 		_("Encryption is not supported by this cipher"));
 
 	return -1;
@@ -194,7 +197,7 @@ cipher_encrypt (CamelCipherContext *context,
  * @recipients: an array of recipient key ids and/or email addresses
  * @ipart: cleartext input stream
  * @opart: ciphertext output stream
- * @ex: exception
+ * @error: return location for a #GError, or %NULL
  *
  * Encrypts (and optionally signs) the cleartext input stream and
  * writes the resulting ciphertext to the output stream.
@@ -207,7 +210,7 @@ camel_cipher_encrypt (CamelCipherContext *context,
                       GPtrArray *recipients,
                       CamelMimePart *ipart,
                       CamelMimePart *opart,
-                      CamelException *ex)
+                      GError **error)
 {
 	CamelCipherContextClass *class;
 	gint retval;
@@ -222,7 +225,8 @@ camel_cipher_encrypt (CamelCipherContext *context,
 	CIPHER_LOCK (context);
 
 	retval = class->encrypt (
-		context, userid, recipients, ipart, opart, ex);
+		context, userid, recipients, ipart, opart, error);
+	CAMEL_CHECK_GERROR (context, encrypt, retval == 0, error);
 
 	CIPHER_UNLOCK (context);
 
@@ -235,10 +239,10 @@ static CamelCipherValidity *
 cipher_decrypt (CamelCipherContext *context,
                 CamelMimePart *ipart,
                 CamelMimePart *opart,
-                CamelException *ex)
+                GError **error)
 {
-	camel_exception_set (
-		ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 		_("Decryption is not supported by this cipher"));
 
 	return NULL;
@@ -249,7 +253,7 @@ cipher_decrypt (CamelCipherContext *context,
  * @context:
  * @ipart:
  * @opart:
- * @ex:
+ * @error: return location for a #GError, or %NULL
  *
  * Decrypts @ipart into @opart.
  *
@@ -259,7 +263,7 @@ CamelCipherValidity *
 camel_cipher_decrypt (CamelCipherContext *context,
                       CamelMimePart *ipart,
                       CamelMimePart *opart,
-                      CamelException *ex)
+                      GError **error)
 {
 	CamelCipherContextClass *class;
 	CamelCipherValidity *valid;
@@ -273,7 +277,8 @@ camel_cipher_decrypt (CamelCipherContext *context,
 
 	CIPHER_LOCK (context);
 
-	valid = class->decrypt (context, ipart, opart, ex);
+	valid = class->decrypt (context, ipart, opart, error);
+	CAMEL_CHECK_GERROR (context, decrypt, valid != NULL, error);
 
 	CIPHER_UNLOCK (context);
 
@@ -285,10 +290,10 @@ camel_cipher_decrypt (CamelCipherContext *context,
 static gint
 cipher_import_keys (CamelCipherContext *context,
                     CamelStream *istream,
-                    CamelException *ex)
+                    GError **error)
 {
-	camel_exception_set (
-		ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 		_("You may not import keys with this cipher"));
 
 	return -1;
@@ -298,7 +303,7 @@ cipher_import_keys (CamelCipherContext *context,
  * camel_cipher_import_keys:
  * @context: Cipher Context
  * @istream: input stream (containing keys)
- * @ex: exception
+ * @error: return location for a #GError, or %NULL
  *
  * Imports a stream of keys/certificates contained within @istream
  * into the key/certificate database controlled by @ctx.
@@ -308,9 +313,10 @@ cipher_import_keys (CamelCipherContext *context,
 gint
 camel_cipher_import_keys (CamelCipherContext *context,
                           CamelStream *istream,
-                          CamelException *ex)
+                          GError **error)
 {
 	CamelCipherContextClass *class;
+	gint retval;
 
 	g_return_val_if_fail (CAMEL_IS_CIPHER_CONTEXT (context), -1);
 	g_return_val_if_fail (CAMEL_IS_STREAM (istream), -1);
@@ -318,17 +324,20 @@ camel_cipher_import_keys (CamelCipherContext *context,
 	class = CAMEL_CIPHER_CONTEXT_GET_CLASS (context);
 	g_return_val_if_fail (class->import_keys != NULL, -1);
 
-	return class->import_keys (context, istream, ex);
+	retval = class->import_keys (context, istream, error);
+	CAMEL_CHECK_GERROR (context, import_keys, retval == 0, error);
+
+	return retval;
 }
 
 static gint
 cipher_export_keys (CamelCipherContext *context,
                     GPtrArray *keys,
                     CamelStream *ostream,
-                    CamelException *ex)
+                    GError **error)
 {
-	camel_exception_set (
-		ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 		_("You may not export keys with this cipher"));
 
 	return -1;
@@ -339,7 +348,7 @@ cipher_export_keys (CamelCipherContext *context,
  * @context: Cipher Context
  * @keys: an array of key ids
  * @ostream: output stream
- * @ex: exception
+ * @error: return location for a #GError, or %NULL
  *
  * Exports the keys/certificates in @keys to the stream @ostream from
  * the key/certificate database controlled by @ctx.
@@ -350,9 +359,10 @@ gint
 camel_cipher_export_keys (CamelCipherContext *context,
                           GPtrArray *keys,
                           CamelStream *ostream,
-                          CamelException *ex)
+                          GError **error)
 {
 	CamelCipherContextClass *class;
+	gint retval;
 
 	g_return_val_if_fail (CAMEL_IS_CIPHER_CONTEXT (context), -1);
 	g_return_val_if_fail (CAMEL_IS_STREAM (ostream), -1);
@@ -361,7 +371,10 @@ camel_cipher_export_keys (CamelCipherContext *context,
 	class = CAMEL_CIPHER_CONTEXT_GET_CLASS (context);
 	g_return_val_if_fail (class->export_keys != NULL, -1);
 
-	return class->export_keys (context, keys, ostream, ex);
+	retval = class->export_keys (context, keys, ostream, error);
+	CAMEL_CHECK_GERROR (context, export_keys, retval == 0, error);
+
+	return retval;
 }
 
 static CamelCipherHash
@@ -816,6 +829,7 @@ cc_prepare_sign (CamelMimePart *part)
  * @part: Part to write.
  * @flags: flags for the canonicalisation filter (CamelMimeFilterCanon)
  * @ostream: stream to write canonicalised output to.
+ * @error: return location for a #GError, or %NULL
  *
  * Writes a part to a stream in a canonicalised format, suitable for signing/encrypting.
  *
@@ -826,7 +840,8 @@ cc_prepare_sign (CamelMimePart *part)
 gint
 camel_cipher_canonical_to_stream (CamelMimePart *part,
                                   guint32 flags,
-                                  CamelStream *ostream)
+                                  CamelStream *ostream,
+                                  GError **error)
 {
 	CamelStream *filter;
 	CamelMimeFilter *canon;
@@ -840,12 +855,13 @@ camel_cipher_canonical_to_stream (CamelMimePart *part,
 	camel_stream_filter_add (CAMEL_STREAM_FILTER (filter), canon);
 	g_object_unref (canon);
 
-	if (camel_data_wrapper_write_to_stream ((CamelDataWrapper *)part, filter) != -1
-	    && camel_stream_flush (filter) != -1)
+	if (camel_data_wrapper_write_to_stream (
+		(CamelDataWrapper *)part, filter, error) != -1
+	    && camel_stream_flush (filter, error) != -1)
 		res = 0;
 
 	g_object_unref (filter);
-	camel_stream_reset (ostream);
+	camel_stream_reset (ostream, NULL);
 
 	return res;
 }
diff --git a/camel/camel-cipher-context.h b/camel/camel-cipher-context.h
index 172731d..910901c 100644
--- a/camel/camel-cipher-context.h
+++ b/camel/camel-cipher-context.h
@@ -143,29 +143,29 @@ struct _CamelCipherContextClass {
 						 CamelCipherHash hash,
 						 CamelMimePart *ipart,
 						 CamelMimePart *opart,
-						 CamelException *ex);
+						 GError **error);
 	CamelCipherValidity *
 			(*verify)		(CamelCipherContext *context,
 						 CamelMimePart *ipart,
-						 CamelException *ex);
+						 GError **error);
 	gint		(*encrypt)		(CamelCipherContext *context,
 						 const gchar *userid,
 						 GPtrArray *recipients,
 						 CamelMimePart *ipart,
 						 CamelMimePart *opart,
-						 CamelException *ex);
+						 GError **error);
 	CamelCipherValidity *
 			(*decrypt)		(CamelCipherContext *context,
 						 CamelMimePart *ipart,
 						 CamelMimePart *opart,
-						 CamelException *ex);
+						 GError **error);
 	gint		(*import_keys)		(CamelCipherContext *context,
 						 CamelStream *istream,
-						 CamelException *ex);
+						 GError **error);
 	gint		(*export_keys)		(CamelCipherContext *context,
 						 GPtrArray *keys,
 						 CamelStream *ostream,
-						 CamelException *ex);
+						 GError **error);
 };
 
 GType		camel_cipher_context_get_type	(void);
@@ -184,19 +184,19 @@ const gchar *	     camel_cipher_hash_to_id (CamelCipherContext *context, CamelCi
 
 /* cipher routines */
 gint                  camel_cipher_sign (CamelCipherContext *context, const gchar *userid, CamelCipherHash hash,
-					CamelMimePart *ipart, CamelMimePart *opart, CamelException *ex);
-CamelCipherValidity *camel_cipher_verify (CamelCipherContext *context, CamelMimePart *ipart, CamelException *ex);
+					CamelMimePart *ipart, CamelMimePart *opart, GError **error);
+CamelCipherValidity *camel_cipher_verify (CamelCipherContext *context, CamelMimePart *ipart, GError **error);
 gint                  camel_cipher_encrypt (CamelCipherContext *context, const gchar *userid,
 					   GPtrArray *recipients, CamelMimePart *ipart, CamelMimePart *opart,
-					   CamelException *ex);
+					   GError **error);
 CamelCipherValidity *camel_cipher_decrypt (CamelCipherContext *context, CamelMimePart *ipart, CamelMimePart *opart,
-					   CamelException *ex);
+					   GError **error);
 
 /* key/certificate routines */
 gint                  camel_cipher_import_keys (CamelCipherContext *context, CamelStream *istream,
-					       CamelException *ex);
+					       GError **error);
 gint                  camel_cipher_export_keys (CamelCipherContext *context, GPtrArray *keys,
-					       CamelStream *ostream, CamelException *ex);
+					       CamelStream *ostream, GError **error);
 
 /* CamelCipherValidity utility functions */
 CamelCipherValidity *camel_cipher_validity_new (void);
@@ -220,7 +220,7 @@ void		     camel_cipher_validity_envelope(CamelCipherValidity *parent, CamelCiph
 void                 camel_cipher_validity_free (CamelCipherValidity *validity);
 
 /* utility functions */
-gint		     camel_cipher_canonical_to_stream(CamelMimePart *part, guint32 flags, CamelStream *ostream);
+gint		     camel_cipher_canonical_to_stream(CamelMimePart *part, guint32 flags, CamelStream *ostream, GError **error);
 
 G_END_DECLS
 
diff --git a/camel/camel-data-cache.c b/camel/camel-data-cache.c
index 2f27a51..9b7b5a0 100644
--- a/camel/camel-data-cache.c
+++ b/camel/camel-data-cache.c
@@ -29,9 +29,6 @@
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
 
 #include <glib/gstdio.h>
 #include <glib/gi18n-lib.h>
@@ -165,7 +162,7 @@ camel_data_cache_init (CamelDataCache *data_cache)
 /**
  * camel_data_cache_new:
  * @path: Base path of cache, subdirectories will be created here.
- * @ex:
+ * @error: return location for a #GError, or %NULL
  *
  * Create a new data cache.
  *
@@ -174,13 +171,13 @@ camel_data_cache_init (CamelDataCache *data_cache)
  **/
 CamelDataCache *
 camel_data_cache_new (const gchar *path,
-                      CamelException *ex)
+                      GError **error)
 {
 	g_return_val_if_fail (path != NULL, NULL);
 
 	if (g_mkdir_with_parents (path, 0700) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Unable to create cache path"));
 		return NULL;
 	}
@@ -224,6 +221,8 @@ camel_data_cache_set_path (CamelDataCache *cdc,
 
 	g_free (cdc->priv->path);
 	cdc->priv->path = g_strdup (path);
+
+	g_object_notify (G_OBJECT (cdc), "path");
 }
 
 /**
@@ -348,7 +347,7 @@ data_cache_path(CamelDataCache *cdc, gint create, const gchar *path, const gchar
  * @cdc: A #CamelDataCache
  * @path: Relative path of item to add.
  * @key: Key of item to add.
- * @ex:
+ * @error: return location for a #GError, or %NULL
  *
  * Add a new item to the cache.
  *
@@ -365,7 +364,7 @@ CamelStream *
 camel_data_cache_add (CamelDataCache *cdc,
                       const gchar *path,
                       const gchar *key,
-                      CamelException *ex)
+                      GError **error)
 {
 	gchar *real;
 	CamelStream *stream;
@@ -384,7 +383,7 @@ camel_data_cache_add (CamelDataCache *cdc,
 	} while (stream != NULL);
 
 	stream = camel_stream_fs_new_with_name (
-		real, O_RDWR|O_CREAT|O_TRUNC, 0600);
+		real, O_RDWR|O_CREAT|O_TRUNC, 0600, error);
 	if (stream)
 		camel_object_bag_add(cdc->priv->busy_bag, real, stream);
 	else
@@ -400,7 +399,7 @@ camel_data_cache_add (CamelDataCache *cdc,
  * @cdc: A #CamelDataCache
  * @path: Path to the (sub) cache the item exists in.
  * @key: Key for the cache item.
- * @ex:
+ * @error: return location for a #GError, or %NULL
  *
  * Lookup an item in the cache.  If the item exists, a stream
  * is returned for the item.  The stream may be shared by
@@ -413,7 +412,7 @@ CamelStream *
 camel_data_cache_get (CamelDataCache *cdc,
                       const gchar *path,
                       const gchar *key,
-                      CamelException *ex)
+                      GError **error)
 {
 	gchar *real;
 	CamelStream *stream;
@@ -422,7 +421,7 @@ camel_data_cache_get (CamelDataCache *cdc,
 	stream = camel_object_bag_reserve(cdc->priv->busy_bag, real);
 	if (!stream) {
 		stream = camel_stream_fs_new_with_name (
-			real, O_RDWR, 0600);
+			real, O_RDWR, 0600, error);
 		if (stream)
 			camel_object_bag_add(cdc->priv->busy_bag, real, stream);
 		else
@@ -438,7 +437,7 @@ camel_data_cache_get (CamelDataCache *cdc,
  * @cdc: A #CamelDataCache
  * @path: Path to the (sub) cache the item exists in.
  * @key: Key for the cache item.
- * @ex:
+ * @error: return location for a #GError, or %NULL
  *
  * Lookup the filename for an item in the cache
  *
@@ -450,7 +449,7 @@ gchar *
 camel_data_cache_get_filename (CamelDataCache *cdc,
                                const gchar *path,
                                const gchar *key,
-                               CamelException *ex)
+                               GError **error)
 {
 	gchar *real;
 
@@ -464,7 +463,7 @@ camel_data_cache_get_filename (CamelDataCache *cdc,
  * @cdc: A #CamelDataCache
  * @path:
  * @key:
- * @ex:
+ * @error: return location for a #GError, or %NULL
  *
  * Remove/expire a cache item.
  *
@@ -474,7 +473,7 @@ gint
 camel_data_cache_remove (CamelDataCache *cdc,
                          const gchar *path,
                          const gchar *key,
-                         CamelException *ex)
+                         GError **error)
 {
 	CamelStream *stream;
 	gchar *real;
@@ -489,8 +488,9 @@ camel_data_cache_remove (CamelDataCache *cdc,
 
 	/* maybe we were a mem stream */
 	if (g_unlink (real) == -1 && errno != ENOENT) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not remove cache entry: %s: %s"),
 			real, g_strerror (errno));
 		ret = -1;
diff --git a/camel/camel-data-cache.h b/camel/camel-data-cache.h
index 1772fd8..559b8b0 100644
--- a/camel/camel-data-cache.h
+++ b/camel/camel-data-cache.h
@@ -28,7 +28,6 @@
 #define CAMEL_DATA_CACHE_H
 
 #include <camel/camel-stream.h>
-#include <camel/camel-exception.h>
 
 /* Standard GObject macros */
 #define CAMEL_TYPE_DATA_CACHE \
@@ -66,7 +65,7 @@ struct _CamelDataCacheClass {
 
 GType		camel_data_cache_get_type	(void);
 CamelDataCache *camel_data_cache_new		(const gchar *path,
-						 CamelException *ex);
+						 GError **error);
 const gchar *	camel_data_cache_get_path	(CamelDataCache *cdc);
 void		camel_data_cache_set_path	(CamelDataCache *cdc,
 						 const gchar *path);
@@ -78,19 +77,19 @@ void		camel_data_cache_set_expire_access
 CamelStream *	camel_data_cache_add		(CamelDataCache *cdc,
 						 const gchar *path,
 						 const gchar *key,
-						 CamelException *ex);
+						 GError **error);
 CamelStream *	camel_data_cache_get		(CamelDataCache *cdc,
 						 const gchar *path,
 						 const gchar *key,
-						 CamelException *ex);
+						 GError **error);
 gint		camel_data_cache_remove		(CamelDataCache *cdc,
 						 const gchar *path,
 						 const gchar *key,
-						 CamelException *ex);
+						 GError **error);
 gchar *		camel_data_cache_get_filename	(CamelDataCache *cdc,
 						 const gchar *path,
 						 const gchar *key,
-						 CamelException *ex);
+						 GError **error);
 
 G_END_DECLS
 
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c
index 699db1e..084290d 100644
--- a/camel/camel-data-wrapper.c
+++ b/camel/camel-data-wrapper.c
@@ -25,8 +25,10 @@
 #endif
 
 #include <errno.h>
+#include <glib/gi18n-lib.h>
 
 #include "camel-data-wrapper.h"
+#include "camel-debug.h"
 #include "camel-mime-filter-basic.h"
 #include "camel-mime-filter-crlf.h"
 #include "camel-stream-filter.h"
@@ -76,21 +78,26 @@ data_wrapper_finalize (GObject *object)
 
 static gssize
 data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper,
-                              CamelStream *stream)
+                              CamelStream *stream,
+                              GError **error)
 {
 	gssize ret;
 
 	if (data_wrapper->stream == NULL) {
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+			_("No stream available"));
 		return -1;
 	}
 
 	camel_data_wrapper_lock (data_wrapper, CAMEL_DATA_WRAPPER_STREAM_LOCK);
-	if (camel_stream_reset (data_wrapper->stream) == -1) {
+	if (camel_stream_reset (data_wrapper->stream, error) == -1) {
 		camel_data_wrapper_unlock (data_wrapper, CAMEL_DATA_WRAPPER_STREAM_LOCK);
 		return -1;
 	}
 
-	ret = camel_stream_write_to_stream (data_wrapper->stream, stream);
+	ret = camel_stream_write_to_stream (
+		data_wrapper->stream, stream, error);
 
 	camel_data_wrapper_unlock (data_wrapper, CAMEL_DATA_WRAPPER_STREAM_LOCK);
 
@@ -99,7 +106,8 @@ data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper,
 
 static gssize
 data_wrapper_decode_to_stream (CamelDataWrapper *data_wrapper,
-                               CamelStream *stream)
+                               CamelStream *stream,
+                               GError **error)
 {
 	CamelMimeFilter *filter;
 	CamelStream *fstream;
@@ -134,9 +142,9 @@ data_wrapper_decode_to_stream (CamelDataWrapper *data_wrapper,
 		g_object_unref (filter);
 	}
 
-	ret = camel_data_wrapper_write_to_stream (data_wrapper, fstream);
+	ret = camel_data_wrapper_write_to_stream (data_wrapper, fstream, error);
 
-	camel_stream_flush (fstream);
+	camel_stream_flush (fstream, NULL);
 	g_object_unref (fstream);
 
 	return ret;
@@ -176,7 +184,8 @@ data_wrapper_set_mime_type_field (CamelDataWrapper *data_wrapper,
 
 static gint
 data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper,
-                                    CamelStream *stream)
+                                    CamelStream *stream,
+                                    GError **error)
 {
 	if (data_wrapper->stream)
 		g_object_unref (data_wrapper->stream);
@@ -243,6 +252,7 @@ camel_data_wrapper_new (void)
  * camel_data_wrapper_write_to_stream:
  * @data_wrapper: a #CamelDataWrapper object
  * @stream: a #CamelStream for output
+ * @error: return location for a #GError, or %NULL
  *
  * Writes the content of @data_wrapper to @stream in a machine-independent
  * format appropriate for the data. It should be possible to construct an
@@ -253,9 +263,11 @@ camel_data_wrapper_new (void)
  **/
 gssize
 camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper,
-                                    CamelStream *stream)
+                                    CamelStream *stream,
+                                    GError **error)
 {
 	CamelDataWrapperClass *class;
+	gssize n_bytes;
 
 	g_return_val_if_fail (CAMEL_IS_DATA_WRAPPER (data_wrapper), -1);
 	g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
@@ -263,13 +275,17 @@ camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper,
 	class = CAMEL_DATA_WRAPPER_GET_CLASS (data_wrapper);
 	g_return_val_if_fail (class->write_to_stream != NULL, -1);
 
-	return class->write_to_stream (data_wrapper, stream);
+	n_bytes = class->write_to_stream (data_wrapper, stream, error);
+	CAMEL_CHECK_GERROR (data_wrapper, write_to_stream, n_bytes >= 0, error);
+
+	return n_bytes;
 }
 
 /**
  * camel_data_wrapper_decode_to_stream:
  * @data_wrapper: a #CamelDataWrapper object
  * @stream: a #CamelStream for decoded data to be written to
+ * @error: return location for a #GError, or %NULL
  *
  * Writes the decoded data content to @stream.
  *
@@ -277,9 +293,11 @@ camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper,
  **/
 gssize
 camel_data_wrapper_decode_to_stream (CamelDataWrapper *data_wrapper,
-                                     CamelStream *stream)
+                                     CamelStream *stream,
+                                     GError **error)
 {
 	CamelDataWrapperClass *class;
+	gssize n_bytes;
 
 	g_return_val_if_fail (CAMEL_IS_DATA_WRAPPER (data_wrapper), -1);
 	g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
@@ -287,13 +305,17 @@ camel_data_wrapper_decode_to_stream (CamelDataWrapper *data_wrapper,
 	class = CAMEL_DATA_WRAPPER_GET_CLASS (data_wrapper);
 	g_return_val_if_fail (class->decode_to_stream != NULL, -1);
 
-	return class->decode_to_stream (data_wrapper, stream);
+	n_bytes = class->decode_to_stream (data_wrapper, stream, error);
+	CAMEL_CHECK_GERROR (data_wrapper, decode_to_stream, n_bytes >= 0, error);
+
+	return n_bytes;
 }
 
 /**
  * camel_data_wrapper_construct_from_stream:
  * @data_wrapper: a #CamelDataWrapper object
  * @stream: an input #CamelStream
+ * @error: return location for a #GError, or %NULL
  *
  * Constructs the content of @data_wrapper from the supplied @stream.
  *
@@ -301,9 +323,11 @@ camel_data_wrapper_decode_to_stream (CamelDataWrapper *data_wrapper,
  **/
 gint
 camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper,
-                                          CamelStream *stream)
+                                          CamelStream *stream,
+                                          GError **error)
 {
 	CamelDataWrapperClass *class;
+	gint retval;
 
 	g_return_val_if_fail (CAMEL_IS_DATA_WRAPPER (data_wrapper), -1);
 	g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
@@ -311,7 +335,11 @@ camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper,
 	class = CAMEL_DATA_WRAPPER_GET_CLASS (data_wrapper);
 	g_return_val_if_fail (class->construct_from_stream != NULL, -1);
 
-	return class->construct_from_stream (data_wrapper, stream);
+	retval = class->construct_from_stream (data_wrapper, stream, error);
+	CAMEL_CHECK_GERROR (
+		data_wrapper, construct_from_stream, retval == 0, error);
+
+	return retval;
 }
 
 /**
diff --git a/camel/camel-data-wrapper.h b/camel/camel-data-wrapper.h
index bd4b15b..32a9701 100644
--- a/camel/camel-data-wrapper.h
+++ b/camel/camel-data-wrapper.h
@@ -91,11 +91,14 @@ struct _CamelDataWrapperClass {
 	void		(*set_mime_type_field)	(CamelDataWrapper *data_wrapper,
 						 CamelContentType *mime_type_field);
 	gssize		(*write_to_stream)	(CamelDataWrapper *data_wrapper,
-						 CamelStream *stream);
+						 CamelStream *stream,
+						 GError **error);
 	gssize		(*decode_to_stream)	(CamelDataWrapper *data_wrapper,
-						 CamelStream *stream);
+						 CamelStream *stream,
+						 GError **error);
 	gint		(*construct_from_stream)(CamelDataWrapper *data_wrapper,
-						 CamelStream *);
+						 CamelStream *stream,
+						 GError **error);
 	gboolean	(*is_offline)		(CamelDataWrapper *data_wrapper);
 };
 
@@ -104,10 +107,12 @@ CamelDataWrapper *
 		camel_data_wrapper_new		(void);
 gssize		camel_data_wrapper_write_to_stream
 						(CamelDataWrapper *data_wrapper,
-						 CamelStream *stream);
+						 CamelStream *stream,
+						 GError **error);
 gssize		camel_data_wrapper_decode_to_stream
 						(CamelDataWrapper *data_wrapper,
-						 CamelStream *stream);
+						 CamelStream *stream,
+						 GError **error);
 void		camel_data_wrapper_set_mime_type(CamelDataWrapper *data_wrapper,
 						 const gchar *mime_type);
 gchar *		camel_data_wrapper_get_mime_type(CamelDataWrapper *data_wrapper);
@@ -119,7 +124,8 @@ void		camel_data_wrapper_set_mime_type_field
 						 CamelContentType *mime_type);
 gint		camel_data_wrapper_construct_from_stream
 						(CamelDataWrapper *data_wrapper,
-						 CamelStream *stream);
+						 CamelStream *stream,
+						 GError **error);
 gboolean	camel_data_wrapper_is_offline	(CamelDataWrapper *data_wrapper);
 void		camel_data_wrapper_lock		(CamelDataWrapper *data_wrapper,
 						 CamelDataWrapperLock lock);
diff --git a/camel/camel-db.c b/camel/camel-db.c
index 59c98a5..ceee93e 100644
--- a/camel/camel-db.c
+++ b/camel/camel-db.c
@@ -36,6 +36,7 @@
 #include <glib/gi18n-lib.h>
 
 #include "camel-debug.h"
+#include "camel-object.h"
 
 /* how long to wait before invoking sync on the file */
 #define SYNC_TIMEOUT_SECONDS 5
@@ -357,10 +358,10 @@ struct _CamelDBPrivate {
 
 static GStaticRecMutex trans_lock = G_STATIC_REC_MUTEX_INIT;
 
-static gint write_mir (CamelDB *cdb, const gchar *folder_name, CamelMIRecord *record, CamelException *ex, gboolean delete_old_record);
-
 static gint
-cdb_sql_exec (sqlite3 *db, const gchar * stmt, CamelException *ex)
+cdb_sql_exec (sqlite3 *db,
+              const gchar *stmt,
+              GError **error)
 {
 	gchar *errmsg = NULL;
 	gint   ret = -1;
@@ -378,8 +379,9 @@ cdb_sql_exec (sqlite3 *db, const gchar * stmt, CamelException *ex)
 
 	if (ret != SQLITE_OK) {
 		d(g_print ("Error in SQL EXEC statement: %s [%s].\n", stmt, errmsg));
-		if (ex)
-			camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _(errmsg));
+		g_set_error (
+			error, CAMEL_ERROR,
+			CAMEL_ERROR_GENERIC, "%s", errmsg);
 		sqlite3_free (errmsg);
 		errmsg = NULL;
 		return -1;
@@ -440,7 +442,8 @@ cdb_match_func (sqlite3_context *ctx, gint nArgs, sqlite3_value **values)
  * Since: 2.24
  **/
 CamelDB *
-camel_db_open (const gchar *path, CamelException *ex)
+camel_db_open (const gchar *path,
+               GError **error)
 {
 	static GOnce vfs_once = G_ONCE_INIT;
 	CamelDB *cdb;
@@ -455,12 +458,17 @@ camel_db_open (const gchar *path, CamelException *ex)
 	if (ret) {
 
 		if (!db) {
-			camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Insufficient memory"));
+			g_set_error (
+				error, CAMEL_ERROR,
+				CAMEL_ERROR_GENERIC,
+				_("Insufficient memory"));
 		} else {
-			const gchar *error;
-			error = sqlite3_errmsg (db);
-			d(g_print("Can't open database %s: %s\n", path, error));
-			camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _(error));
+			const gchar *errmsg;
+			errmsg = sqlite3_errmsg (db);
+			d(g_print("Can't open database %s: %s\n", path, errmsg));
+			g_set_error (
+				error, CAMEL_ERROR,
+				CAMEL_ERROR_GENERIC, "%s", errmsg);
 			sqlite3_close(db);
 		}
 		return NULL;
@@ -504,9 +512,10 @@ camel_db_open (const gchar *path, CamelException *ex)
  * Since: 2.26
  **/
 CamelDB *
-camel_db_clone (CamelDB *cdb, CamelException *ex)
+camel_db_clone (CamelDB *cdb,
+                GError **error)
 {
-	return camel_db_open(cdb->priv->file_name, ex);
+	return camel_db_open (cdb->priv->file_name, error);
 }
 
 /**
@@ -553,18 +562,18 @@ camel_db_set_collate (CamelDB *cdb, const gchar *col, const gchar *collate, Came
  * Since: 2.24
  **/
 gint
-camel_db_command (CamelDB *cdb, const gchar *stmt, CamelException *ex)
+camel_db_command (CamelDB *cdb,
+                  const gchar *stmt,
+                  GError **error)
 {
 	gint ret;
 
-	/* XXX Should this be really exposed ? */
-
 	if (!cdb)
 		return TRUE;
 	g_mutex_lock (cdb->lock);
 
 	START(stmt);
-	ret = cdb_sql_exec (cdb->db, stmt, ex);
+	ret = cdb_sql_exec (cdb->db, stmt, error);
 	END;
 	g_mutex_unlock (cdb->lock);
 
@@ -577,7 +586,8 @@ camel_db_command (CamelDB *cdb, const gchar *stmt, CamelException *ex)
  * Since: 2.24
  **/
 gint
-camel_db_begin_transaction (CamelDB *cdb, CamelException *ex)
+camel_db_begin_transaction (CamelDB *cdb,
+                            GError **error)
 {
 	if (!cdb)
 		return -1;
@@ -587,7 +597,7 @@ camel_db_begin_transaction (CamelDB *cdb, CamelException *ex)
 	g_mutex_lock (cdb->lock);
 	STARTTS("BEGIN");
 
-	return (cdb_sql_exec (cdb->db, "BEGIN", ex));
+	return (cdb_sql_exec (cdb->db, "BEGIN", error));
 }
 
 /**
@@ -596,13 +606,14 @@ camel_db_begin_transaction (CamelDB *cdb, CamelException *ex)
  * Since: 2.24
  **/
 gint
-camel_db_end_transaction (CamelDB *cdb, CamelException *ex)
+camel_db_end_transaction (CamelDB *cdb,
+                          GError **error)
 {
 	gint ret;
 	if (!cdb)
 		return -1;
 
-	ret = cdb_sql_exec (cdb->db, "COMMIT", ex);
+	ret = cdb_sql_exec (cdb->db, "COMMIT", error);
 	ENDTS;
 	g_mutex_unlock (cdb->lock);
 	if (g_getenv("SQLITE_TRANSLOCK"))
@@ -619,11 +630,12 @@ camel_db_end_transaction (CamelDB *cdb, CamelException *ex)
  * Since: 2.24
  **/
 gint
-camel_db_abort_transaction (CamelDB *cdb, CamelException *ex)
+camel_db_abort_transaction (CamelDB *cdb,
+                            GError **error)
 {
 	gint ret;
 
-	ret = cdb_sql_exec (cdb->db, "ROLLBACK", ex);
+	ret = cdb_sql_exec (cdb->db, "ROLLBACK", error);
 	g_mutex_unlock (cdb->lock);
 	if (g_getenv("SQLITE_TRANSLOCK"))
 		g_static_rec_mutex_unlock (&trans_lock);
@@ -638,12 +650,14 @@ camel_db_abort_transaction (CamelDB *cdb, CamelException *ex)
  * Since: 2.24
  **/
 gint
-camel_db_add_to_transaction (CamelDB *cdb, const gchar *stmt, CamelException *ex)
+camel_db_add_to_transaction (CamelDB *cdb,
+                             const gchar *stmt,
+                             GError **error)
 {
 	if (!cdb)
 		return -1;
 
-	return (cdb_sql_exec (cdb->db, stmt, ex));
+	return (cdb_sql_exec (cdb->db, stmt, error));
 }
 
 /**
@@ -652,7 +666,9 @@ camel_db_add_to_transaction (CamelDB *cdb, const gchar *stmt, CamelException *ex
  * Since: 2.24
  **/
 gint
-camel_db_transaction_command (CamelDB *cdb, GSList *qry_list, CamelException *ex)
+camel_db_transaction_command (CamelDB *cdb,
+                              GSList *qry_list,
+                              GError **error)
 {
 	gint ret;
 	const gchar *query;
@@ -662,19 +678,19 @@ camel_db_transaction_command (CamelDB *cdb, GSList *qry_list, CamelException *ex
 
 	g_mutex_lock (cdb->lock);
 	STARTTS("BEGIN");
-	ret = cdb_sql_exec (cdb->db, "BEGIN", ex);
+	ret = cdb_sql_exec (cdb->db, "BEGIN", error);
 	if (ret)
 		goto end;
 
 	while (qry_list) {
 		query = qry_list->data;
-		ret = cdb_sql_exec (cdb->db, query, ex);
+		ret = cdb_sql_exec (cdb->db, query, error);
 		if (ret)
 			goto end;
 		qry_list = g_slist_next (qry_list);
 	}
 
-	ret = cdb_sql_exec (cdb->db, "COMMIT", ex);
+	ret = cdb_sql_exec (cdb->db, "COMMIT", error);
 	ENDTS;
 end:
 	g_mutex_unlock (cdb->lock);
@@ -701,7 +717,10 @@ count_cb (gpointer data, gint argc, gchar **argv, gchar **azColName)
  * Since: 2.26
  **/
 gint
-camel_db_count_message_info (CamelDB *cdb, const gchar *query, guint32 *count, CamelException *ex)
+camel_db_count_message_info (CamelDB *cdb,
+                             const gchar *query,
+                             guint32 *count,
+                             GError **error)
 {
 	gint ret = -1;
 	gchar *errmsg = NULL;
@@ -727,8 +746,9 @@ camel_db_count_message_info (CamelDB *cdb, const gchar *query, guint32 *count, C
 
 	if (ret != SQLITE_OK) {
 		d(g_print ("Error in SQL SELECT statement: %s [%s]\n", query, errmsg));
-		if (ex)
-			camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _(errmsg));
+		g_set_error (
+			error, CAMEL_ERROR,
+			CAMEL_ERROR_GENERIC, "%s", errmsg);
 		sqlite3_free (errmsg);
 		errmsg = NULL;
 	}
@@ -747,7 +767,10 @@ camel_db_count_message_info (CamelDB *cdb, const gchar *query, guint32 *count, C
  * Since: 2.24
  **/
 gint
-camel_db_count_junk_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, CamelException *ex)
+camel_db_count_junk_message_info (CamelDB *cdb,
+                                  const gchar *table_name,
+                                  guint32 *count,
+                                  GError **error)
 {
 	gint ret;
 	gchar *query;
@@ -757,7 +780,7 @@ camel_db_count_junk_message_info (CamelDB *cdb, const gchar *table_name, guint32
 
 	query = sqlite3_mprintf ("SELECT COUNT (*) FROM %Q WHERE junk = 1", table_name);
 
-	ret = camel_db_count_message_info (cdb, query, count, ex);
+	ret = camel_db_count_message_info (cdb, query, count, error);
 	sqlite3_free (query);
 
 	return ret;
@@ -769,7 +792,10 @@ camel_db_count_junk_message_info (CamelDB *cdb, const gchar *table_name, guint32
  * Since: 2.24
  **/
 gint
-camel_db_count_unread_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, CamelException *ex)
+camel_db_count_unread_message_info (CamelDB *cdb,
+                                    const gchar *table_name,
+                                    guint32 *count,
+                                    GError **error)
 {
 	gint ret;
 	gchar *query;
@@ -779,7 +805,7 @@ camel_db_count_unread_message_info (CamelDB *cdb, const gchar *table_name, guint
 
 	query = sqlite3_mprintf ("SELECT COUNT (*) FROM %Q WHERE read = 0", table_name);
 
-	ret = camel_db_count_message_info (cdb, query, count, ex);
+	ret = camel_db_count_message_info (cdb, query, count, error);
 	sqlite3_free (query);
 
 	return ret;
@@ -791,7 +817,10 @@ camel_db_count_unread_message_info (CamelDB *cdb, const gchar *table_name, guint
  * Since: 2.24
  **/
 gint
-camel_db_count_visible_unread_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, CamelException *ex)
+camel_db_count_visible_unread_message_info (CamelDB *cdb,
+                                            const gchar *table_name,
+                                            guint32 *count,
+                                            GError **error)
 {
 	gint ret;
 	gchar *query;
@@ -801,7 +830,7 @@ camel_db_count_visible_unread_message_info (CamelDB *cdb, const gchar *table_nam
 
 	query = sqlite3_mprintf ("SELECT COUNT (*) FROM %Q WHERE read = 0 AND junk = 0 AND deleted = 0", table_name);
 
-	ret = camel_db_count_message_info (cdb, query, count, ex);
+	ret = camel_db_count_message_info (cdb, query, count, error);
 	sqlite3_free (query);
 
 	return ret;
@@ -813,7 +842,10 @@ camel_db_count_visible_unread_message_info (CamelDB *cdb, const gchar *table_nam
  * Since: 2.24
  **/
 gint
-camel_db_count_visible_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, CamelException *ex)
+camel_db_count_visible_message_info (CamelDB *cdb,
+                                     const gchar *table_name,
+                                     guint32 *count,
+                                     GError **error)
 {
 	gint ret;
 	gchar *query;
@@ -823,7 +855,7 @@ camel_db_count_visible_message_info (CamelDB *cdb, const gchar *table_name, guin
 
 	query = sqlite3_mprintf ("SELECT COUNT (*) FROM %Q WHERE junk = 0 AND deleted = 0", table_name);
 
-	ret = camel_db_count_message_info (cdb, query, count, ex);
+	ret = camel_db_count_message_info (cdb, query, count, error);
 	sqlite3_free (query);
 
 	return ret;
@@ -835,7 +867,10 @@ camel_db_count_visible_message_info (CamelDB *cdb, const gchar *table_name, guin
  * Since: 2.24
  **/
 gint
-camel_db_count_junk_not_deleted_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, CamelException *ex)
+camel_db_count_junk_not_deleted_message_info (CamelDB *cdb,
+                                              const gchar *table_name,
+                                              guint32 *count,
+                                              GError **error)
 {
 	gint ret;
 	gchar *query;
@@ -845,7 +880,7 @@ camel_db_count_junk_not_deleted_message_info (CamelDB *cdb, const gchar *table_n
 
 	query = sqlite3_mprintf ("SELECT COUNT (*) FROM %Q WHERE junk = 1 AND deleted = 0", table_name);
 
-	ret = camel_db_count_message_info (cdb, query, count, ex);
+	ret = camel_db_count_message_info (cdb, query, count, error);
 	sqlite3_free (query);
 
 	return ret;
@@ -857,7 +892,10 @@ camel_db_count_junk_not_deleted_message_info (CamelDB *cdb, const gchar *table_n
  * Since: 2.24
  **/
 gint
-camel_db_count_deleted_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, CamelException *ex)
+camel_db_count_deleted_message_info (CamelDB *cdb,
+                                     const gchar *table_name,
+                                     guint32 *count,
+                                     GError **error)
 {
 	gint ret;
 	gchar *query;
@@ -867,7 +905,7 @@ camel_db_count_deleted_message_info (CamelDB *cdb, const gchar *table_name, guin
 
 	query = sqlite3_mprintf ("SELECT COUNT (*) FROM %Q WHERE deleted = 1", table_name);
 
-	ret = camel_db_count_message_info (cdb, query, count, ex);
+	ret = camel_db_count_message_info (cdb, query, count, error);
 	sqlite3_free (query);
 
 	return ret;
@@ -879,7 +917,10 @@ camel_db_count_deleted_message_info (CamelDB *cdb, const gchar *table_name, guin
  * Since: 2.24
  **/
 gint
-camel_db_count_total_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, CamelException *ex)
+camel_db_count_total_message_info (CamelDB *cdb,
+                                   const gchar *table_name,
+                                   guint32 *count,
+                                   GError **error)
 {
 
 	gint ret;
@@ -890,7 +931,7 @@ camel_db_count_total_message_info (CamelDB *cdb, const gchar *table_name, guint3
 
 	query = sqlite3_mprintf ("SELECT COUNT (*) FROM %Q where read=0 or read=1", table_name);
 
-	ret = camel_db_count_message_info (cdb, query, count, ex);
+	ret = camel_db_count_message_info (cdb, query, count, error);
 	sqlite3_free (query);
 
 	return ret;
@@ -902,7 +943,11 @@ camel_db_count_total_message_info (CamelDB *cdb, const gchar *table_name, guint3
  * Since: 2.24
  **/
 gint
-camel_db_select (CamelDB *cdb, const gchar * stmt, CamelDBSelectCB callback, gpointer data, CamelException *ex)
+camel_db_select (CamelDB *cdb,
+                 const gchar *stmt,
+                 CamelDBSelectCB callback,
+                 gpointer data,
+                 GError **error)
 {
 	gchar *errmsg = NULL;
 	/*int nrecs = 0;*/
@@ -932,8 +977,9 @@ camel_db_select (CamelDB *cdb, const gchar * stmt, CamelDBSelectCB callback, gpo
 
 	if (ret != SQLITE_OK) {
 		d(g_warning ("Error in select statement '%s' [%s].\n", stmt, errmsg));
-		if (ex)
-			camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, errmsg);
+		g_set_error (
+			error, CAMEL_ERROR,
+			CAMEL_ERROR_GENERIC, "%s", errmsg);
 		sqlite3_free (errmsg);
 		errmsg = NULL;
 	}
@@ -952,20 +998,22 @@ camel_db_select (CamelDB *cdb, const gchar * stmt, CamelDBSelectCB callback, gpo
  * Since: 2.24
  **/
 gint
-camel_db_create_vfolder (CamelDB *db, const gchar *folder_name, CamelException *ex)
+camel_db_create_vfolder (CamelDB *db,
+                         const gchar *folder_name,
+                         GError **error)
 {
 	gint ret;
 	gchar *table_creation_query, *safe_index;
 
 	table_creation_query = sqlite3_mprintf ("CREATE TABLE IF NOT EXISTS %Q (  vuid TEXT PRIMARY KEY)", folder_name);
 
-	ret = camel_db_command (db, table_creation_query, ex);
+	ret = camel_db_command (db, table_creation_query, error);
 
 	sqlite3_free (table_creation_query);
 
 	safe_index = g_strdup_printf("VINDEX-%s", folder_name);
 	table_creation_query = sqlite3_mprintf ("CREATE INDEX IF NOT EXISTS %Q ON %Q (vuid)", safe_index, folder_name);
-	ret = camel_db_command (db, table_creation_query, ex);
+	ret = camel_db_command (db, table_creation_query, error);
 
 	sqlite3_free (table_creation_query);
 	g_free (safe_index);
@@ -980,18 +1028,20 @@ camel_db_create_vfolder (CamelDB *db, const gchar *folder_name, CamelException *
  * Since: 2.24
  **/
 gint
-camel_db_recreate_vfolder (CamelDB *db, const gchar *folder_name, CamelException *ex)
+camel_db_recreate_vfolder (CamelDB *db,
+                           const gchar *folder_name,
+                           GError **error)
 {
 	gint ret;
 	gchar *table_query;
 
 	table_query = sqlite3_mprintf ("DROP TABLE %Q", folder_name);
 
-	ret = camel_db_command (db, table_query, ex);
+	ret = camel_db_command (db, table_query, error);
 
 	sqlite3_free (table_query);
 
-	return camel_db_create_vfolder (db, folder_name, ex);
+	return camel_db_create_vfolder (db, folder_name, error);
 }
 
 /**
@@ -1000,14 +1050,17 @@ camel_db_recreate_vfolder (CamelDB *db, const gchar *folder_name, CamelException
  * Since: 2.24
  **/
 gint
-camel_db_delete_uid_from_vfolder (CamelDB *db, gchar *folder_name, gchar *vuid, CamelException *ex)
+camel_db_delete_uid_from_vfolder (CamelDB *db,
+                                  gchar *folder_name,
+                                  gchar *vuid,
+                                  GError **error)
 {
 	 gchar *del_query;
 	 gint ret;
 
 	 del_query = sqlite3_mprintf ("DELETE FROM %Q WHERE vuid = %Q", folder_name, vuid);
 
-	 ret = camel_db_command (db, del_query, ex);
+	 ret = camel_db_command (db, del_query, error);
 
 	 sqlite3_free (del_query);
 	 CAMEL_DB_RELEASE_SQLITE_MEMORY;
@@ -1020,14 +1073,17 @@ camel_db_delete_uid_from_vfolder (CamelDB *db, gchar *folder_name, gchar *vuid,
  * Since: 2.24
  **/
 gint
-camel_db_delete_uid_from_vfolder_transaction (CamelDB *db, const gchar *folder_name, const gchar *vuid, CamelException *ex)
+camel_db_delete_uid_from_vfolder_transaction (CamelDB *db,
+                                              const gchar *folder_name,
+                                              const gchar *vuid,
+                                              GError **error)
 {
 	gchar *del_query;
 	gint ret;
 
 	del_query = sqlite3_mprintf ("DELETE FROM %Q WHERE vuid = %Q", folder_name, vuid);
 
-	ret = camel_db_add_to_transaction (db, del_query, ex);
+	ret = camel_db_add_to_transaction (db, del_query, error);
 
 	sqlite3_free (del_query);
 
@@ -1060,7 +1116,13 @@ read_uids_flags_callback (gpointer ref, gint ncol, gchar ** cols, gchar ** name)
  * Since: 2.26
  **/
 gint
-camel_db_get_folder_uids_flags (CamelDB *db, const gchar *folder_name, const gchar *sort_by, const gchar *collate, GPtrArray *summary, GHashTable *table, CamelException *ex)
+camel_db_get_folder_uids_flags (CamelDB *db,
+                                const gchar *folder_name,
+                                const gchar *sort_by,
+                                const gchar *collate,
+                                GPtrArray *summary,
+                                GHashTable *table,
+                                GError **error)
 {
 	 GPtrArray *uids = summary;
 	 GPtrArray *flags = g_ptr_array_new ();
@@ -1074,7 +1136,7 @@ camel_db_get_folder_uids_flags (CamelDB *db, const gchar *folder_name, const gch
 
 	 sel_query = sqlite3_mprintf("SELECT uid,flags FROM %Q%s%s%s%s", folder_name, sort_by ? " order by " : "", sort_by ? sort_by: "", (sort_by && collate) ? " collate " : "", (sort_by && collate) ? collate : "");
 
-	 ret = camel_db_select (db, sel_query, read_uids_flags_callback, &data, ex);
+	 ret = camel_db_select (db, sel_query, read_uids_flags_callback, &data, error);
 	 sqlite3_free (sel_query);
 
 	 for (i=0; i<uids->len; i++) {
@@ -1109,14 +1171,19 @@ read_uids_callback (gpointer ref, gint ncol, gchar ** cols, gchar ** name)
  * Since: 2.24
  **/
 gint
-camel_db_get_folder_uids (CamelDB *db, const gchar *folder_name, const gchar *sort_by, const gchar *collate, GPtrArray *array, CamelException *ex)
+camel_db_get_folder_uids (CamelDB *db,
+                          const gchar *folder_name,
+                          const gchar *sort_by,
+                          const gchar *collate,
+                          GPtrArray *array,
+                          GError **error)
 {
 	 gchar *sel_query;
 	 gint ret;
 
 	 sel_query = sqlite3_mprintf("SELECT uid FROM %Q%s%s%s%s", folder_name, sort_by ? " order by " : "", sort_by ? sort_by: "", (sort_by && collate) ? " collate " : "", (sort_by && collate) ? collate : "");
 
-	 ret = camel_db_select (db, sel_query, read_uids_callback, array, ex);
+	 ret = camel_db_select (db, sel_query, read_uids_callback, array, error);
 	 sqlite3_free (sel_query);
 
 	 return ret;
@@ -1128,7 +1195,9 @@ camel_db_get_folder_uids (CamelDB *db, const gchar *folder_name, const gchar *so
  * Since: 2.24
  **/
 GPtrArray *
-camel_db_get_folder_junk_uids (CamelDB *db, gchar *folder_name, CamelException *ex)
+camel_db_get_folder_junk_uids (CamelDB *db,
+                               gchar *folder_name,
+                               GError **error)
 {
 	 gchar *sel_query;
 	 gint ret;
@@ -1136,7 +1205,7 @@ camel_db_get_folder_junk_uids (CamelDB *db, gchar *folder_name, CamelException *
 
 	 sel_query = sqlite3_mprintf("SELECT uid FROM %Q where junk=1", folder_name);
 
-	 ret = camel_db_select (db, sel_query, read_uids_callback, array, ex);
+	 ret = camel_db_select (db, sel_query, read_uids_callback, array, error);
 
 	 sqlite3_free (sel_query);
 
@@ -1153,7 +1222,9 @@ camel_db_get_folder_junk_uids (CamelDB *db, gchar *folder_name, CamelException *
  * Since: 2.24
  **/
 GPtrArray *
-camel_db_get_folder_deleted_uids (CamelDB *db, const gchar *folder_name, CamelException *ex)
+camel_db_get_folder_deleted_uids (CamelDB *db,
+                                  const gchar *folder_name,
+                                  GError **error)
 {
 	 gchar *sel_query;
 	 gint ret;
@@ -1161,7 +1232,7 @@ camel_db_get_folder_deleted_uids (CamelDB *db, const gchar *folder_name, CamelEx
 
 	 sel_query = sqlite3_mprintf("SELECT uid FROM %Q where deleted=1", folder_name);
 
-	 ret = camel_db_select (db, sel_query, read_uids_callback, array, ex);
+	 ret = camel_db_select (db, sel_query, read_uids_callback, array, error);
 	 sqlite3_free (sel_query);
 
 	 if (!array->len || ret != 0) {
@@ -1198,7 +1269,9 @@ read_preview_callback (gpointer ref, gint ncol, gchar ** cols, gchar ** name)
  * Since: 2.28
  **/
 GHashTable *
-camel_db_get_folder_preview (CamelDB *db, const gchar *folder_name, CamelException *ex)
+camel_db_get_folder_preview (CamelDB *db,
+                             const gchar *folder_name,
+                             GError **error)
 {
 	 gchar *sel_query;
 	 gint ret;
@@ -1206,7 +1279,7 @@ camel_db_get_folder_preview (CamelDB *db, const gchar *folder_name, CamelExcepti
 
 	 sel_query = sqlite3_mprintf("SELECT uid, preview FROM '%q_preview'", folder_name);
 
-	 ret = camel_db_select (db, sel_query, read_preview_callback, hash, ex);
+	 ret = camel_db_select (db, sel_query, read_preview_callback, hash, error);
 	 sqlite3_free (sel_query);
 
 	 if (!g_hash_table_size (hash) || ret != 0) {
@@ -1223,14 +1296,18 @@ camel_db_get_folder_preview (CamelDB *db, const gchar *folder_name, CamelExcepti
  * Since: 2.28
  **/
 gint
-camel_db_write_preview_record (CamelDB *db, const gchar *folder_name, const gchar *uid, const gchar *msg, CamelException *ex)
+camel_db_write_preview_record (CamelDB *db,
+                               const gchar *folder_name,
+                               const gchar *uid,
+                               const gchar *msg,
+                               GError **error)
 {
 	gchar *query;
 	gint ret;
 
 	query = sqlite3_mprintf("INSERT OR REPLACE INTO '%q_preview' VALUES(%Q,%Q)", folder_name, uid, msg);
 
-	ret = camel_db_add_to_transaction (db, query, ex);
+	ret = camel_db_add_to_transaction (db, query, error);
 	sqlite3_free (query);
 
 	return ret;
@@ -1261,7 +1338,10 @@ read_vuids_callback (gpointer ref, gint ncol, gchar ** cols, gchar ** name)
  * Since: 2.24
  **/
 GPtrArray *
-camel_db_get_vuids_from_vfolder (CamelDB *db, const gchar *folder_name, gchar *filter, CamelException *ex)
+camel_db_get_vuids_from_vfolder (CamelDB *db,
+                                 const gchar *folder_name,
+                                 gchar *filter,
+                                 GError **error)
 {
 	 gchar *sel_query;
 	 gchar *cond = NULL;
@@ -1278,7 +1358,7 @@ camel_db_get_vuids_from_vfolder (CamelDB *db, const gchar *folder_name, gchar *f
 	 /* FIXME[disk-summary] No The caller should parse the ex in case
 	 *                      of NULL returns */
 	 array = g_ptr_array_new ();
-	 camel_db_select (db, sel_query, read_vuids_callback, array, ex);
+	 camel_db_select (db, sel_query, read_vuids_callback, array, error);
 	 sqlite3_free (sel_query);
 	 /* We make sure to return NULL if we don't get anything. Be good to your caller */
 	 if (!array->len) {
@@ -1295,14 +1375,17 @@ camel_db_get_vuids_from_vfolder (CamelDB *db, const gchar *folder_name, gchar *f
  * Since: 2.24
  **/
 gint
-camel_db_add_to_vfolder (CamelDB *db, gchar *folder_name, gchar *vuid, CamelException *ex)
+camel_db_add_to_vfolder (CamelDB *db,
+                         gchar *folder_name,
+                         gchar *vuid,
+                         GError **error)
 {
 	 gchar *ins_query;
 	 gint ret;
 
 	 ins_query = sqlite3_mprintf ("INSERT INTO %Q VALUES (%Q)", folder_name, vuid);
 
-	 ret = camel_db_command (db, ins_query, ex);
+	 ret = camel_db_command (db, ins_query, error);
 
 	 sqlite3_free (ins_query);
 	 CAMEL_DB_RELEASE_SQLITE_MEMORY;
@@ -1315,14 +1398,17 @@ camel_db_add_to_vfolder (CamelDB *db, gchar *folder_name, gchar *vuid, CamelExce
  * Since: 2.24
  **/
 gint
-camel_db_add_to_vfolder_transaction (CamelDB *db, const gchar *folder_name, const gchar *vuid, CamelException *ex)
+camel_db_add_to_vfolder_transaction (CamelDB *db,
+                                     const gchar *folder_name,
+                                     const gchar *vuid,
+                                     GError **error)
 {
 	 gchar *ins_query;
 	 gint ret;
 
 	 ins_query = sqlite3_mprintf ("INSERT INTO %Q VALUES (%Q)", folder_name, vuid);
 
-	 ret = camel_db_add_to_transaction (db, ins_query, ex);
+	 ret = camel_db_add_to_transaction (db, ins_query, error);
 
 	 sqlite3_free (ins_query);
 
@@ -1335,65 +1421,68 @@ camel_db_add_to_vfolder_transaction (CamelDB *db, const gchar *folder_name, cons
  * Since: 2.24
  **/
 gint
-camel_db_create_folders_table (CamelDB *cdb, CamelException *ex)
+camel_db_create_folders_table (CamelDB *cdb,
+                               GError **error)
 {
 	const gchar *query = "CREATE TABLE IF NOT EXISTS folders ( folder_name TEXT PRIMARY KEY, version REAL, flags INTEGER, nextuid INTEGER, time NUMERIC, saved_count INTEGER, unread_count INTEGER, deleted_count INTEGER, junk_count INTEGER, visible_count INTEGER, jnd_count INTEGER, bdata TEXT )";
 	CAMEL_DB_RELEASE_SQLITE_MEMORY;
-	return ((camel_db_command (cdb, query, ex)));
+	return ((camel_db_command (cdb, query, error)));
 }
 
 static gint
-camel_db_create_message_info_table (CamelDB *cdb, const gchar *folder_name, CamelException *ex)
+camel_db_create_message_info_table (CamelDB *cdb,
+                                    const gchar *folder_name,
+                                    GError **error)
 {
 	gint ret;
 	gchar *table_creation_query, *safe_index;
 
 	/* README: It is possible to compress all system flags into a single column and use just as userflags but that makes querying for other applications difficult an d bloats the parsing code. Instead, it is better to bloat the tables. Sqlite should have some optimizations for sparse columns etc. */
 	table_creation_query = sqlite3_mprintf ("CREATE TABLE IF NOT EXISTS %Q (  uid TEXT PRIMARY KEY , flags INTEGER , msg_type INTEGER , read INTEGER , deleted INTEGER , replied INTEGER , important INTEGER , junk INTEGER , attachment INTEGER , dirty INTEGER , size INTEGER , dsent NUMERIC , dreceived NUMERIC , subject TEXT , mail_from TEXT , mail_to TEXT , mail_cc TEXT , mlist TEXT , followup_flag TEXT , followup_completed_on TEXT , followup_due_by TEXT , part TEXT , labels TEXT , usertags TEXT , cinfo TEXT , bdata TEXT, created TEXT, modified TEXT)", folder_name);
-	ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+	ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
 	sqlite3_free (table_creation_query);
 
 	table_creation_query = sqlite3_mprintf ("CREATE TABLE IF NOT EXISTS '%q_bodystructure' (  uid TEXT PRIMARY KEY , bodystructure TEXT )", folder_name);
-	ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+	ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
 	sqlite3_free (table_creation_query);
 
 	/* Create message preview table. */
 	table_creation_query = sqlite3_mprintf ("CREATE TABLE IF NOT EXISTS '%q_preview' (  uid TEXT PRIMARY KEY , preview TEXT)", folder_name);
-	ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+	ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
 	sqlite3_free (table_creation_query);
 
 	/* FIXME: sqlize folder_name before you create the index */
 	safe_index = g_strdup_printf("SINDEX-%s", folder_name);
 	table_creation_query = sqlite3_mprintf ("DROP INDEX IF EXISTS %Q", safe_index);
-	ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+	ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
 	g_free (safe_index);
 	sqlite3_free (table_creation_query);
 
 	/* INDEX on preview */
 	safe_index = g_strdup_printf("SINDEX-%s-preview", folder_name);
 	table_creation_query = sqlite3_mprintf ("CREATE INDEX IF NOT EXISTS %Q ON '%q_preview' (uid, preview)", safe_index, folder_name);
-	ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+	ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
 	g_free (safe_index);
 	sqlite3_free (table_creation_query);
 
 	/* Index on deleted*/
 	safe_index = g_strdup_printf("DELINDEX-%s", folder_name);
 	table_creation_query = sqlite3_mprintf ("CREATE INDEX IF NOT EXISTS %Q ON %Q (deleted)", safe_index, folder_name);
-	ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+	ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
 	g_free (safe_index);
 	sqlite3_free (table_creation_query);
 
 	/* Index on Junk*/
 	safe_index = g_strdup_printf("JUNKINDEX-%s", folder_name);
 	table_creation_query = sqlite3_mprintf ("CREATE INDEX IF NOT EXISTS %Q ON %Q (junk)", safe_index, folder_name);
-	ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+	ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
 	g_free (safe_index);
 	sqlite3_free (table_creation_query);
 
 	/* Index on unread*/
 	safe_index = g_strdup_printf("READINDEX-%s", folder_name);
 	table_creation_query = sqlite3_mprintf ("CREATE INDEX IF NOT EXISTS %Q ON %Q (read)", safe_index, folder_name);
-	ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+	ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
 	g_free (safe_index);
 	sqlite3_free (table_creation_query);
 
@@ -1401,7 +1490,10 @@ camel_db_create_message_info_table (CamelDB *cdb, const gchar *folder_name, Came
 }
 
 static gint
-camel_db_migrate_folder_prepare (CamelDB *cdb, const gchar *folder_name, gint version, CamelException *ex)
+camel_db_migrate_folder_prepare (CamelDB *cdb,
+                                 const gchar *folder_name,
+                                 gint version,
+                                 GError **error)
 {
 	gint ret = 0;
 	gchar *table_creation_query;
@@ -1417,23 +1509,23 @@ camel_db_migrate_folder_prepare (CamelDB *cdb, const gchar *folder_name, gint ve
 		 * */
 
 		table_creation_query = sqlite3_mprintf ("DROP TABLE IF EXISTS 'mem.%q'", folder_name);
-		ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+		ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
 		sqlite3_free (table_creation_query);
 
 		table_creation_query = sqlite3_mprintf ("CREATE TEMP TABLE IF NOT EXISTS 'mem.%q' (  uid TEXT PRIMARY KEY , flags INTEGER , msg_type INTEGER , read INTEGER , deleted INTEGER , replied INTEGER , important INTEGER , junk INTEGER , attachment INTEGER , dirty INTEGER , size INTEGER , dsent NUMERIC , dreceived NUMERIC , subject TEXT , mail_from TEXT , mail_to TEXT , mail_cc TEXT , mlist TEXT , followup_flag TEXT , followup_completed_on TEXT , followup_due_by TEXT , part TEXT , labels TEXT , usertags TEXT , cinfo TEXT , bdata TEXT, created TEXT, modified TEXT )", folder_name);
-		ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+		ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
 		sqlite3_free (table_creation_query);
 
 		table_creation_query = sqlite3_mprintf ("INSERT INTO 'mem.%q' SELECT uid , flags , msg_type , read , deleted , replied , important , junk , attachment , msg_security , size , dsent , dreceived , subject , mail_from , mail_to , mail_cc , mlist , followup_flag , followup_completed_on , followup_due_by , part , labels , usertags , cinfo , bdata , strftime(\"%%s\", 'now'), strftime(\"%%s\", 'now') FROM %Q", folder_name, folder_name);
-		ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+		ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
 		sqlite3_free (table_creation_query);
 
 		table_creation_query = sqlite3_mprintf ("DROP TABLE IF EXISTS %Q", folder_name);
-		ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+		ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
 		sqlite3_free (table_creation_query);
 
-		ret = camel_db_create_message_info_table (cdb, folder_name, ex);
-		camel_exception_clear (ex);
+		ret = camel_db_create_message_info_table (cdb, folder_name, error);
+		g_clear_error (error);
 	}
 
 	/* Add later version migrations here */
@@ -1442,7 +1534,10 @@ camel_db_migrate_folder_prepare (CamelDB *cdb, const gchar *folder_name, gint ve
 }
 
 static gint
-camel_db_migrate_folder_recreate (CamelDB *cdb, const gchar *folder_name, gint version, CamelException *ex)
+camel_db_migrate_folder_recreate (CamelDB *cdb,
+                                  const gchar *folder_name,
+                                  gint version,
+                                  GError **error)
 {
 	gint ret = 0;
 	gchar *table_creation_query;
@@ -1451,11 +1546,11 @@ camel_db_migrate_folder_recreate (CamelDB *cdb, const gchar *folder_name, gint v
 
 	if (version < 2) {
 		table_creation_query = sqlite3_mprintf ("INSERT INTO %Q SELECT uid , flags , msg_type , read , deleted , replied , important , junk , attachment , dirty , size , dsent , dreceived , subject , mail_from , mail_to , mail_cc , mlist , followup_flag , followup_completed_on , followup_due_by , part , labels , usertags , cinfo , bdata, created, modified FROM 'mem.%q'", folder_name, folder_name);
-		ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+		ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
 		sqlite3_free (table_creation_query);
 
 		table_creation_query = sqlite3_mprintf ("DROP TABLE 'mem.%q'", folder_name);
-		ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+		ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
 		sqlite3_free (table_creation_query);
 	}
 
@@ -1470,7 +1565,10 @@ camel_db_migrate_folder_recreate (CamelDB *cdb, const gchar *folder_name, gint v
  * Since: 2.28
  **/
 gint
-camel_db_reset_folder_version (CamelDB *cdb, const gchar *folder_name, gint reset_version, CamelException *ex)
+camel_db_reset_folder_version (CamelDB *cdb,
+                               const gchar *folder_name,
+                               gint reset_version,
+                               GError **error)
 {
 	gint ret = 0;
 	gchar *version_creation_query;
@@ -1482,9 +1580,9 @@ camel_db_reset_folder_version (CamelDB *cdb, const gchar *folder_name, gint rese
 
 	version_insert_query = sqlite3_mprintf ("INSERT INTO '%q_version' VALUES ('%d')", folder_name, reset_version);
 
-	ret = camel_db_add_to_transaction (cdb, drop_folder_query, ex);
-	ret = camel_db_add_to_transaction (cdb, version_creation_query, ex);
-	ret = camel_db_add_to_transaction (cdb, version_insert_query, ex);
+	ret = camel_db_add_to_transaction (cdb, drop_folder_query, error);
+	ret = camel_db_add_to_transaction (cdb, version_creation_query, error);
+	ret = camel_db_add_to_transaction (cdb, version_insert_query, error);
 
 	sqlite3_free (drop_folder_query);
 	sqlite3_free (version_creation_query);
@@ -1494,7 +1592,10 @@ camel_db_reset_folder_version (CamelDB *cdb, const gchar *folder_name, gint rese
 }
 
 static gint
-camel_db_write_folder_version (CamelDB *cdb, const gchar *folder_name, gint old_version, CamelException *ex)
+camel_db_write_folder_version (CamelDB *cdb,
+                               const gchar *folder_name,
+                               gint old_version,
+                               GError **error)
 {
 	gint ret = 0;
 	gchar *version_creation_query;
@@ -1507,8 +1608,8 @@ camel_db_write_folder_version (CamelDB *cdb, const gchar *folder_name, gint old_
 	else
 		version_insert_query = sqlite3_mprintf ("UPDATE '%q_version' SET version='2'", folder_name);
 
-	ret = camel_db_add_to_transaction (cdb, version_creation_query, ex);
-	ret = camel_db_add_to_transaction (cdb, version_insert_query, ex);
+	ret = camel_db_add_to_transaction (cdb, version_creation_query, error);
+	ret = camel_db_add_to_transaction (cdb, version_insert_query, error);
 
 	sqlite3_free (version_creation_query);
 	sqlite3_free (version_insert_query);
@@ -1517,7 +1618,9 @@ camel_db_write_folder_version (CamelDB *cdb, const gchar *folder_name, gint old_
 }
 
 static gint
-camel_db_get_folder_version (CamelDB *cdb, const gchar *folder_name, CamelException *ex)
+camel_db_get_folder_version (CamelDB *cdb,
+                             const gchar *folder_name,
+                             GError **error)
 {
 	gint version = -1, ret;
 	gchar *query;
@@ -1545,52 +1648,36 @@ camel_db_get_folder_version (CamelDB *cdb, const gchar *folder_name, CamelExcept
  * Since: 2.24
  **/
 gint
-camel_db_prepare_message_info_table (CamelDB *cdb, const gchar *folder_name, CamelException *ex)
+camel_db_prepare_message_info_table (CamelDB *cdb,
+                                     const gchar *folder_name,
+                                     GError **error)
 {
 	gint ret, current_version;
 
 	/* Make sure we have the table already */
-	ret = camel_db_create_message_info_table (cdb, folder_name, ex);
+	ret = camel_db_create_message_info_table (cdb, folder_name, error);
 
 	/* Migration stage zero: version fetch */
-	current_version = camel_db_get_folder_version (cdb, folder_name, ex);
+	current_version = camel_db_get_folder_version (cdb, folder_name, error);
 
 	/* Migration stage one: storing the old data if necessary */
-	ret = camel_db_migrate_folder_prepare (cdb, folder_name, current_version, ex);
+	ret = camel_db_migrate_folder_prepare (cdb, folder_name, current_version, error);
 
 	/* Migration stage two: rewriting the old data if necessary */
-	ret = camel_db_migrate_folder_recreate (cdb, folder_name, current_version, ex);
+	ret = camel_db_migrate_folder_recreate (cdb, folder_name, current_version, error);
 
 	/* Final step: (over)write the current version label */
-	ret = camel_db_write_folder_version (cdb, folder_name, current_version, ex);
+	ret = camel_db_write_folder_version (cdb, folder_name, current_version, error);
 
 	return ret;
 }
 
-/**
- * camel_db_write_fresh_message_info_record:
- *
- * Since: 2.26
- **/
-gint
-camel_db_write_fresh_message_info_record (CamelDB *cdb, const gchar *folder_name, CamelMIRecord *record, CamelException *ex)
-{
-	return write_mir (cdb, folder_name, record, ex, FALSE);
-}
-
-/**
- * camel_db_write_message_info_record:
- *
- * Since: 2.24
- **/
-gint
-camel_db_write_message_info_record (CamelDB *cdb, const gchar *folder_name, CamelMIRecord *record, CamelException *ex)
-{
-	return write_mir (cdb, folder_name, record, ex, TRUE);
-}
-
 static gint
-write_mir (CamelDB *cdb, const gchar *folder_name, CamelMIRecord *record, CamelException *ex, gboolean delete_old_record)
+write_mir (CamelDB *cdb,
+           const gchar *folder_name,
+           CamelMIRecord *record,
+           GError **error,
+           gboolean delete_old_record)
 {
 	gint ret;
 	/*char *del_query;*/
@@ -1624,7 +1711,7 @@ write_mir (CamelDB *cdb, const gchar *folder_name, CamelMIRecord *record, CamelE
 
 	/* if (delete_old_record)
 			ret = camel_db_add_to_transaction (cdb, del_query, ex); */
-	ret = camel_db_add_to_transaction (cdb, ins_query, ex);
+	ret = camel_db_add_to_transaction (cdb, ins_query, error);
 
 #endif
 
@@ -1635,7 +1722,7 @@ write_mir (CamelDB *cdb, const gchar *folder_name, CamelMIRecord *record, CamelE
 	if (ret == 0) {
 		ins_query = sqlite3_mprintf ("INSERT OR REPLACE INTO '%q_bodystructure' VALUES (%Q, %Q )",
 				folder_name, record->uid, record->bodystructure);
-		ret = camel_db_add_to_transaction (cdb, ins_query, ex);
+		ret = camel_db_add_to_transaction (cdb, ins_query, error);
 		sqlite3_free (ins_query);
 	}
 
@@ -1643,12 +1730,42 @@ write_mir (CamelDB *cdb, const gchar *folder_name, CamelMIRecord *record, CamelE
 }
 
 /**
+ * camel_db_write_fresh_message_info_record:
+ *
+ * Since: 2.26
+ **/
+gint
+camel_db_write_fresh_message_info_record (CamelDB *cdb,
+                                          const gchar *folder_name,
+                                          CamelMIRecord *record,
+                                          GError **error)
+{
+	return write_mir (cdb, folder_name, record, error, FALSE);
+}
+
+/**
+ * camel_db_write_message_info_record:
+ *
+ * Since: 2.24
+ **/
+gint
+camel_db_write_message_info_record (CamelDB *cdb,
+                                    const gchar *folder_name,
+                                    CamelMIRecord *record,
+                                    GError **error)
+{
+	return write_mir (cdb, folder_name, record, error, TRUE);
+}
+
+/**
  * camel_db_write_folder_info_record:
  *
  * Since: 2.24
  **/
 gint
-camel_db_write_folder_info_record (CamelDB *cdb, CamelFIRecord *record, CamelException *ex)
+camel_db_write_folder_info_record (CamelDB *cdb,
+                                   CamelFIRecord *record,
+                                   GError **error)
 {
 	gint ret;
 
@@ -1671,8 +1788,8 @@ camel_db_write_folder_info_record (CamelDB *cdb, CamelFIRecord *record, CamelExc
 	g_free (upd_query);
 #else
 
-	ret = camel_db_add_to_transaction (cdb, del_query, ex);
-	ret = camel_db_add_to_transaction (cdb, ins_query, ex);
+	ret = camel_db_add_to_transaction (cdb, del_query, error);
+	ret = camel_db_add_to_transaction (cdb, ins_query, error);
 
 #endif
 
@@ -1741,13 +1858,16 @@ read_fir_callback (gpointer  ref, gint ncol, gchar ** cols, gchar ** name)
  * Since: 2.24
  **/
 gint
-camel_db_read_folder_info_record (CamelDB *cdb, const gchar *folder_name, CamelFIRecord **record, CamelException *ex)
+camel_db_read_folder_info_record (CamelDB *cdb,
+                                  const gchar *folder_name,
+                                  CamelFIRecord **record,
+                                  GError **error)
 {
 	gchar *query;
 	gint ret;
 
 	query = sqlite3_mprintf ("SELECT * FROM folders WHERE folder_name = %Q", folder_name);
-	ret = camel_db_select (cdb, query, read_fir_callback, record, ex);
+	ret = camel_db_select (cdb, query, read_fir_callback, record, error);
 
 	sqlite3_free (query);
 	return (ret);
@@ -1759,13 +1879,18 @@ camel_db_read_folder_info_record (CamelDB *cdb, const gchar *folder_name, CamelF
  * Since: 2.24
  **/
 gint
-camel_db_read_message_info_record_with_uid (CamelDB *cdb, const gchar *folder_name, const gchar *uid, gpointer p, CamelDBSelectCB read_mir_callback, CamelException *ex)
+camel_db_read_message_info_record_with_uid (CamelDB *cdb,
+                                            const gchar *folder_name,
+                                            const gchar *uid,
+                                            gpointer p,
+                                            CamelDBSelectCB read_mir_callback,
+                                            GError **error)
 {
 	gchar *query;
 	gint ret;
 
 	query = sqlite3_mprintf ("SELECT uid, flags, size, dsent, dreceived, subject, mail_from, mail_to, mail_cc, mlist, part, labels, usertags, cinfo, bdata FROM %Q WHERE uid = %Q", folder_name, uid);
-	ret = camel_db_select (cdb, query, read_mir_callback, p, ex);
+	ret = camel_db_select (cdb, query, read_mir_callback, p, error);
 	sqlite3_free (query);
 
 	return (ret);
@@ -1777,13 +1902,17 @@ camel_db_read_message_info_record_with_uid (CamelDB *cdb, const gchar *folder_na
  * Since: 2.24
  **/
 gint
-camel_db_read_message_info_records (CamelDB *cdb, const gchar *folder_name, gpointer p, CamelDBSelectCB read_mir_callback, CamelException *ex)
+camel_db_read_message_info_records (CamelDB *cdb,
+                                    const gchar *folder_name,
+                                    gpointer p,
+                                    CamelDBSelectCB read_mir_callback,
+                                    GError **error)
 {
 	gchar *query;
 	gint ret;
 
 	query = sqlite3_mprintf ("SELECT uid, flags, size, dsent, dreceived, subject, mail_from, mail_to, mail_cc, mlist, part, labels, usertags, cinfo, bdata FROM %Q ", folder_name);
-	ret = camel_db_select (cdb, query, read_mir_callback, p, ex);
+	ret = camel_db_select (cdb, query, read_mir_callback, p, error);
 	sqlite3_free (query);
 
 	return (ret);
@@ -1795,18 +1924,20 @@ camel_db_read_message_info_records (CamelDB *cdb, const gchar *folder_name, gpoi
  * Since: 2.24
  **/
 static gint
-camel_db_create_deleted_table (CamelDB *cdb, CamelException *ex)
+camel_db_create_deleted_table (CamelDB *cdb,
+                               GError **error)
 {
 	gint ret;
 	gchar *table_creation_query;
 	table_creation_query = sqlite3_mprintf ("CREATE TABLE IF NOT EXISTS Deletes (id INTEGER primary key AUTOINCREMENT not null, uid TEXT, time TEXT, mailbox TEXT)");
-	ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+	ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
 	sqlite3_free (table_creation_query);
 	return ret;
 }
 
 static gint
-camel_db_trim_deleted_table (CamelDB *cdb, CamelException *ex)
+camel_db_trim_deleted_table (CamelDB *cdb,
+                             GError **error)
 {
 	gint ret = 0;
 
@@ -1823,37 +1954,45 @@ camel_db_trim_deleted_table (CamelDB *cdb, CamelException *ex)
  * Since: 2.24
  **/
 gint
-camel_db_delete_uid (CamelDB *cdb, const gchar *folder, const gchar *uid, CamelException *ex)
+camel_db_delete_uid (CamelDB *cdb,
+                     const gchar *folder,
+                     const gchar *uid,
+                     GError **error)
 {
 	gchar *tab;
 	gint ret;
 
-	camel_db_begin_transaction (cdb, ex);
+	camel_db_begin_transaction (cdb, error);
 
-	ret = camel_db_create_deleted_table (cdb, ex);
+	ret = camel_db_create_deleted_table (cdb, error);
 
 	tab = sqlite3_mprintf ("INSERT OR REPLACE INTO Deletes (uid, mailbox, time) SELECT uid, %Q, strftime(\"%%s\", 'now') FROM %Q WHERE uid = %Q", folder, folder, uid);
-	ret = camel_db_add_to_transaction (cdb, tab, ex);
+	ret = camel_db_add_to_transaction (cdb, tab, error);
 	sqlite3_free (tab);
 
-	ret = camel_db_trim_deleted_table (cdb, ex);
+	ret = camel_db_trim_deleted_table (cdb, error);
 
 	tab = sqlite3_mprintf ("DELETE FROM '%q_bodystructure' WHERE uid = %Q", folder, uid);
-	ret = camel_db_add_to_transaction (cdb, tab, ex);
+	ret = camel_db_add_to_transaction (cdb, tab, error);
 	sqlite3_free (tab);
 
 	tab = sqlite3_mprintf ("DELETE FROM %Q WHERE uid = %Q", folder, uid);
-	ret = camel_db_add_to_transaction (cdb, tab, ex);
+	ret = camel_db_add_to_transaction (cdb, tab, error);
 	sqlite3_free (tab);
 
-	ret = camel_db_end_transaction (cdb, ex);
+	ret = camel_db_end_transaction (cdb, error);
 
 	CAMEL_DB_RELEASE_SQLITE_MEMORY;
 	return ret;
 }
 
 static gint
-cdb_delete_ids (CamelDB *cdb, const gchar * folder_name, GSList *uids, const gchar *uid_prefix, const gchar *field, CamelException *ex)
+cdb_delete_ids (CamelDB *cdb,
+                const gchar *folder_name,
+                GSList *uids,
+                const gchar *uid_prefix,
+                const gchar *field,
+                GError **error)
 {
 	gchar *tmp;
 	gint ret;
@@ -1866,10 +2005,10 @@ cdb_delete_ids (CamelDB *cdb, const gchar * folder_name, GSList *uids, const gch
 	if (strcmp (field, "vuid") != 0)
 		ins_str = g_string_new ("INSERT OR REPLACE INTO Deletes (uid, mailbox, time) SELECT uid, ");
 
-	camel_db_begin_transaction (cdb, ex);
+	camel_db_begin_transaction (cdb, error);
 
 	if (ins_str)
-		ret = camel_db_create_deleted_table (cdb, ex);
+		ret = camel_db_create_deleted_table (cdb, error);
 
 	if (ins_str) {
 		tab = sqlite3_mprintf ("%Q, strftime(\"%%s\", 'now') FROM %Q WHERE %s IN (", folder_name, folder_name, field);
@@ -1906,13 +2045,13 @@ cdb_delete_ids (CamelDB *cdb, const gchar * folder_name, GSList *uids, const gch
 	g_string_append (str, ")");
 	if (ins_str) {
 		g_string_append (ins_str, ")");
-		ret = camel_db_add_to_transaction (cdb, ins_str->str, ex);
-		ret = camel_db_trim_deleted_table (cdb, ex);
+		ret = camel_db_add_to_transaction (cdb, ins_str->str, error);
+		ret = camel_db_trim_deleted_table (cdb, error);
 	}
 
-	ret = camel_db_add_to_transaction (cdb, str->str, ex);
+	ret = camel_db_add_to_transaction (cdb, str->str, error);
 
-	ret = camel_db_end_transaction (cdb, ex);
+	ret = camel_db_end_transaction (cdb, error);
 
 	CAMEL_DB_RELEASE_SQLITE_MEMORY;
 
@@ -1929,12 +2068,15 @@ cdb_delete_ids (CamelDB *cdb, const gchar * folder_name, GSList *uids, const gch
  * Since: 2.24
  **/
 gint
-camel_db_delete_uids (CamelDB *cdb, const gchar * folder_name, GSList *uids, CamelException *ex)
+camel_db_delete_uids (CamelDB *cdb,
+                      const gchar *folder_name,
+                      GSList *uids,
+                      GError **error)
 {
 	if (!uids || !uids->data)
 		return 0;
 
-	return cdb_delete_ids (cdb, folder_name, uids, "", "uid", ex);
+	return cdb_delete_ids (cdb, folder_name, uids, "", "uid", error);
 }
 
 /**
@@ -1943,9 +2085,13 @@ camel_db_delete_uids (CamelDB *cdb, const gchar * folder_name, GSList *uids, Cam
  * Since: 2.26
  **/
 gint
-camel_db_delete_vuids (CamelDB *cdb, const gchar * folder_name, const gchar *hash, GSList *uids, CamelException *ex)
+camel_db_delete_vuids (CamelDB *cdb,
+                       const gchar *folder_name,
+                       const gchar *hash,
+                       GSList *uids,
+                       GError **error)
 {
-	return cdb_delete_ids (cdb, folder_name, uids, hash, "vuid", ex);
+	return cdb_delete_ids (cdb, folder_name, uids, hash, "vuid", error);
 }
 
 /**
@@ -1954,7 +2100,9 @@ camel_db_delete_vuids (CamelDB *cdb, const gchar * folder_name, const gchar *has
  * Since: 2.24
  **/
 gint
-camel_db_clear_folder_summary (CamelDB *cdb, const gchar *folder, CamelException *ex)
+camel_db_clear_folder_summary (CamelDB *cdb,
+                               const gchar *folder,
+                               GError **error)
 {
 	gint ret;
 
@@ -1967,21 +2115,21 @@ camel_db_clear_folder_summary (CamelDB *cdb, const gchar *folder, CamelException
 	msginfo_del = sqlite3_mprintf ("DELETE FROM %Q ", folder);
 	bstruct_del = sqlite3_mprintf ("DELETE FROM '%q_bodystructure' ", folder);
 
-	camel_db_begin_transaction (cdb, ex);
+	camel_db_begin_transaction (cdb, error);
 
-	ret = camel_db_create_deleted_table (cdb, ex);
+	ret = camel_db_create_deleted_table (cdb, error);
 
 	tab = sqlite3_mprintf ("INSERT OR REPLACE INTO Deletes (uid, mailbox, time) SELECT uid, %Q, strftime(\"%%s\", 'now') FROM %Q", folder, folder);
-	ret = camel_db_add_to_transaction (cdb, tab, ex);
+	ret = camel_db_add_to_transaction (cdb, tab, error);
 	sqlite3_free (tab);
 
-	ret = camel_db_trim_deleted_table (cdb, ex);
+	ret = camel_db_trim_deleted_table (cdb, error);
 
-	camel_db_add_to_transaction (cdb, msginfo_del, ex);
-	camel_db_add_to_transaction (cdb, folders_del, ex);
-	camel_db_add_to_transaction (cdb, bstruct_del, ex);
+	camel_db_add_to_transaction (cdb, msginfo_del, error);
+	camel_db_add_to_transaction (cdb, folders_del, error);
+	camel_db_add_to_transaction (cdb, bstruct_del, error);
 
-	ret = camel_db_end_transaction (cdb, ex);
+	ret = camel_db_end_transaction (cdb, error);
 
 	sqlite3_free (folders_del);
 	sqlite3_free (msginfo_del);
@@ -1996,35 +2144,37 @@ camel_db_clear_folder_summary (CamelDB *cdb, const gchar *folder, CamelException
  * Since: 2.24
  **/
 gint
-camel_db_delete_folder (CamelDB *cdb, const gchar *folder, CamelException *ex)
+camel_db_delete_folder (CamelDB *cdb,
+                        const gchar *folder,
+                        GError **error)
 {
 	gint ret;
 	gchar *del;
 	gchar *tab;
 
-	camel_db_begin_transaction (cdb, ex);
+	camel_db_begin_transaction (cdb, error);
 
-	ret = camel_db_create_deleted_table (cdb, ex);
+	ret = camel_db_create_deleted_table (cdb, error);
 
 	tab = sqlite3_mprintf ("INSERT OR REPLACE INTO Deletes (uid, mailbox, time) SELECT uid, %Q, strftime(\"%%s\", 'now') FROM %Q", folder, folder);
-	ret = camel_db_add_to_transaction (cdb, tab, ex);
+	ret = camel_db_add_to_transaction (cdb, tab, error);
 	sqlite3_free (tab);
 
-	ret = camel_db_trim_deleted_table (cdb, ex);
+	ret = camel_db_trim_deleted_table (cdb, error);
 
 	del = sqlite3_mprintf ("DELETE FROM folders WHERE folder_name = %Q", folder);
-	ret = camel_db_add_to_transaction (cdb, del, ex);
+	ret = camel_db_add_to_transaction (cdb, del, error);
 	sqlite3_free (del);
 
 	del = sqlite3_mprintf ("DROP TABLE %Q ", folder);
-	ret = camel_db_add_to_transaction (cdb, del, ex);
+	ret = camel_db_add_to_transaction (cdb, del, error);
 	sqlite3_free (del);
 
 	del = sqlite3_mprintf ("DROP TABLE '%q_bodystructure' ", folder);
-	ret = camel_db_add_to_transaction (cdb, del, ex);
+	ret = camel_db_add_to_transaction (cdb, del, error);
 	sqlite3_free (del);
 
-	ret = camel_db_end_transaction (cdb, ex);
+	ret = camel_db_end_transaction (cdb, error);
 
 	CAMEL_DB_RELEASE_SQLITE_MEMORY;
 	return ret;
@@ -2036,38 +2186,41 @@ camel_db_delete_folder (CamelDB *cdb, const gchar *folder, CamelException *ex)
  * Since: 2.24
  **/
 gint
-camel_db_rename_folder (CamelDB *cdb, const gchar *old_folder, const gchar *new_folder, CamelException *ex)
+camel_db_rename_folder (CamelDB *cdb,
+                        const gchar *old_folder,
+                        const gchar *new_folder,
+                        GError **error)
 {
 	gint ret;
 	gchar *cmd, *tab;
 
-	camel_db_begin_transaction (cdb, ex);
+	camel_db_begin_transaction (cdb, error);
 
-	ret = camel_db_create_deleted_table (cdb, ex);
+	ret = camel_db_create_deleted_table (cdb, error);
 
 	tab = sqlite3_mprintf ("INSERT OR REPLACE INTO Deletes (uid, mailbox, time) SELECT uid, %Q, strftime(\"%%s\", 'now') FROM %Q", old_folder, old_folder);
-	ret = camel_db_add_to_transaction (cdb, tab, ex);
+	ret = camel_db_add_to_transaction (cdb, tab, error);
 	sqlite3_free (tab);
 
-	ret = camel_db_trim_deleted_table (cdb, ex);
+	ret = camel_db_trim_deleted_table (cdb, error);
 
 	cmd = sqlite3_mprintf ("ALTER TABLE %Q RENAME TO  %Q", old_folder, new_folder);
-	ret = camel_db_add_to_transaction (cdb, cmd, ex);
+	ret = camel_db_add_to_transaction (cdb, cmd, error);
 	sqlite3_free (cmd);
 
 	cmd = sqlite3_mprintf ("ALTER TABLE '%q_version' RENAME TO  '%q_version'", old_folder, new_folder);
-        ret = camel_db_add_to_transaction (cdb, cmd, ex);
+        ret = camel_db_add_to_transaction (cdb, cmd, error);
         sqlite3_free (cmd);
 
 	cmd = sqlite3_mprintf ("UPDATE %Q SET modified=strftime(\"%%s\", 'now'), created=strftime(\"%%s\", 'now')", new_folder);
-	ret = camel_db_add_to_transaction (cdb, cmd, ex);
+	ret = camel_db_add_to_transaction (cdb, cmd, error);
 	sqlite3_free (cmd);
 
 	cmd = sqlite3_mprintf ("UPDATE folders SET folder_name = %Q WHERE folder_name = %Q", new_folder, old_folder);
-	ret = camel_db_add_to_transaction (cdb, cmd, ex);
+	ret = camel_db_add_to_transaction (cdb, cmd, error);
 	sqlite3_free (cmd);
 
-	ret = camel_db_end_transaction (cdb, ex);
+	ret = camel_db_end_transaction (cdb, error);
 
 	CAMEL_DB_RELEASE_SQLITE_MEMORY;
 	return ret;
@@ -2184,12 +2337,14 @@ camel_db_get_column_name (const gchar *raw_name)
  * Since: 2.24
  **/
 gint
-camel_db_migrate_vfolders_to_14 (CamelDB *cdb, const gchar *folder, CamelException *ex)
+camel_db_migrate_vfolders_to_14 (CamelDB *cdb,
+                                 const gchar *folder,
+                                 GError **error)
 {
 	gchar *cmd = sqlite3_mprintf ("ALTER TABLE %Q ADD COLUMN flags INTEGER", folder);
 	gint ret;
 
-	ret = camel_db_command (cdb, cmd, ex);
+	ret = camel_db_command (cdb, cmd, error);
 	sqlite3_free (cmd);
 
 	CAMEL_DB_RELEASE_SQLITE_MEMORY;
@@ -2202,16 +2357,17 @@ camel_db_migrate_vfolders_to_14 (CamelDB *cdb, const gchar *folder, CamelExcepti
  * Since: 2.26
  **/
 gint
-camel_db_start_in_memory_transactions (CamelDB *cdb, CamelException *ex)
+camel_db_start_in_memory_transactions (CamelDB *cdb,
+                                       GError **error)
 {
 	gint ret;
 	gchar *cmd = sqlite3_mprintf ("ATTACH DATABASE ':memory:' AS %s", CAMEL_DB_IN_MEMORY_DB);
 
-	ret = camel_db_command (cdb, cmd, ex);
+	ret = camel_db_command (cdb, cmd, error);
 	sqlite3_free (cmd);
 
 	cmd = sqlite3_mprintf ("CREATE TEMPORARY TABLE %Q (  uid TEXT PRIMARY KEY , flags INTEGER , msg_type INTEGER , read INTEGER , deleted INTEGER , replied INTEGER , important INTEGER , junk INTEGER , attachment INTEGER , dirty INTEGER , size INTEGER , dsent NUMERIC , dreceived NUMERIC , subject TEXT , mail_from TEXT , mail_to TEXT , mail_cc TEXT , mlist TEXT , followup_flag TEXT , followup_completed_on TEXT , followup_due_by TEXT , part TEXT , labels TEXT , usertags TEXT , cinfo TEXT , bdata TEXT )", CAMEL_DB_IN_MEMORY_TABLE);
-	ret = camel_db_command (cdb, cmd, ex);
+	ret = camel_db_command (cdb, cmd, error);
 	if (ret != 0 )
 		abort ();
 	sqlite3_free (cmd);
@@ -2225,20 +2381,22 @@ camel_db_start_in_memory_transactions (CamelDB *cdb, CamelException *ex)
  * Since: 2.26
  **/
 gint
-camel_db_flush_in_memory_transactions (CamelDB *cdb, const gchar * folder_name, CamelException *ex)
+camel_db_flush_in_memory_transactions (CamelDB *cdb,
+                                       const gchar *folder_name,
+                                       GError **error)
 {
 	gint ret;
 	gchar *cmd = sqlite3_mprintf ("INSERT INTO %Q SELECT * FROM %Q", folder_name, CAMEL_DB_IN_MEMORY_TABLE);
 
-	ret = camel_db_command (cdb, cmd, ex);
+	ret = camel_db_command (cdb, cmd, error);
 	sqlite3_free (cmd);
 
 	cmd = sqlite3_mprintf ("DROP TABLE %Q", CAMEL_DB_IN_MEMORY_TABLE);
-	ret = camel_db_command (cdb, cmd, ex);
+	ret = camel_db_command (cdb, cmd, error);
 	sqlite3_free (cmd);
 
 	cmd = sqlite3_mprintf ("DETACH %Q", CAMEL_DB_IN_MEMORY_DB);
-	ret = camel_db_command (cdb, cmd, ex);
+	ret = camel_db_command (cdb, cmd, error);
 	sqlite3_free (cmd);
 
 	return ret;
diff --git a/camel/camel-db.h b/camel/camel-db.h
index 78173cd..3dcd06e 100644
--- a/camel/camel-db.h
+++ b/camel/camel-db.h
@@ -40,8 +40,6 @@
  **/
 #define CAMEL_DB_IN_MEMORY_TABLE_LIMIT 100000
 
-#include "camel-exception.h"
-
 typedef struct _CamelDBPrivate CamelDBPrivate;
 
 /**
@@ -207,64 +205,64 @@ typedef struct _CamelDB CamelDB;
  **/
 typedef gint (*CamelDBSelectCB) (gpointer data, gint ncol, gchar **colvalues, gchar **colnames);
 
-CamelDB * camel_db_open (const gchar *path, CamelException *ex);
-CamelDB * camel_db_clone (CamelDB *cdb, CamelException *ex);
+CamelDB * camel_db_open (const gchar *path, GError **error);
+CamelDB * camel_db_clone (CamelDB *cdb, GError **error);
 void camel_db_close (CamelDB *cdb);
-gint camel_db_command (CamelDB *cdb, const gchar *stmt, CamelException *ex);
+gint camel_db_command (CamelDB *cdb, const gchar *stmt, GError **error);
 
-gint camel_db_transaction_command (CamelDB *cdb, GSList *qry_list, CamelException *ex);
+gint camel_db_transaction_command (CamelDB *cdb, GSList *qry_list, GError **error);
 
-gint camel_db_begin_transaction (CamelDB *cdb, CamelException *ex);
-gint camel_db_add_to_transaction (CamelDB *cdb, const gchar *query, CamelException *ex);
-gint camel_db_end_transaction (CamelDB *cdb, CamelException *ex);
-gint camel_db_abort_transaction (CamelDB *cdb, CamelException *ex);
-gint camel_db_clear_folder_summary (CamelDB *cdb, const gchar *folder, CamelException *ex);
-gint camel_db_rename_folder (CamelDB *cdb, const gchar *old_folder, const gchar *new_folder, CamelException *ex);
+gint camel_db_begin_transaction (CamelDB *cdb, GError **error);
+gint camel_db_add_to_transaction (CamelDB *cdb, const gchar *query, GError **error);
+gint camel_db_end_transaction (CamelDB *cdb, GError **error);
+gint camel_db_abort_transaction (CamelDB *cdb, GError **error);
+gint camel_db_clear_folder_summary (CamelDB *cdb, const gchar *folder, GError **error);
+gint camel_db_rename_folder (CamelDB *cdb, const gchar *old_folder, const gchar *new_folder, GError **error);
 
-gint camel_db_delete_folder (CamelDB *cdb, const gchar *folder, CamelException *ex);
-gint camel_db_delete_uid (CamelDB *cdb, const gchar *folder, const gchar *uid, CamelException *ex);
-/*int camel_db_delete_uids (CamelDB *cdb, CamelException *ex, gint nargs, ... );*/
-gint camel_db_delete_uids (CamelDB *cdb, const gchar * folder_name, GSList *uids, CamelException *ex);
-gint camel_db_delete_vuids (CamelDB *cdb, const gchar * folder_name, const gchar *shash, GSList *uids, CamelException *ex);
+gint camel_db_delete_folder (CamelDB *cdb, const gchar *folder, GError **error);
+gint camel_db_delete_uid (CamelDB *cdb, const gchar *folder, const gchar *uid, GError **error);
+/*int camel_db_delete_uids (CamelDB *cdb, GError **error, gint nargs, ... );*/
+gint camel_db_delete_uids (CamelDB *cdb, const gchar * folder_name, GSList *uids, GError **error);
+gint camel_db_delete_vuids (CamelDB *cdb, const gchar * folder_name, const gchar *shash, GSList *uids, GError **error);
 
-gint camel_db_create_folders_table (CamelDB *cdb, CamelException *ex);
-gint camel_db_select (CamelDB *cdb, const gchar * stmt, CamelDBSelectCB callback, gpointer data, CamelException *ex);
+gint camel_db_create_folders_table (CamelDB *cdb, GError **error);
+gint camel_db_select (CamelDB *cdb, const gchar * stmt, CamelDBSelectCB callback, gpointer data, GError **error);
 
-gint camel_db_write_folder_info_record (CamelDB *cdb, CamelFIRecord *record, CamelException *ex);
-gint camel_db_read_folder_info_record (CamelDB *cdb, const gchar *folder_name, CamelFIRecord **record, CamelException *ex);
+gint camel_db_write_folder_info_record (CamelDB *cdb, CamelFIRecord *record, GError **error);
+gint camel_db_read_folder_info_record (CamelDB *cdb, const gchar *folder_name, CamelFIRecord **record, GError **error);
 
-gint camel_db_prepare_message_info_table (CamelDB *cdb, const gchar *folder_name, CamelException *ex);
+gint camel_db_prepare_message_info_table (CamelDB *cdb, const gchar *folder_name, GError **error);
 
-gint camel_db_write_message_info_record (CamelDB *cdb, const gchar *folder_name, CamelMIRecord *record, CamelException *ex);
-gint camel_db_write_fresh_message_info_record (CamelDB *cdb, const gchar *folder_name, CamelMIRecord *record, CamelException *ex);
-gint camel_db_read_message_info_records (CamelDB *cdb, const gchar *folder_name, gpointer p, CamelDBSelectCB read_mir_callback, CamelException *ex);
-gint camel_db_read_message_info_record_with_uid (CamelDB *cdb, const gchar *folder_name, const gchar *uid, gpointer p, CamelDBSelectCB read_mir_callback, CamelException *ex);
+gint camel_db_write_message_info_record (CamelDB *cdb, const gchar *folder_name, CamelMIRecord *record, GError **error);
+gint camel_db_write_fresh_message_info_record (CamelDB *cdb, const gchar *folder_name, CamelMIRecord *record, GError **error);
+gint camel_db_read_message_info_records (CamelDB *cdb, const gchar *folder_name, gpointer p, CamelDBSelectCB read_mir_callback, GError **error);
+gint camel_db_read_message_info_record_with_uid (CamelDB *cdb, const gchar *folder_name, const gchar *uid, gpointer p, CamelDBSelectCB read_mir_callback, GError **error);
 
-gint camel_db_count_junk_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, CamelException *ex);
-gint camel_db_count_unread_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, CamelException *ex);
-gint camel_db_count_deleted_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, CamelException *ex);
-gint camel_db_count_total_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, CamelException *ex);
+gint camel_db_count_junk_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, GError **error);
+gint camel_db_count_unread_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, GError **error);
+gint camel_db_count_deleted_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, GError **error);
+gint camel_db_count_total_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, GError **error);
 
-gint camel_db_count_visible_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, CamelException *ex);
-gint camel_db_count_visible_unread_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, CamelException *ex);
+gint camel_db_count_visible_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, GError **error);
+gint camel_db_count_visible_unread_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, GError **error);
 
-gint camel_db_count_junk_not_deleted_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, CamelException *ex);
-gint camel_db_count_message_info (CamelDB *cdb, const gchar *query, guint32 *count, CamelException *ex);
+gint camel_db_count_junk_not_deleted_message_info (CamelDB *cdb, const gchar *table_name, guint32 *count, GError **error);
+gint camel_db_count_message_info (CamelDB *cdb, const gchar *query, guint32 *count, GError **error);
 void camel_db_camel_mir_free (CamelMIRecord *record);
 
-gint camel_db_create_vfolder (CamelDB *db, const gchar *folder_name, CamelException *ex);
-gint camel_db_recreate_vfolder (CamelDB *db, const gchar *folder_name, CamelException *ex);
-gint camel_db_delete_uid_from_vfolder (CamelDB *db, gchar *folder_name, gchar *vuid, CamelException *ex);
-gint camel_db_delete_uid_from_vfolder_transaction (CamelDB *db, const gchar *folder_name, const gchar *vuid, CamelException *ex);
-GPtrArray * camel_db_get_vuids_from_vfolder (CamelDB *db, const gchar *folder_name, gchar *filter, CamelException *ex);
-gint camel_db_add_to_vfolder (CamelDB *db, gchar *folder_name, gchar *vuid, CamelException *ex);
-gint camel_db_add_to_vfolder_transaction (CamelDB *db, const gchar *folder_name, const gchar *vuid, CamelException *ex);
+gint camel_db_create_vfolder (CamelDB *db, const gchar *folder_name, GError **error);
+gint camel_db_recreate_vfolder (CamelDB *db, const gchar *folder_name, GError **error);
+gint camel_db_delete_uid_from_vfolder (CamelDB *db, gchar *folder_name, gchar *vuid, GError **error);
+gint camel_db_delete_uid_from_vfolder_transaction (CamelDB *db, const gchar *folder_name, const gchar *vuid, GError **error);
+GPtrArray * camel_db_get_vuids_from_vfolder (CamelDB *db, const gchar *folder_name, gchar *filter, GError **error);
+gint camel_db_add_to_vfolder (CamelDB *db, gchar *folder_name, gchar *vuid, GError **error);
+gint camel_db_add_to_vfolder_transaction (CamelDB *db, const gchar *folder_name, const gchar *vuid, GError **error);
 
-gint camel_db_get_folder_uids (CamelDB *db, const gchar *folder_name, const gchar *sort_by, const gchar *collate, GPtrArray *array, CamelException *ex);
-gint camel_db_get_folder_uids_flags (CamelDB *db, const gchar *folder_name, const gchar *sort_by, const gchar *collate, GPtrArray *summary, GHashTable *table, CamelException *ex);
+gint camel_db_get_folder_uids (CamelDB *db, const gchar *folder_name, const gchar *sort_by, const gchar *collate, GPtrArray *array, GError **error);
+gint camel_db_get_folder_uids_flags (CamelDB *db, const gchar *folder_name, const gchar *sort_by, const gchar *collate, GPtrArray *summary, GHashTable *table, GError **error);
 
-GPtrArray * camel_db_get_folder_junk_uids (CamelDB *db, gchar *folder_name, CamelException *ex);
-GPtrArray * camel_db_get_folder_deleted_uids (CamelDB *db, const gchar *folder_name, CamelException *ex);
+GPtrArray * camel_db_get_folder_junk_uids (CamelDB *db, gchar *folder_name, GError **error);
+GPtrArray * camel_db_get_folder_deleted_uids (CamelDB *db, const gchar *folder_name, GError **error);
 
 gchar * camel_db_sqlize_string (const gchar *string);
 void camel_db_free_sqlized_string (gchar *string);
@@ -272,16 +270,16 @@ void camel_db_free_sqlized_string (gchar *string);
 gchar * camel_db_get_column_name (const gchar *raw_name);
 gint camel_db_set_collate (CamelDB *cdb, const gchar *col, const gchar *collate, CamelDBCollate func);
 /* Migration APIS */
-gint camel_db_migrate_vfolders_to_14(CamelDB *cdb, const gchar *folder, CamelException *ex);
+gint camel_db_migrate_vfolders_to_14(CamelDB *cdb, const gchar *folder, GError **error);
 
-gint camel_db_start_in_memory_transactions (CamelDB *cdb, CamelException *ex);
-gint camel_db_flush_in_memory_transactions (CamelDB *cdb, const gchar * folder_name, CamelException *ex);
+gint camel_db_start_in_memory_transactions (CamelDB *cdb, GError **error);
+gint camel_db_flush_in_memory_transactions (CamelDB *cdb, const gchar * folder_name, GError **error);
 
 GHashTable *
-camel_db_get_folder_preview (CamelDB *db, const gchar *folder_name, CamelException *ex);
-gint camel_db_write_preview_record (CamelDB *db, const gchar *folder_name, const gchar *uid, const gchar *msg, CamelException *ex);
+camel_db_get_folder_preview (CamelDB *db, const gchar *folder_name, GError **error);
+gint camel_db_write_preview_record (CamelDB *db, const gchar *folder_name, const gchar *uid, const gchar *msg, GError **error);
 
 gint
-camel_db_reset_folder_version (CamelDB *cdb, const gchar *folder_name, gint reset_version, CamelException *ex);
+camel_db_reset_folder_version (CamelDB *cdb, const gchar *folder_name, gint reset_version, GError **error);
 #endif
 
diff --git a/camel/camel-debug.h b/camel/camel-debug.h
index da1556d..16cffe8 100644
--- a/camel/camel-debug.h
+++ b/camel/camel-debug.h
@@ -40,6 +40,40 @@ gboolean camel_debug(const gchar *mode);
 gboolean camel_debug_start(const gchar *mode);
 void camel_debug_end(void);
 
+/* This sanity checks return values and GErrors.  If returning
+ * failure, make sure the GError is set.  If returning success,
+ * make sure the GError is NOT set.
+ *
+ * Example:
+ *
+ *     success = class->foo (object, some_data, error);
+ *     CAMEL_CHECK_GERROR (object, foo, success, error);
+ *     return success;
+ */
+#define CAMEL_CHECK_GERROR(object, method, expr, error) \
+	G_STMT_START { \
+	if (expr) { \
+		if ((error) != NULL && *(error) != NULL) { \
+			g_warning ( \
+				"%s::%s() set its GError " \
+				"but then reported success", \
+				G_OBJECT_TYPE_NAME (object), \
+				G_STRINGIFY (method)); \
+			g_warning ( \
+				"Error message was: %s", \
+				(*(error))->message); \
+		} \
+	} else { \
+		if ((error) != NULL && *(error) == NULL) { \
+			g_warning ( \
+				"%s::%s() reported failure " \
+				"without setting its GError", \
+				G_OBJECT_TYPE_NAME (object), \
+				G_STRINGIFY (method)); \
+		} \
+	} \
+	} G_STMT_END
+
 G_END_DECLS
 
 #endif /* CAMEL_DEBUG_H */
diff --git a/camel/camel-disco-diary.c b/camel/camel-disco-diary.c
index 882c1a0..2a3968b 100644
--- a/camel/camel-disco-diary.c
+++ b/camel/camel-disco-diary.c
@@ -246,12 +246,11 @@ diary_decode_folder (CamelDiscoDiary *diary)
 		return NULL;
 	folder = g_hash_table_lookup (diary->folders, name);
 	if (!folder) {
-		CamelException ex;
+		GError *error = NULL;
 		gchar *msg;
 
-		camel_exception_init (&ex);
 		folder = camel_store_get_folder (
-			CAMEL_STORE (diary->store), name, 0, &ex);
+			CAMEL_STORE (diary->store), name, 0, &error);
 		if (folder)
 			g_hash_table_insert (diary->folders, name, folder);
 		else {
@@ -259,8 +258,8 @@ diary_decode_folder (CamelDiscoDiary *diary)
 				_("Could not open '%s':\n%s\n"
 				  "Changes made to this folder "
 				  "will not be resynchronized."),
-				name, camel_exception_get_description (&ex));
-			camel_exception_clear (&ex);
+				name, error->message);
+			g_error_free (error);
 			camel_session_alert_user (
 				camel_service_get_session (CAMEL_SERVICE (diary->store)),
 				CAMEL_SESSION_ALERT_WARNING,
@@ -283,11 +282,12 @@ close_folder (gpointer name, gpointer folder, gpointer data)
 
 void
 camel_disco_diary_replay (CamelDiscoDiary *diary,
-                          CamelException *ex)
+                          GError **error)
 {
 	guint32 action;
 	off_t size;
 	gdouble pc;
+	GError *local_error = NULL;
 
 	d(printf("disco diary replay\n"));
 
@@ -297,7 +297,7 @@ camel_disco_diary_replay (CamelDiscoDiary *diary,
 	rewind (diary->file);
 
 	camel_operation_start (NULL, _("Resynchronizing with server"));
-	while (!camel_exception_is_set (ex)) {
+	while (local_error == NULL) {
 		pc = ftell (diary->file) / size;
 		camel_operation_progress (NULL, pc * 100);
 
@@ -319,7 +319,7 @@ camel_disco_diary_replay (CamelDiscoDiary *diary,
 
 			if (folder)
 				camel_disco_folder_expunge_uids (
-					folder, uids, ex);
+					folder, uids, &local_error);
 			free_uids (uids);
 			break;
 		}
@@ -349,7 +349,7 @@ camel_disco_diary_replay (CamelDiscoDiary *diary,
 			info = camel_folder_get_message_info (folder, uid);
 
 			camel_folder_append_message (
-				folder, message, info, &ret_uid, ex);
+				folder, message, info, &ret_uid, &local_error);
 			camel_folder_free_message_info (folder, info);
 
 			if (ret_uid) {
@@ -383,7 +383,7 @@ camel_disco_diary_replay (CamelDiscoDiary *diary,
 
 			camel_folder_transfer_messages_to (
 				source, uids, destination, &ret_uids,
-				delete_originals, ex);
+				delete_originals, &local_error);
 
 			if (ret_uids) {
 				for (i = 0; i < uids->len; i++) {
@@ -411,12 +411,14 @@ camel_disco_diary_replay (CamelDiscoDiary *diary,
 
 	/* Truncate the log */
 	ftruncate (fileno (diary->file), 0);
+
+	g_propagate_error (error, local_error);
 }
 
 CamelDiscoDiary *
 camel_disco_diary_new (CamelDiscoStore *store,
                        const gchar *filename,
-                       CamelException *ex)
+                       GError **error)
 {
 	CamelDiscoDiary *diary;
 
@@ -443,8 +445,9 @@ camel_disco_diary_new (CamelDiscoStore *store,
 	diary->file = g_fopen (filename, "a+b");
 	if (!diary->file) {
 		g_object_unref (diary);
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			"Could not open journal file: %s",
 			g_strerror (errno));
 		return NULL;
diff --git a/camel/camel-disco-diary.h b/camel/camel-disco-diary.h
index 8f12183..359600c 100644
--- a/camel/camel-disco-diary.h
+++ b/camel/camel-disco-diary.h
@@ -83,13 +83,13 @@ GType		camel_disco_diary_get_type	(void);
 CamelDiscoDiary *
 		camel_disco_diary_new		(CamelDiscoStore *store,
 						 const gchar *filename,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_disco_diary_empty		(CamelDiscoDiary *diary);
 void		camel_disco_diary_log		(CamelDiscoDiary *diary,
 						 CamelDiscoDiaryAction action,
 						 ...);
 void		camel_disco_diary_replay	(CamelDiscoDiary *diary,
-						 CamelException *ex);
+						 GError **error);
 
 /* Temporary->Permanent UID map stuff */
 void		camel_disco_diary_uidmap_add	(CamelDiscoDiary *diary,
diff --git a/camel/camel-disco-folder.c b/camel/camel-disco-folder.c
index 24b6a79..6f949ae 100644
--- a/camel/camel-disco-folder.c
+++ b/camel/camel-disco-folder.c
@@ -27,9 +27,9 @@
 
 #include <glib/gi18n-lib.h>
 
+#include "camel-debug.h"
 #include "camel-disco-folder.h"
 #include "camel-disco-store.h"
-#include "camel-exception.h"
 #include "camel-session.h"
 
 #define CAMEL_DISCO_FOLDER_GET_PRIVATE(obj) \
@@ -57,7 +57,7 @@ enum {
 G_DEFINE_TYPE (CamelDiscoFolder, camel_disco_folder, CAMEL_TYPE_FOLDER)
 
 /* Forward Declarations */
-static gboolean disco_expunge (CamelFolder *folder, CamelException *ex);
+static gboolean disco_expunge (CamelFolder *folder, GError **error);
 
 static void
 cdf_sync_offline(CamelSession *session, CamelSessionThreadMsg *mm)
@@ -74,12 +74,12 @@ cdf_sync_offline(CamelSession *session, CamelSessionThreadMsg *mm)
 			camel_operation_progress(NULL, pc);
 			camel_disco_folder_cache_message((CamelDiscoFolder *)m->folder,
 							 m->changes->uid_added->pdata[i],
-							 &mm->ex);
+							 &mm->error);
 		}
 	} else {
 		camel_disco_folder_prepare_for_offline((CamelDiscoFolder *)m->folder,
 						       "(match-all)",
-						       &mm->ex);
+						       &mm->error);
 	}
 
 	camel_operation_end(NULL);
@@ -161,10 +161,11 @@ disco_folder_get_property (GObject *object,
 
 static gboolean
 disco_refresh_info (CamelFolder *folder,
-                    CamelException *ex)
+                    GError **error)
 {
 	CamelDiscoFolderClass *disco_folder_class;
 	CamelStore *parent_store;
+	gboolean success;
 
 	parent_store = camel_folder_get_parent_store (folder);
 
@@ -173,21 +174,23 @@ disco_refresh_info (CamelFolder *folder,
 
 	disco_folder_class = CAMEL_DISCO_FOLDER_GET_CLASS (folder);
 
-	return disco_folder_class->refresh_info_online (folder, ex);
+	success = disco_folder_class->refresh_info_online (folder, error);
+	CAMEL_CHECK_GERROR (folder, refresh_info_online, success, error);
+
+	return success;
 }
 
 static gboolean
 disco_sync (CamelFolder *folder,
             gboolean expunge,
-            CamelException *ex)
+            GError **error)
 {
 	CamelDiscoFolderClass *disco_folder_class;
 	CamelStore *parent_store;
+	gboolean success;
 
-	if (expunge && !disco_expunge (folder, ex)) {
-		if (camel_exception_is_set (ex))
-			return FALSE;
-	}
+	if (expunge && !disco_expunge (folder, error))
+		return FALSE;
 
 	camel_object_state_write (CAMEL_OBJECT (folder));
 
@@ -196,13 +199,19 @@ disco_sync (CamelFolder *folder,
 
 	switch (camel_disco_store_status (CAMEL_DISCO_STORE (parent_store))) {
 	case CAMEL_DISCO_STORE_ONLINE:
-		return disco_folder_class->sync_online (folder, ex);
+		success = disco_folder_class->sync_online (folder, error);
+		CAMEL_CHECK_GERROR (folder, sync_online, success, error);
+		return success;
 
 	case CAMEL_DISCO_STORE_OFFLINE:
-		return disco_folder_class->sync_offline (folder, ex);
+		success = disco_folder_class->sync_offline (folder, error);
+		CAMEL_CHECK_GERROR (folder, sync_offline, success, error);
+		return success;
 
 	case CAMEL_DISCO_STORE_RESYNCING:
-		return disco_folder_class->sync_resyncing (folder, ex);
+		success = disco_folder_class->sync_resyncing (folder, error);
+		CAMEL_CHECK_GERROR (folder, sync_resyncing, success, error);
+		return success;
 	}
 
 	g_return_val_if_reached (FALSE);
@@ -211,10 +220,11 @@ disco_sync (CamelFolder *folder,
 static gboolean
 disco_expunge_uids (CamelFolder *folder,
                     GPtrArray *uids,
-                    CamelException *ex)
+                    GError **error)
 {
 	CamelDiscoFolderClass *disco_folder_class;
 	CamelStore *parent_store;
+	gboolean success;
 
 	if (uids->len == 0)
 		return TRUE;
@@ -224,16 +234,25 @@ disco_expunge_uids (CamelFolder *folder,
 
 	switch (camel_disco_store_status (CAMEL_DISCO_STORE (parent_store))) {
 	case CAMEL_DISCO_STORE_ONLINE:
-		return disco_folder_class->expunge_uids_online (
-			folder, uids, ex);
+		success = disco_folder_class->expunge_uids_online (
+			folder, uids, error);
+		CAMEL_CHECK_GERROR (
+			folder, expunge_uids_online, success, error);
+		return success;
 
 	case CAMEL_DISCO_STORE_OFFLINE:
-		return disco_folder_class->expunge_uids_offline (
-			folder, uids, ex);
+		success = disco_folder_class->expunge_uids_offline (
+			folder, uids, error);
+		CAMEL_CHECK_GERROR (
+			folder, expunge_uids_offline, success, error);
+		return success;
 
 	case CAMEL_DISCO_STORE_RESYNCING:
-		return disco_folder_class->expunge_uids_resyncing (
-			folder, uids, ex);
+		success = disco_folder_class->expunge_uids_resyncing (
+			folder, uids, error);
+		CAMEL_CHECK_GERROR (
+			folder, expunge_uids_resyncing, success, error);
+		return success;
 	}
 
 	g_return_val_if_reached (FALSE);
@@ -241,7 +260,7 @@ disco_expunge_uids (CamelFolder *folder,
 
 static gboolean
 disco_expunge (CamelFolder *folder,
-               CamelException *ex)
+               GError **error)
 {
 	GPtrArray *uids;
 	gint i;
@@ -250,7 +269,7 @@ disco_expunge (CamelFolder *folder,
 	gboolean success;
 
 	uids = g_ptr_array_new ();
-	camel_folder_summary_prepare_fetch_all (folder->summary, ex);
+	camel_folder_summary_prepare_fetch_all (folder->summary, NULL);
 	count = camel_folder_summary_count (folder->summary);
 	for (i = 0; i < count; i++) {
 		info = camel_folder_summary_index (folder->summary, i);
@@ -259,7 +278,7 @@ disco_expunge (CamelFolder *folder,
 		camel_message_info_free(info);
 	}
 
-	success = disco_expunge_uids (folder, uids, ex);
+	success = disco_expunge_uids (folder, uids, error);
 
 	for (i = 0; i < uids->len; i++)
 		g_free (uids->pdata[i]);
@@ -273,26 +292,33 @@ disco_append_message (CamelFolder *folder,
                       CamelMimeMessage *message,
                       const CamelMessageInfo *info,
                       gchar **appended_uid,
-                      CamelException *ex)
+                      GError **error)
 {
 	CamelDiscoFolderClass *disco_folder_class;
 	CamelStore *parent_store;
+	gboolean success;
 
 	parent_store = camel_folder_get_parent_store (folder);
 	disco_folder_class = CAMEL_DISCO_FOLDER_GET_CLASS (folder);
 
 	switch (camel_disco_store_status (CAMEL_DISCO_STORE (parent_store))) {
 	case CAMEL_DISCO_STORE_ONLINE:
-		return disco_folder_class->append_online (
-			folder, message, info, appended_uid, ex);
+		success = disco_folder_class->append_online (
+			folder, message, info, appended_uid, error);
+		CAMEL_CHECK_GERROR (folder, append_online, success, error);
+		return success;
 
 	case CAMEL_DISCO_STORE_OFFLINE:
-		return disco_folder_class->append_offline (
-			folder, message, info, appended_uid, ex);
+		success = disco_folder_class->append_offline (
+			folder, message, info, appended_uid, error);
+		CAMEL_CHECK_GERROR (folder, append_offline, success, error);
+		return success;
 
 	case CAMEL_DISCO_STORE_RESYNCING:
-		return disco_folder_class->append_resyncing (
-			folder, message, info, appended_uid, ex);
+		success = disco_folder_class->append_resyncing (
+			folder, message, info, appended_uid, error);
+		CAMEL_CHECK_GERROR (folder, append_resyncing, success, error);
+		return success;
 	}
 
 	g_return_val_if_reached (FALSE);
@@ -304,29 +330,36 @@ disco_transfer_messages_to (CamelFolder *source,
                             CamelFolder *dest,
                             GPtrArray **transferred_uids,
                             gboolean delete_originals,
-                            CamelException *ex)
+                            GError **error)
 {
 	CamelDiscoFolderClass *disco_folder_class;
 	CamelStore *parent_store;
+	gboolean success;
 
 	parent_store = camel_folder_get_parent_store (source);
 	disco_folder_class = CAMEL_DISCO_FOLDER_GET_CLASS (source);
 
 	switch (camel_disco_store_status (CAMEL_DISCO_STORE (parent_store))) {
 	case CAMEL_DISCO_STORE_ONLINE:
-		return disco_folder_class->transfer_online (
+		success = disco_folder_class->transfer_online (
 			source, uids, dest, transferred_uids,
-			delete_originals, ex);
+			delete_originals, error);
+		CAMEL_CHECK_GERROR (source, transfer_online, success, error);
+		return success;
 
 	case CAMEL_DISCO_STORE_OFFLINE:
-		return disco_folder_class->transfer_offline (
+		success = disco_folder_class->transfer_offline (
 			source, uids, dest, transferred_uids,
-			delete_originals, ex);
+			delete_originals, error);
+		CAMEL_CHECK_GERROR (source, transfer_offline, success, error);
+		return success;
 
 	case CAMEL_DISCO_STORE_RESYNCING:
-		return disco_folder_class->transfer_resyncing (
+		success = disco_folder_class->transfer_resyncing (
 			source, uids, dest, transferred_uids,
-			delete_originals, ex);
+			delete_originals, error);
+		CAMEL_CHECK_GERROR (source, transfer_resyncing, success, error);
+		return success;
 	}
 
 	g_return_val_if_reached (FALSE);
@@ -335,7 +368,7 @@ disco_transfer_messages_to (CamelFolder *source,
 static gboolean
 disco_prepare_for_offline (CamelDiscoFolder *disco_folder,
                            const gchar *expression,
-                           CamelException *ex)
+                           GError **error)
 {
 	CamelFolder *folder = CAMEL_FOLDER (disco_folder);
 	GPtrArray *uids;
@@ -347,7 +380,7 @@ disco_prepare_for_offline (CamelDiscoFolder *disco_folder,
 		camel_folder_get_full_name (folder));
 
 	if (expression)
-		uids = camel_folder_search_by_expression (folder, expression, ex);
+		uids = camel_folder_search_by_expression (folder, expression, error);
 	else
 		uids = camel_folder_get_uids (folder);
 
@@ -361,7 +394,7 @@ disco_prepare_for_offline (CamelDiscoFolder *disco_folder,
 
 		camel_operation_progress(NULL, pc);
 		success = camel_disco_folder_cache_message (
-			disco_folder, uids->pdata[i], ex);
+			disco_folder, uids->pdata[i], error);
 	}
 
 	if (expression)
@@ -376,7 +409,7 @@ disco_prepare_for_offline (CamelDiscoFolder *disco_folder,
 
 static gboolean
 disco_refresh_info_online (CamelFolder *folder,
-                           CamelException *ex)
+                           GError **error)
 {
 	return TRUE;
 }
@@ -461,7 +494,7 @@ camel_disco_folder_set_offline_sync (CamelDiscoFolder *disco_folder,
  * camel_disco_folder_expunge_uids:
  * @folder: a (disconnectable) folder
  * @uids: array of UIDs to expunge
- * @ex: a CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * This expunges the messages in @uids from @folder. It should take
  * whatever steps are needed to avoid expunging any other messages,
@@ -474,19 +507,19 @@ camel_disco_folder_set_offline_sync (CamelDiscoFolder *disco_folder,
 gboolean
 camel_disco_folder_expunge_uids (CamelFolder *folder,
                                  GPtrArray *uids,
-                                 CamelException *ex)
+                                 GError **error)
 {
 	g_return_val_if_fail (CAMEL_IS_DISCO_FOLDER (folder), FALSE);
 	g_return_val_if_fail (uids != NULL, FALSE);
 
-	return disco_expunge_uids (folder, uids, ex);
+	return disco_expunge_uids (folder, uids, error);
 }
 
 /**
  * camel_disco_folder_cache_message:
  * @disco_folder: the folder
  * @uid: the UID of the message to cache
- * @ex: a CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Requests that @disco_folder cache message @uid to disk.
  *
@@ -495,9 +528,10 @@ camel_disco_folder_expunge_uids (CamelFolder *folder,
 gboolean
 camel_disco_folder_cache_message (CamelDiscoFolder *disco_folder,
                                   const gchar *uid,
-                                  CamelException *ex)
+                                  GError **error)
 {
 	CamelDiscoFolderClass *class;
+	gboolean success;
 
 	g_return_val_if_fail (CAMEL_IS_DISCO_FOLDER (disco_folder), FALSE);
 	g_return_val_if_fail (uid != NULL, FALSE);
@@ -505,7 +539,10 @@ camel_disco_folder_cache_message (CamelDiscoFolder *disco_folder,
 	class = CAMEL_DISCO_FOLDER_GET_CLASS (disco_folder);
 	g_return_val_if_fail (class->cache_message != NULL, FALSE);
 
-	return class->cache_message (disco_folder, uid, ex);
+	success = class->cache_message (disco_folder, uid, error);
+	CAMEL_CHECK_GERROR (disco_folder, cache_message, success, error);
+
+	return success;
 }
 
 /**
@@ -513,7 +550,7 @@ camel_disco_folder_cache_message (CamelDiscoFolder *disco_folder,
  * @disco_folder: the folder
  * @expression: an expression describing messages to synchronize, or %NULL
  * if all messages should be sync'ed.
- * @ex: a CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * This prepares @disco_folder for offline operation, by downloading
  * the bodies of all messages described by @expression (using the
@@ -524,14 +561,18 @@ camel_disco_folder_cache_message (CamelDiscoFolder *disco_folder,
 gboolean
 camel_disco_folder_prepare_for_offline (CamelDiscoFolder *disco_folder,
                                         const gchar *expression,
-                                        CamelException *ex)
+                                        GError **error)
 {
 	CamelDiscoFolderClass *class;
+	gboolean success;
 
 	g_return_val_if_fail (CAMEL_IS_DISCO_FOLDER (disco_folder), FALSE);
 
 	class = CAMEL_DISCO_FOLDER_GET_CLASS (disco_folder);
 	g_return_val_if_fail (class->prepare_for_offline != NULL, FALSE);
 
-	return class->prepare_for_offline (disco_folder, expression, ex);
+	success = class->prepare_for_offline (disco_folder, expression, error);
+	CAMEL_CHECK_GERROR (disco_folder, prepare_for_offline, success, error);
+
+	return success;
 }
diff --git a/camel/camel-disco-folder.h b/camel/camel-disco-folder.h
index 56ee026..11e0ae6 100644
--- a/camel/camel-disco-folder.h
+++ b/camel/camel-disco-folder.h
@@ -66,62 +66,62 @@ struct _CamelDiscoFolderClass {
 	CamelFolderClass parent_class;
 
 	gboolean	(*refresh_info_online)	(CamelFolder *folder,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*sync_online)		(CamelFolder *folder,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*sync_offline)		(CamelFolder *folder,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*sync_resyncing)	(CamelFolder *folder,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*expunge_uids_online)	(CamelFolder *folder,
 						 GPtrArray *uids,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*expunge_uids_offline)	(CamelFolder *folder,
 						 GPtrArray *uids,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*expunge_uids_resyncing)
 						(CamelFolder *folder,
 						 GPtrArray *uids,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*append_online)	(CamelFolder *folder,
 						 CamelMimeMessage *message,
 						 const CamelMessageInfo *info,
 						 gchar **appended_uid,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*append_offline)	(CamelFolder *folder,
 						 CamelMimeMessage *message,
 						 const CamelMessageInfo *info,
 						 gchar **appended_uid,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*append_resyncing)	(CamelFolder *folder,
 						 CamelMimeMessage *message,
 						 const CamelMessageInfo *info,
 						 gchar **appended_uid,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*transfer_online)	(CamelFolder *source,
 						 GPtrArray *uids,
 						 CamelFolder *destination,
 						 GPtrArray **transferred_uids,
 						 gboolean delete_originals,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*transfer_offline)	(CamelFolder *source,
 						 GPtrArray *uids,
 						 CamelFolder *destination,
 						 GPtrArray **transferred_uids,
 						 gboolean delete_originals,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*transfer_resyncing)	(CamelFolder *source,
 						 GPtrArray *uids,
 						 CamelFolder *destination,
 						 GPtrArray **transferred_uids,
 						 gboolean delete_originals,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*cache_message)	(CamelDiscoFolder *disco_folder,
 						 const gchar *uid,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*prepare_for_offline)	(CamelDiscoFolder *disco_folder,
 						 const gchar *expression,
-						 CamelException *ex);
+						 GError **error);
 	void		(*update_uid)		(CamelFolder *folder,
 						 const gchar *old_uid,
 						 const gchar *new_uid);
@@ -135,14 +135,14 @@ void		camel_disco_folder_set_offline_sync
 						 gboolean offline_sync);
 gboolean	camel_disco_folder_expunge_uids	(CamelFolder *folder,
 						 GPtrArray *uids,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_disco_folder_cache_message(CamelDiscoFolder *disco_folder,
 						 const gchar *uid,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_disco_folder_prepare_for_offline
 						(CamelDiscoFolder *disco_folder,
 						 const gchar *expression,
-						 CamelException *ex);
+						 GError **error);
 
 G_END_DECLS
 
diff --git a/camel/camel-disco-store.c b/camel/camel-disco-store.c
index 38d8c32..83ad1a6 100644
--- a/camel/camel-disco-store.c
+++ b/camel/camel-disco-store.c
@@ -28,10 +28,10 @@
 
 #include <glib/gi18n-lib.h>
 
+#include "camel-debug.h"
 #include "camel-disco-diary.h"
 #include "camel-disco-folder.h"
 #include "camel-disco-store.h"
-#include "camel-exception.h"
 #include "camel-session.h"
 
 #define d(x)
@@ -43,14 +43,14 @@ disco_store_construct (CamelService *service,
                        CamelSession *session,
                        CamelProvider *provider,
                        CamelURL *url,
-                       CamelException *ex)
+                       GError **error)
 {
 	CamelServiceClass *service_class;
 	CamelDiscoStore *disco = CAMEL_DISCO_STORE (service);
 
 	/* Chain up to parent's construct() method. */
 	service_class = CAMEL_SERVICE_CLASS (camel_disco_store_parent_class);
-	if (!service_class->construct (service, session, provider, url, ex))
+	if (!service_class->construct (service, session, provider, url, error))
 		return FALSE;
 
 	disco->status = camel_session_get_online (session) ?
@@ -61,26 +61,27 @@ disco_store_construct (CamelService *service,
 
 static gboolean
 disco_store_connect (CamelService *service,
-                     CamelException *ex)
+                     GError **error)
 {
 	CamelDiscoStore *store = CAMEL_DISCO_STORE (service);
 	CamelDiscoStoreStatus status;
 	struct _CamelDiscoDiary *diary;
+	GError *local_error = NULL;
 
 	status = camel_disco_store_status (store);
 	if (status != CAMEL_DISCO_STORE_OFFLINE) {
-		if (!CAMEL_SERVICE_CLASS (camel_disco_store_parent_class)->connect (service, ex)) {
+		if (!CAMEL_SERVICE_CLASS (camel_disco_store_parent_class)->connect (service, error)) {
 			status = camel_disco_store_status (store);
 			if (status != CAMEL_DISCO_STORE_OFFLINE)
 				return FALSE;
-			camel_exception_clear (ex);
+			g_clear_error (error);
 		}
 	}
 
 	switch (status) {
 	case CAMEL_DISCO_STORE_ONLINE:
 	case CAMEL_DISCO_STORE_RESYNCING:
-		if (!CAMEL_DISCO_STORE_GET_CLASS (service)->connect_online (service, ex))
+		if (!CAMEL_DISCO_STORE_GET_CLASS (service)->connect_online (service, error))
 			return FALSE;
 
 		if (!store->diary)
@@ -94,18 +95,20 @@ disco_store_connect (CamelService *service,
 		   disconnect could be called, which will remove store->diary and unref it */
 		store->status = CAMEL_DISCO_STORE_RESYNCING;
 		diary = g_object_ref (store->diary);
-		camel_disco_diary_replay(diary, ex);
+		camel_disco_diary_replay(diary, &local_error);
 		g_object_unref (diary);
 		store->status = CAMEL_DISCO_STORE_ONLINE;
-		if (camel_exception_is_set (ex))
+		if (local_error != NULL) {
+			g_propagate_error (error, local_error);
 			return FALSE;
+		}
 
-		if (!camel_service_disconnect (service, TRUE, ex))
+		if (!camel_service_disconnect (service, TRUE, error))
 			return FALSE;
-		return camel_service_connect (service, ex);
+		return camel_service_connect (service, error);
 
 	case CAMEL_DISCO_STORE_OFFLINE:
-		return CAMEL_DISCO_STORE_GET_CLASS (service)->connect_offline (service, ex);
+		return CAMEL_DISCO_STORE_GET_CLASS (service)->connect_offline (service, error);
 	}
 
 	g_assert_not_reached ();
@@ -115,25 +118,25 @@ disco_store_connect (CamelService *service,
 static gboolean
 disco_store_disconnect (CamelService *service,
                         gboolean clean,
-                        CamelException *ex)
+                        GError **error)
 {
 	CamelDiscoStore *store = CAMEL_DISCO_STORE (service);
 
 	switch (camel_disco_store_status (store)) {
 	case CAMEL_DISCO_STORE_ONLINE:
 	case CAMEL_DISCO_STORE_RESYNCING:
-		if (!CAMEL_DISCO_STORE_GET_CLASS (service)->disconnect_online (service, clean, ex))
+		if (!CAMEL_DISCO_STORE_GET_CLASS (service)->disconnect_online (service, clean, error))
 			return FALSE;
 		break;
 
 	case CAMEL_DISCO_STORE_OFFLINE:
-		if (!CAMEL_DISCO_STORE_GET_CLASS (service)->disconnect_offline (service, clean, ex))
+		if (!CAMEL_DISCO_STORE_GET_CLASS (service)->disconnect_offline (service, clean, error))
 			return FALSE;
 		break;
 
 	}
 
-	return CAMEL_SERVICE_CLASS (camel_disco_store_parent_class)->disconnect (service, clean, ex);
+	return CAMEL_SERVICE_CLASS (camel_disco_store_parent_class)->disconnect (service, clean, error);
 }
 
 static void
@@ -150,10 +153,11 @@ static CamelFolder *
 disco_store_get_folder (CamelStore *store,
                         const gchar *name,
                         guint32 flags,
-                        CamelException *ex)
+                        GError **error)
 {
 	CamelDiscoStore *disco_store = CAMEL_DISCO_STORE (store);
 	CamelDiscoStoreClass *class;
+	CamelFolder *folder;
 
 	class = CAMEL_DISCO_STORE_GET_CLASS (disco_store);
 	g_return_val_if_fail (class->get_folder_online != NULL, NULL);
@@ -162,13 +166,19 @@ disco_store_get_folder (CamelStore *store,
 
 	switch (camel_disco_store_status (disco_store)) {
 	case CAMEL_DISCO_STORE_ONLINE:
-		return class->get_folder_online (store, name, flags, ex);
+		folder = class->get_folder_online (store, name, flags, error);
+		CAMEL_CHECK_GERROR (store, get_folder_online, folder != NULL, error);
+		return folder;
 
 	case CAMEL_DISCO_STORE_OFFLINE:
-		return class->get_folder_offline (store, name, flags, ex);
+		folder = class->get_folder_offline (store, name, flags, error);
+		CAMEL_CHECK_GERROR (store, get_folder_offline, folder != NULL, error);
+		return folder;
 
 	case CAMEL_DISCO_STORE_RESYNCING:
-		return class->get_folder_resyncing (store, name, flags, ex);
+		folder = class->get_folder_resyncing (store, name, flags, error);
+		CAMEL_CHECK_GERROR (store, get_folder_resyncing, folder != NULL, error);
+		return folder;
 	}
 
 	g_return_val_if_reached (NULL);
@@ -178,10 +188,11 @@ static CamelFolderInfo *
 disco_store_get_folder_info (CamelStore *store,
                              const gchar *top,
                              guint32 flags,
-                             CamelException *ex)
+                             GError **error)
 {
 	CamelDiscoStore *disco_store = CAMEL_DISCO_STORE (store);
 	CamelDiscoStoreClass *class;
+	CamelFolderInfo *info;
 
 	class = CAMEL_DISCO_STORE_GET_CLASS (disco_store);
 	g_return_val_if_fail (class->get_folder_info_online != NULL, NULL);
@@ -190,38 +201,42 @@ disco_store_get_folder_info (CamelStore *store,
 
 	switch (camel_disco_store_status (disco_store)) {
 	case CAMEL_DISCO_STORE_ONLINE:
-		return class->get_folder_info_online (store, top, flags, ex);
+		info = class->get_folder_info_online (store, top, flags, error);
+		CAMEL_CHECK_GERROR (store, get_folder_info_online, info != NULL, error);
+		return info;
 
 	case CAMEL_DISCO_STORE_OFFLINE:
 		/* Can't edit subscriptions while offline */
 		if ((store->flags & CAMEL_STORE_SUBSCRIPTIONS) &&
 		    !(flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED)) {
-			camel_disco_store_check_online (disco_store, ex);
+			camel_disco_store_check_online (disco_store, error);
 			return NULL;
 		}
 
-		return class->get_folder_info_offline (store, top, flags, ex);
+		info = class->get_folder_info_offline (store, top, flags, error);
+		CAMEL_CHECK_GERROR (store, get_folder_info_offline, info != NULL, error);
+		return info;
 
 	case CAMEL_DISCO_STORE_RESYNCING:
-		return class->get_folder_info_resyncing (store, top, flags, ex);
+		info = class->get_folder_info_resyncing (store, top, flags, error);
+		CAMEL_CHECK_GERROR (store, get_folder_info_resyncing, info != NULL, error);
+		return info;
 	}
 
 	g_return_val_if_reached (NULL);
 }
 
-static void
+static gboolean
 disco_store_set_status (CamelDiscoStore *disco_store,
                         CamelDiscoStoreStatus status,
-                        CamelException *ex)
+                        GError **error)
 {
-	CamelException x;
 	CamelService *service = CAMEL_SERVICE (disco_store);
 	gboolean network_available;
 
 	if (disco_store->status == status)
-		return;
+		return TRUE;
 
-	camel_exception_init(&x);
 	/* Sync the folder fully if we've been told to sync online for this store or this folder
 	   and we're going offline */
 
@@ -243,8 +258,7 @@ disco_store_set_status (CamelDiscoStore *disco_store,
 					folder = folders->pdata[i];
 					if (G_TYPE_CHECK_INSTANCE_TYPE(folder, CAMEL_TYPE_DISCO_FOLDER)
 					    && (sync || camel_disco_folder_get_offline_sync (CAMEL_DISCO_FOLDER (folder)))) {
-						camel_disco_folder_prepare_for_offline((CamelDiscoFolder *)folder, "", &x);
-						camel_exception_clear(&x);
+						camel_disco_folder_prepare_for_offline((CamelDiscoFolder *)folder, "", NULL);
 					}
 					g_object_unref (folder);
 				}
@@ -252,15 +266,15 @@ disco_store_set_status (CamelDiscoStore *disco_store,
 			}
 		}
 
-		camel_store_sync(CAMEL_STORE (disco_store), FALSE, &x);
-		camel_exception_clear(&x);
+		camel_store_sync(CAMEL_STORE (disco_store), FALSE, NULL);
 	}
 
-	if (!camel_service_disconnect (CAMEL_SERVICE (disco_store), network_available, ex))
-		return;
+	if (!camel_service_disconnect (CAMEL_SERVICE (disco_store), network_available, error))
+		return FALSE;
 
 	disco_store->status = status;
-	camel_service_connect (CAMEL_SERVICE (disco_store), ex);
+
+	return camel_service_connect (CAMEL_SERVICE (disco_store), error);
 }
 
 static void
@@ -311,24 +325,28 @@ camel_disco_store_status (CamelDiscoStore *store)
  * camel_disco_store_set_status:
  * @store: a disconnectable store
  * @status: the new status
- * @ex: a CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Sets @store to @status. If an error occurrs and the status cannot
  * be set to @status, @ex will be set.
  **/
-void
+gboolean
 camel_disco_store_set_status (CamelDiscoStore *store,
                               CamelDiscoStoreStatus status,
-                              CamelException *ex)
+                              GError **error)
 {
 	CamelDiscoStoreClass *class;
+	gboolean success;
 
-	g_return_if_fail (CAMEL_IS_DISCO_STORE (store));
+	g_return_val_if_fail (CAMEL_IS_DISCO_STORE (store), FALSE);
 
 	class = CAMEL_DISCO_STORE_GET_CLASS (store);
-	g_return_if_fail (class->set_status != NULL);
+	g_return_val_if_fail (class->set_status != NULL, FALSE);
+
+	success = class->set_status (store, status, error);
+	CAMEL_CHECK_GERROR (store, set_status, success, error);
 
-	class->set_status (store, status, ex);
+	return success;
 }
 
 /**
@@ -354,7 +372,7 @@ camel_disco_store_can_work_offline (CamelDiscoStore *store)
 /**
  * camel_disco_store_check_online:
  * @store: a disconnectable store
- * @ex: a CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * This checks that @store is online, and sets @ex if it is not. This
  * can be used as a simple way to set a generic error message in @ex
@@ -364,15 +382,16 @@ camel_disco_store_can_work_offline (CamelDiscoStore *store)
  **/
 gboolean
 camel_disco_store_check_online (CamelDiscoStore *store,
-                                CamelException *ex)
+                                GError **error)
 {
 	g_return_val_if_fail (CAMEL_IS_DISCO_STORE (store), FALSE);
 
 	if (camel_disco_store_status (store) == CAMEL_DISCO_STORE_ONLINE)
 		return TRUE;
 
-	camel_exception_set (
-		ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+	g_set_error (
+		error, CAMEL_SERVICE_ERROR,
+		CAMEL_SERVICE_ERROR_UNAVAILABLE,
 		_("You must be working online to complete this operation"));
 
 	return FALSE;
@@ -380,16 +399,14 @@ camel_disco_store_check_online (CamelDiscoStore *store,
 
 void
 camel_disco_store_prepare_for_offline (CamelDiscoStore *disco_store,
-                                       CamelException *ex)
+                                       GError **error)
 {
-	CamelException x;
 	CamelService *service;
 
 	g_return_if_fail (CAMEL_IS_DISCO_STORE (disco_store));
 
 	service = CAMEL_SERVICE (disco_store);
 
-	camel_exception_init(&x);
 	/* Sync the folder fully if we've been told to sync online for this store or this folder */
 
 	if (camel_session_get_network_available (service->session)) {
@@ -406,8 +423,7 @@ camel_disco_store_prepare_for_offline (CamelDiscoStore *disco_store,
 					folder = folders->pdata[i];
 					if (G_TYPE_CHECK_INSTANCE_TYPE(folder, CAMEL_TYPE_DISCO_FOLDER)
 					    && (sync || camel_disco_folder_get_offline_sync (CAMEL_DISCO_FOLDER (folder)))) {
-						camel_disco_folder_prepare_for_offline((CamelDiscoFolder *)folder, "(match-all)", &x);
-						camel_exception_clear(&x);
+						camel_disco_folder_prepare_for_offline((CamelDiscoFolder *)folder, "(match-all)", NULL);
 					}
 					g_object_unref (folder);
 				}
@@ -415,7 +431,6 @@ camel_disco_store_prepare_for_offline (CamelDiscoStore *disco_store,
 			}
 		}
 
-		camel_store_sync(CAMEL_STORE (disco_store), FALSE, &x);
-		camel_exception_clear(&x);
+		camel_store_sync(CAMEL_STORE (disco_store), FALSE, NULL);
 	}
 }
diff --git a/camel/camel-disco-store.h b/camel/camel-disco-store.h
index 609c02e..4a0a09e 100644
--- a/camel/camel-disco-store.h
+++ b/camel/camel-disco-store.h
@@ -74,60 +74,60 @@ struct _CamelDiscoStore {
 struct _CamelDiscoStoreClass {
 	CamelStoreClass parent_class;
 
-	void              (*set_status)              (CamelDiscoStore *,
+	gboolean          (*set_status)              (CamelDiscoStore *,
 						      CamelDiscoStoreStatus,
-						      CamelException *);
+						      GError **error);
 	gboolean          (*can_work_offline)        (CamelDiscoStore *);
 
 	gboolean          (*connect_online)          (CamelService *,
-						      CamelException *);
+						      GError **error);
 	gboolean          (*connect_offline)         (CamelService *,
-						      CamelException *);
+						      GError **error);
 
 	gboolean          (*disconnect_online)       (CamelService *, gboolean,
-						      CamelException *);
+						      GError **error);
 	gboolean          (*disconnect_offline)      (CamelService *, gboolean,
-						      CamelException *);
+						      GError **error);
 
 	CamelFolder *     (*get_folder_online)       (CamelStore *store,
 						      const gchar *name,
 						      guint32 flags,
-						      CamelException *ex);
+						      GError **error);
 	CamelFolder *     (*get_folder_offline)      (CamelStore *store,
 						      const gchar *name,
 						      guint32 flags,
-						      CamelException *ex);
+						      GError **error);
 	CamelFolder *     (*get_folder_resyncing)    (CamelStore *store,
 						      const gchar *name,
 						      guint32 flags,
-						      CamelException *ex);
+						      GError **error);
 
 	CamelFolderInfo * (*get_folder_info_online)    (CamelStore *store,
 							const gchar *top,
 							guint32 flags,
-							CamelException *ex);
+							GError **error);
 	CamelFolderInfo * (*get_folder_info_offline)   (CamelStore *store,
 							const gchar *top,
 							guint32 flags,
-							CamelException *ex);
+							GError **error);
 	CamelFolderInfo * (*get_folder_info_resyncing) (CamelStore *store,
 							const gchar *top,
 							guint32 flags,
-							CamelException *ex);
+							GError **error);
 };
 
 GType camel_disco_store_get_type (void);
 
 /* Public methods */
 CamelDiscoStoreStatus camel_disco_store_status           (CamelDiscoStore *store);
-void                  camel_disco_store_set_status       (CamelDiscoStore *store,
+gboolean              camel_disco_store_set_status       (CamelDiscoStore *store,
 							  CamelDiscoStoreStatus status,
-							  CamelException *ex);
+							  GError **error);
 gboolean              camel_disco_store_can_work_offline (CamelDiscoStore *store);
 
 /* Convenience functions */
-gboolean camel_disco_store_check_online (CamelDiscoStore *store, CamelException *ex);
-void camel_disco_store_prepare_for_offline(CamelDiscoStore *store, CamelException *ex);
+gboolean camel_disco_store_check_online (CamelDiscoStore *store, GError **error);
+void camel_disco_store_prepare_for_offline(CamelDiscoStore *store, GError **error);
 
 G_END_DECLS
 
diff --git a/camel/camel-file-utils.c b/camel/camel-file-utils.c
index b51d370..09e9f85 100644
--- a/camel/camel-file-utils.c
+++ b/camel/camel-file-utils.c
@@ -33,7 +33,10 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#include <glib/gi18n-lib.h>
+
 #include "camel-file-utils.h"
+#include "camel-object.h"
 #include "camel-operation.h"
 #include "camel-url.h"
 
@@ -400,6 +403,7 @@ camel_file_util_safe_filename (const gchar *name)
  * @fd: file descriptor
  * @buf: buffer to fill
  * @n: number of bytes to read into @buf
+ * @error: return location for a #GError, or %NULL
  *
  * Cancellable libc read() replacement.
  *
@@ -412,15 +416,21 @@ camel_file_util_safe_filename (const gchar *name)
 gssize
 camel_read (gint fd,
             gchar *buf,
-            gsize n)
+            gsize n,
+            GError **error)
 {
 	gssize nread;
 	gint cancel_fd;
 
 	if (camel_operation_cancel_check (NULL)) {
 		errno = EINTR;
+		g_set_error (
+			error, G_IO_ERROR,
+			G_IO_ERROR_CANCELLED,
+			_("Cancelled"));
 		return -1;
 	}
+
 #ifndef G_OS_WIN32
 	cancel_fd = camel_operation_cancel_fd (NULL);
 #else
@@ -471,6 +481,19 @@ camel_read (gint fd,
 #endif
 	}
 
+	if (nread == -1) {
+		if (errno == EINTR)
+			g_set_error (
+				error, G_IO_ERROR,
+				G_IO_ERROR_CANCELLED,
+				_("Cancelled"));
+		else
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
+				"%s", g_strerror (errno));
+	}
+
 	return nread;
 }
 
@@ -479,6 +502,7 @@ camel_read (gint fd,
  * @fd: file descriptor
  * @buf: buffer to write
  * @n: number of bytes of @buf to write
+ * @error: return location for a #GError, or %NULL
  *
  * Cancellable libc write() replacement.
  *
@@ -491,15 +515,21 @@ camel_read (gint fd,
 gssize
 camel_write (gint fd,
              const gchar *buf,
-             gsize n)
+             gsize n,
+             GError **error)
 {
 	gssize w, written = 0;
 	gint cancel_fd;
 
 	if (camel_operation_cancel_check (NULL)) {
 		errno = EINTR;
+		g_set_error (
+			error, G_IO_ERROR,
+			G_IO_ERROR_CANCELLED,
+			_("Cancelled"));
 		return -1;
 	}
+
 #ifndef G_OS_WIN32
 	cancel_fd = camel_operation_cancel_fd (NULL);
 #else
@@ -561,8 +591,19 @@ camel_write (gint fd,
 #endif
 	}
 
-	if (w == -1)
+	if (w == -1) {
+		if (errno == EINTR)
+			g_set_error (
+				error, G_IO_ERROR,
+				G_IO_ERROR_CANCELLED,
+				_("Cancelled"));
+		else
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
+				"%s", g_strerror (errno));
 		return -1;
+	}
 
 	return written;
 }
@@ -572,6 +613,7 @@ camel_write (gint fd,
  * @fd: a socket
  * @buf: buffer to fill
  * @n: number of bytes to read into @buf
+ * @error: return location for a #GError, or %NULL
  *
  * Cancellable read() replacement for sockets. Code that intends to be
  * portable to Win32 should call this function only on sockets
@@ -584,16 +626,21 @@ camel_write (gint fd,
 gssize
 camel_read_socket (gint fd,
                    gchar *buf,
-                   gsize n)
+                   gsize n,
+                   GError **error)
 {
 #ifndef G_OS_WIN32
-	return camel_read (fd, buf, n);
+	return camel_read (fd, buf, n, error);
 #else
 	gssize nread;
 	gint cancel_fd;
 
 	if (camel_operation_cancel_check (NULL)) {
 		errno = EINTR;
+		g_set_error (
+			error, G_IO_ERROR,
+			G_IO_ERROR_CANCELLED,
+			_("Canceled"));
 		return -1;
 	}
 	cancel_fd = camel_operation_cancel_fd (NULL);
@@ -636,6 +683,19 @@ camel_read_socket (gint fd,
 		;
 	}
 
+	if (nread == -1) {
+		if (errno == EINTR)
+			g_set_error (
+				error, G_IO_ERROR,
+				G_IO_ERROR_CANCELLED,
+				_("Cancelled"));
+		else
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
+				"%s", g_strerror (errno));
+	}
+
 	return nread;
 #endif
 }
@@ -645,6 +705,7 @@ camel_read_socket (gint fd,
  * @fd: file descriptor
  * @buf: buffer to write
  * @n: number of bytes of @buf to write
+ * @error: return location for a #GError, or %NULL
  *
  * Cancellable write() replacement for sockets. Code that intends to
  * be portable to Win32 should call this function only on sockets
@@ -656,16 +717,21 @@ camel_read_socket (gint fd,
 gssize
 camel_write_socket (gint fd,
                     const gchar *buf,
-                    gsize n)
+                    gsize n,
+                    GError **error)
 {
 #ifndef G_OS_WIN32
-	return camel_write (fd, buf, n);
+	return camel_write (fd, buf, n, error);
 #else
 	gssize w, written = 0;
 	gint cancel_fd;
 
 	if (camel_operation_cancel_check (NULL)) {
 		errno = EINTR;
+		g_set_error (
+			error, G_IO_ERROR,
+			G_IO_ERROR_CANCELLED,
+			_("Canceled"));
 		return -1;
 	}
 
@@ -717,8 +783,19 @@ camel_write_socket (gint fd,
 		ioctlsocket (fd, FIONBIO, &arg);
 	}
 
-	if (w == -1)
+	if (w == -1) {
+		if (errno == EINTR)
+			g_set_error (
+				error, G_IO_ERROR,
+				G_IO_ERROR_CANCELLED,
+				_("Canceled"));
+		else
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
+				"%s", g_strerror (errno));
 		return -1;
+	}
 
 	return written;
 #endif
diff --git a/camel/camel-file-utils.h b/camel/camel-file-utils.h
index 4340a47..9459dd1 100644
--- a/camel/camel-file-utils.h
+++ b/camel/camel-file-utils.h
@@ -66,11 +66,11 @@ gchar *camel_file_util_safe_filename (const gchar *name);
  * camel_read_socket() and camel_write_socket(). These are cancellable
  * also on Win32.
  */
-gssize camel_read (gint fd, gchar *buf, gsize n);
-gssize camel_write (gint fd, const gchar *buf, gsize n);
+gssize camel_read (gint fd, gchar *buf, gsize n, GError **error);
+gssize camel_write (gint fd, const gchar *buf, gsize n, GError **error);
 
-gssize camel_read_socket (gint fd, gchar *buf, gsize n);
-gssize camel_write_socket (gint fd, const gchar *buf, gsize n);
+gssize camel_read_socket (gint fd, gchar *buf, gsize n, GError **error);
+gssize camel_write_socket (gint fd, const gchar *buf, gsize n, GError **error);
 
 gchar *camel_file_util_savename(const gchar *filename);
 
diff --git a/camel/camel-filter-driver.c b/camel/camel-filter-driver.c
index d549493..b52a561 100644
--- a/camel/camel-filter-driver.c
+++ b/camel/camel-filter-driver.c
@@ -121,7 +121,7 @@ struct _CamelFilterDriverPrivate {
 
 	CamelDList rules;		   /* list of _filter_rule structs */
 
-	CamelException *ex;
+	GError *error;
 
 	/* evaluator */
 	ESExp *eval;
@@ -465,12 +465,12 @@ do_forward_to (struct _ESExp *f, gint argc, struct _ESExpResult **argv, CamelFil
 
 	/* make sure we have the message... */
 	if (p->message == NULL) {
-		if (!(p->message = camel_folder_get_message (p->source, p->uid, p->ex)))
+		if (!(p->message = camel_folder_get_message (p->source, p->uid, &p->error)))
 			return NULL;
 	}
 
 	camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Forward message to '%s'", argv[0]->value.string);
-	camel_session_forward_to (p->session, p->source, p->message, argv[0]->value.string, p->ex);
+	camel_session_forward_to (p->session, p->source, p->message, argv[0]->value.string, &p->error);
 
 	return NULL;
 }
@@ -501,19 +501,19 @@ do_copy (struct _ESExp *f, gint argc, struct _ESExpResult **argv, CamelFilterDri
 
 				uids = g_ptr_array_new ();
 				g_ptr_array_add (uids, (gchar *) p->uid);
-				camel_folder_transfer_messages_to (p->source, uids, outbox, NULL, FALSE, p->ex);
+				camel_folder_transfer_messages_to (p->source, uids, outbox, NULL, FALSE, &p->error);
 				g_ptr_array_free (uids, TRUE);
 			} else {
 				if (p->message == NULL)
-					p->message = camel_folder_get_message (p->source, p->uid, p->ex);
+					p->message = camel_folder_get_message (p->source, p->uid, &p->error);
 
 				if (!p->message)
 					continue;
 
-				camel_folder_append_message (outbox, p->message, p->info, NULL, p->ex);
+				camel_folder_append_message (outbox, p->message, p->info, NULL, &p->error);
 			}
 
-			if (!camel_exception_is_set (p->ex))
+			if (p->error == NULL)
 				p->copied = TRUE;
 
 			camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Copy to folder %s",
@@ -554,18 +554,23 @@ do_move (struct _ESExp *f, gint argc, struct _ESExpResult **argv, CamelFilterDri
 
 				uids = g_ptr_array_new ();
 				g_ptr_array_add (uids, (gchar *) p->uid);
-				camel_folder_transfer_messages_to (p->source, uids, outbox, NULL, last, p->ex);
+				camel_folder_transfer_messages_to (
+					p->source, uids, outbox, NULL,
+					last, &p->error);
 				g_ptr_array_free (uids, TRUE);
 			} else {
 				if (p->message == NULL)
-					p->message = camel_folder_get_message (p->source, p->uid, p->ex);
+					p->message = camel_folder_get_message (
+						p->source, p->uid, &p->error);
 
 				if (!p->message)
 					continue;
 
-				camel_folder_append_message (outbox, p->message, p->info, NULL, p->ex);
+				camel_folder_append_message (
+					outbox, p->message, p->info,
+					NULL, &p->error);
 
-				if (!camel_exception_is_set(p->ex) && last) {
+				if (p->error == NULL && last) {
 					if (p->source && p->uid && camel_folder_has_summary_capability (p->source))
 						camel_folder_set_message_flags(p->source, p->uid, CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_SEEN, ~0);
 					else
@@ -573,7 +578,7 @@ do_move (struct _ESExp *f, gint argc, struct _ESExpResult **argv, CamelFilterDri
 				}
 			}
 
-			if (!camel_exception_is_set (p->ex)) {
+			if (p->error == NULL) {
 				p->moved = TRUE;
 				camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Move to folder %s", folder);
 			}
@@ -774,7 +779,7 @@ pipe_to_system (struct _ESExp *f, gint argc, struct _ESExpResult **argv, CamelFi
 
 	/* make sure we have the message... */
 	if (p->message == NULL) {
-		if (!(p->message = camel_folder_get_message (p->source, p->uid, p->ex)))
+		if (!(p->message = camel_folder_get_message (p->source, p->uid, &p->error)))
 			return -1;
 	}
 
@@ -798,8 +803,8 @@ pipe_to_system (struct _ESExp *f, gint argc, struct _ESExpResult **argv, CamelFi
 				       &error)) {
 		g_ptr_array_free (args, TRUE);
 
-		camel_exception_setv (
-			p->ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			&p->error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Failed to create child process '%s': %s"),
 			argv[0]->value.string, error->message);
 		g_error_free (error);
@@ -809,13 +814,13 @@ pipe_to_system (struct _ESExp *f, gint argc, struct _ESExpResult **argv, CamelFi
 	g_ptr_array_free (args, TRUE);
 
 	stream = camel_stream_fs_new_with_fd (pipe_to_child);
-	if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (p->message), stream) == -1) {
+	if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (p->message), stream, NULL) == -1) {
 		g_object_unref (stream);
 		close (pipe_from_child);
 		goto wait;
 	}
 
-	if (camel_stream_flush (stream) == -1) {
+	if (camel_stream_flush (stream, NULL) == -1) {
 		g_object_unref (stream);
 		close (pipe_from_child);
 		goto wait;
@@ -825,27 +830,28 @@ pipe_to_system (struct _ESExp *f, gint argc, struct _ESExpResult **argv, CamelFi
 
 	stream = camel_stream_fs_new_with_fd (pipe_from_child);
 	mem = camel_stream_mem_new ();
-	if (camel_stream_write_to_stream (stream, mem) == -1) {
+	if (camel_stream_write_to_stream (stream, mem, NULL) == -1) {
 		g_object_unref (stream);
 		g_object_unref (mem);
 		goto wait;
 	}
 
 	g_object_unref (stream);
-	camel_stream_reset (mem);
+	camel_stream_reset (mem, NULL);
 
 	parser = camel_mime_parser_new ();
-	camel_mime_parser_init_with_stream (parser, mem);
+	camel_mime_parser_init_with_stream (parser, mem, NULL);
 	camel_mime_parser_scan_from (parser, FALSE);
 	g_object_unref (mem);
 
 	message = camel_mime_message_new ();
-	if (camel_mime_part_construct_from_parser ((CamelMimePart *) message, parser) == -1) {
-		camel_exception_setv (
-			p->ex, CAMEL_EXCEPTION_SYSTEM,
+	if (camel_mime_part_construct_from_parser ((CamelMimePart *) message, parser, NULL) == -1) {
+		gint err = camel_mime_parser_errno (parser);
+		g_set_error (
+			&p->error, G_IO_ERROR,
+			g_io_error_from_errno (err),
 			_("Invalid message stream received from %s: %s"),
-			argv[0]->value.string,
-			g_strerror (camel_mime_parser_errno (parser)));
+			argv[0]->value.string, g_strerror (err));
 		g_object_unref (message);
 		message = NULL;
 	} else {
@@ -997,13 +1003,9 @@ open_folder (CamelFilterDriver *driver, const gchar *folder_url)
 	   in duplicate mails, just mail going to inbox.  Otherwise,
 	   we want to know about exceptions and abort processing */
 	if (p->defaultfolder) {
-		CamelException ex;
-
-		camel_exception_init (&ex);
-		camelfolder = p->get_folder (driver, folder_url, p->data, &ex);
-		camel_exception_clear (&ex);
+		camelfolder = p->get_folder (driver, folder_url, p->data, NULL);
 	} else {
-		camelfolder = p->get_folder (driver, folder_url, p->data, p->ex);
+		camelfolder = p->get_folder (driver, folder_url, p->data, &p->error);
 	}
 
 	if (camelfolder) {
@@ -1027,7 +1029,7 @@ close_folder (gpointer key, gpointer value, gpointer data)
 	g_free (key);
 
 	if (folder != FOLDER_INVALID) {
-		camel_folder_sync (folder, FALSE, camel_exception_is_set(p->ex)?NULL : p->ex);
+		camel_folder_sync (folder, FALSE, (p->error != NULL) ? NULL : &p->error);
 		camel_folder_thaw (folder);
 		g_object_unref (folder);
 	}
@@ -1112,23 +1114,23 @@ camel_filter_driver_log (CamelFilterDriver *driver, enum filter_log_t status, co
 
 struct _run_only_once {
 	CamelFilterDriver *driver;
-	CamelException *ex;
+	GError *error;
 };
 
 static gboolean
 run_only_once (gpointer key, gchar *action, struct _run_only_once *data)
 {
 	struct _CamelFilterDriverPrivate *p = CAMEL_FILTER_DRIVER_GET_PRIVATE (data->driver);
-	CamelException *ex = data->ex;
 	ESExpResult *r;
 
 	d(printf ("evaluating: %s\n\n", action));
 
 	e_sexp_input_text (p->eval, action, strlen (action));
 	if (e_sexp_parse (p->eval) == -1) {
-		if (!camel_exception_is_set (ex))
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+		if (data->error == NULL)
+			g_set_error (
+				&data->error,
+				CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Error parsing filter: %s: %s"),
 				e_sexp_error (p->eval), action);
 		goto done;
@@ -1136,9 +1138,10 @@ run_only_once (gpointer key, gchar *action, struct _run_only_once *data)
 
 	r = e_sexp_eval (p->eval);
 	if (r == NULL) {
-		if (!camel_exception_is_set (ex))
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+		if (data->error == NULL)
+			g_set_error (
+				&data->error,
+				CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Error executing filter: %s: %s"),
 				e_sexp_error (p->eval), action);
 		goto done;
@@ -1157,13 +1160,13 @@ run_only_once (gpointer key, gchar *action, struct _run_only_once *data)
 /**
  * camel_filter_driver_flush:
  * @driver:
- * @ex:
+ * @error: return location for a #GError, or %NULL
  *
  * Flush all of the only-once filter actions.
  **/
 void
 camel_filter_driver_flush (CamelFilterDriver *driver,
-                           CamelException *ex)
+                           GError **error)
 {
 	struct _CamelFilterDriverPrivate *p = CAMEL_FILTER_DRIVER_GET_PRIVATE (driver);
 	struct _run_only_once data;
@@ -1172,9 +1175,11 @@ camel_filter_driver_flush (CamelFilterDriver *driver,
 		return;
 
 	data.driver = driver;
-	data.ex = ex;
+	data.error = NULL;
 
 	g_hash_table_foreach_remove (p->only_once, (GHRFunc) run_only_once, &data);
+
+	g_propagate_error (error, data.error);
 }
 
 static gint
@@ -1201,7 +1206,7 @@ decode_flags_from_xev(const gchar *xev, CamelMessageInfoBase *mi)
  * @driver: CamelFilterDriver
  * @mbox: mbox filename to be filtered
  * @original_source_url:
- * @ex: exception
+ * @error: return location for a #GError, or %NULL
  *
  * Filters an mbox file based on rules defined in the FilterDriver
  * object. Is more efficient as it doesn't need to open the folder
@@ -1215,7 +1220,7 @@ gint
 camel_filter_driver_filter_mbox (CamelFilterDriver *driver,
                                  const gchar *mbox,
                                  const gchar *original_source_url,
-                                 CamelException *ex)
+                                 GError **error)
 {
 	struct _CamelFilterDriverPrivate *p = CAMEL_FILTER_DRIVER_GET_PRIVATE (driver);
 	CamelMimeParser *mp = NULL;
@@ -1229,8 +1234,8 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver,
 
 	fd = g_open (mbox, O_RDONLY|O_BINARY, 0);
 	if (fd == -1) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Unable to open spool folder"));
 		goto fail;
 	}
@@ -1240,8 +1245,8 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver,
 	mp = camel_mime_parser_new ();
 	camel_mime_parser_scan_from (mp, TRUE);
 	if (camel_mime_parser_init_with_fd (mp, fd) == -1) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Unable to process spool folder"));
 		goto fail;
 	}
@@ -1255,6 +1260,7 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver,
 		CamelMimePart *mime_part;
 		gint pc = 0;
 		const gchar *xev;
+		GError *local_error = NULL;
 
 		if (st.st_size > 0)
 			pc = (gint)(100.0 * ((double)camel_mime_parser_tell (mp) / (double)st.st_size));
@@ -1264,8 +1270,7 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver,
 		message = camel_mime_message_new ();
 		mime_part = CAMEL_MIME_PART (message);
 
-		if (camel_mime_part_construct_from_parser (mime_part, mp) == -1) {
-			camel_exception_set (ex, (errno==EINTR)?CAMEL_EXCEPTION_USER_CANCEL:CAMEL_EXCEPTION_SYSTEM, _("Cannot open message"));
+		if (camel_mime_part_construct_from_parser (mime_part, mp, error) == -1) {
 			report_status (driver, CAMEL_FILTER_STATUS_END, 100, _("Failed on message %d"), i);
 			g_object_unref (message);
 			goto fail;
@@ -1282,13 +1287,15 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver,
 		last = camel_mime_parser_tell(mp);
 		status = camel_filter_driver_filter_message (
 			driver, message, info, NULL, NULL, source_url,
-			original_source_url ? original_source_url : source_url, ex);
+			original_source_url ? original_source_url : source_url,
+			&local_error);
 		g_object_unref (message);
-		if (camel_exception_is_set (ex) || status == -1) {
+		if (local_error != NULL || status == -1) {
 			report_status (
 				driver, CAMEL_FILTER_STATUS_END, 100,
 				_("Failed on message %d"), i);
 			camel_message_info_free (info);
+			g_propagate_error (error, local_error);
 			goto fail;
 		}
 
@@ -1302,7 +1309,7 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver,
 
 	if (p->defaultfolder) {
 		report_status(driver, CAMEL_FILTER_STATUS_PROGRESS, 100, _("Syncing folder"));
-		camel_folder_sync(p->defaultfolder, FALSE, camel_exception_is_set (ex) ? NULL : ex);
+		camel_folder_sync(p->defaultfolder, FALSE, NULL);
 	}
 
 	report_status (driver, CAMEL_FILTER_STATUS_END, 100, _("Complete"));
@@ -1325,7 +1332,7 @@ fail:
  * @cache: UID cache (needed for POP folders)
  * @uids: message uids to be filtered or NULL (as a shortcut to filter all messages)
  * @remove: TRUE to mark filtered messages as deleted
- * @ex: exception
+ * @error: return location for a #GError, or %NULL
  *
  * Filters a folder based on rules defined in the FilterDriver
  * object.
@@ -1340,7 +1347,7 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver,
                                    CamelUIDCache *cache,
                                    GPtrArray *uids,
                                    gboolean remove,
-                                   CamelException *ex)
+                                   GError **error)
 {
 	struct _CamelFilterDriverPrivate *p = CAMEL_FILTER_DRIVER_GET_PRIVATE (driver);
 	gboolean freeuids = FALSE;
@@ -1364,6 +1371,7 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver,
 
 	for (i = 0; i < uids->len; i++) {
 		gint pc = (100 * i)/uids->len;
+		GError *local_error = NULL;
 
 		report_status (driver, CAMEL_FILTER_STATUS_START, pc, _("Getting message %d of %d"), i+1,
 			       uids->len);
@@ -1375,16 +1383,17 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver,
 
 		status = camel_filter_driver_filter_message (
 			driver, NULL, info, uids->pdata[i],
-			folder, source_url, source_url, ex);
+			folder, source_url, source_url, &local_error);
 
 		if (camel_folder_has_summary_capability (folder))
 			camel_folder_free_message_info (folder, info);
 
-		if (camel_exception_is_set (ex) || status == -1) {
+		if (local_error != NULL || status == -1) {
 			report_status (
 				driver, CAMEL_FILTER_STATUS_END, 100,
 				_("Failed at message %d of %d"),
 				i+1, uids->len);
+			g_propagate_error (error, local_error);
 			status = -1;
 			break;
 		}
@@ -1399,7 +1408,7 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver,
 
 	if (p->defaultfolder) {
 		report_status (driver, CAMEL_FILTER_STATUS_PROGRESS, 100, _("Syncing folder"));
-		camel_folder_sync (p->defaultfolder, FALSE, camel_exception_is_set (ex) ? NULL : ex);
+		camel_folder_sync (p->defaultfolder, FALSE, NULL);
 	}
 
 	if (i == uids->len)
@@ -1419,7 +1428,7 @@ struct _get_message {
 };
 
 static CamelMimeMessage *
-get_message_cb (gpointer data, CamelException *ex)
+get_message_cb (gpointer data, GError **error)
 {
 	struct _get_message *msgdata = data;
 	struct _CamelFilterDriverPrivate *p = msgdata->p;
@@ -1436,7 +1445,7 @@ get_message_cb (gpointer data, CamelException *ex)
 		else
 			uid = camel_message_info_uid (p->info);
 
-		message = camel_folder_get_message (p->source, uid, ex);
+		message = camel_folder_get_message (p->source, uid, error);
 	}
 
 	if (source_url && message && camel_mime_message_get_source (message) == NULL)
@@ -1454,7 +1463,7 @@ get_message_cb (gpointer data, CamelException *ex)
  * @source: source folder or NULL
  * @source_url: url of source folder or NULL
  * @original_source_url: url of original source folder (pre-movemail) or NULL
- * @ex: exception
+ * @error: return location for a #GError, or %NULL
  *
  * Filters a message based on rules defined in the FilterDriver
  * object. If the source folder (@source) and the uid (@uid) are
@@ -1474,7 +1483,7 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver,
                                     CamelFolder *source,
                                     const gchar *source_url,
                                     const gchar *original_source_url,
-                                    CamelException *ex)
+                                    GError **error)
 {
 	struct _CamelFilterDriverPrivate *p = CAMEL_FILTER_DRIVER_GET_PRIVATE (driver);
 	struct _filter_rule *node;
@@ -1495,7 +1504,7 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver,
 		if (message) {
 			g_object_ref (message);
 		} else {
-			message = camel_folder_get_message (source, uid, ex);
+			message = camel_folder_get_message (source, uid, error);
 			if (!message)
 				return -1;
 		}
@@ -1513,7 +1522,6 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver,
 			g_object_ref (message);
 	}
 
-	p->ex = ex;
 	p->terminated = FALSE;
 	p->deleted = FALSE;
 	p->copied = FALSE;
@@ -1539,7 +1547,7 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver,
 		result = camel_filter_search_match (
 			p->session, get_message_cb, &data, p->info,
 			original_source_url ? original_source_url : source_url,
-			node->match, p->ex);
+			node->match, &p->error);
 
 		switch (result) {
 		case CAMEL_SEARCH_ERROR:
@@ -1555,18 +1563,20 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver,
 			/* perform necessary filtering actions */
 			e_sexp_input_text (p->eval, node->action, strlen (node->action));
 			if (e_sexp_parse (p->eval) == -1) {
-				camel_exception_setv (
-					ex, 1, _("Error parsing filter: %s: %s"),
+				g_set_error (
+					error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+					_("Error parsing filter: %s: %s"),
 					e_sexp_error (p->eval), node->action);
 				goto error;
 			}
 			r = e_sexp_eval (p->eval);
-			if (camel_exception_is_set(p->ex))
+			if (p->error != NULL)
 				goto error;
 
 			if (r == NULL) {
-				camel_exception_setv (
-					ex, 1, _("Error executing filter: %s: %s"),
+				g_set_error (
+					error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+					_("Error executing filter: %s: %s"),
 					e_sexp_error (p->eval), node->action);
 				goto error;
 			}
@@ -1604,18 +1614,18 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver,
 			g_ptr_array_add (uids, (gchar *) p->uid);
 			camel_folder_transfer_messages_to (
 				p->source, uids, p->defaultfolder,
-				NULL, FALSE, p->ex);
+				NULL, FALSE, &p->error);
 			g_ptr_array_free (uids, TRUE);
 		} else {
 			if (p->message == NULL) {
-				p->message = camel_folder_get_message (source, uid, ex);
+				p->message = camel_folder_get_message (source, uid, error);
 				if (!p->message)
 					goto error;
 			}
 
 			camel_folder_append_message (
 				p->defaultfolder, p->message,
-				p->info, NULL, p->ex);
+				p->info, NULL, &p->error);
 		}
 	}
 
@@ -1637,5 +1647,8 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver,
 	if (freeinfo)
 		camel_message_info_free (info);
 
+	g_propagate_error (error, p->error);
+	p->error = NULL;
+
 	return -1;
 }
diff --git a/camel/camel-filter-driver.h b/camel/camel-filter-driver.h
index 53e0aca..a161a17 100644
--- a/camel/camel-filter-driver.h
+++ b/camel/camel-filter-driver.h
@@ -76,7 +76,7 @@ enum camel_filter_status_t {
 };
 
 typedef CamelFolder * (*CamelFilterGetFolderFunc) (CamelFilterDriver *driver, const gchar *uri,
-						   gpointer data, CamelException *ex);
+						   gpointer data, GError **error);
 /* report status */
 typedef void (CamelFilterStatusFunc) (CamelFilterDriver *driver, enum camel_filter_status_t status,
 				      gint pc, const gchar *desc, gpointer data);
@@ -105,18 +105,18 @@ gint  camel_filter_driver_remove_rule_by_name  (CamelFilterDriver *d, const gcha
 
 /*void camel_filter_driver_set_global(CamelFilterDriver *, const gchar *name, const gchar *value);*/
 
-void camel_filter_driver_flush                (CamelFilterDriver *driver, CamelException *ex);
+void camel_filter_driver_flush                (CamelFilterDriver *driver, GError **error);
 
 gint  camel_filter_driver_filter_message       (CamelFilterDriver *driver, CamelMimeMessage *message,
 					       CamelMessageInfo *info, const gchar *uid,
 					       CamelFolder *source, const gchar *source_url,
-					       const gchar *original_source_url, CamelException *ex);
+					       const gchar *original_source_url, GError **error);
 
 gint  camel_filter_driver_filter_mbox          (CamelFilterDriver *driver, const gchar *mbox,
-					       const gchar *original_source_url, CamelException *ex);
+					       const gchar *original_source_url, GError **error);
 
 gint  camel_filter_driver_filter_folder        (CamelFilterDriver *driver, CamelFolder *folder, CamelUIDCache *cache,
-					       GPtrArray *uids, gboolean remove, CamelException *ex);
+					       GPtrArray *uids, gboolean remove, GError **error);
 
 G_END_DECLS
 
diff --git a/camel/camel-filter-search.c b/camel/camel-filter-search.c
index 85d7c22..8f4ed98 100644
--- a/camel/camel-filter-search.c
+++ b/camel/camel-filter-search.c
@@ -46,7 +46,6 @@
 #include <libedataserver/e-sexp.h>
 
 #include "camel-debug.h"
-#include "camel-exception.h"
 #include "camel-filter-search.h"
 #include "camel-iconv.h"
 #include "camel-mime-message.h"
@@ -68,7 +67,7 @@ typedef struct {
 	CamelMimeMessage *message;
 	CamelMessageInfo *info;
 	const gchar *source;
-	CamelException *ex;
+	GError **error;
 } FilterMessageSearch;
 
 /* ESExp callbacks */
@@ -130,7 +129,7 @@ camel_filter_search_get_message (FilterMessageSearch *fms, struct _ESExp *sexp)
 	if (fms->message)
 		return fms->message;
 
-	fms->message = fms->get_message (fms->get_message_data, fms->ex);
+	fms->message = fms->get_message (fms->get_message_data, fms->error);
 
 	if (fms->message == NULL)
 		e_sexp_fatal_error (sexp, _("Failed to retrieve message"));
@@ -263,7 +262,7 @@ header_regex (struct _ESExp *f, gint argc, struct _ESExpResult **argv, FilterMes
 
 	if (argc > 1 && argv[0]->type == ESEXP_RES_STRING
 	    && (contents = camel_medium_get_header (CAMEL_MEDIUM (message), argv[0]->value.string))
-	    && camel_search_build_match_regex(&pattern, CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_ICASE, argc-1, argv+1, fms->ex) == 0) {
+	    && camel_search_build_match_regex(&pattern, CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_ICASE, argc-1, argv+1, fms->error) == 0) {
 		r->value.boolean = regexec (&pattern, contents, 0, NULL, 0) == 0;
 		regfree (&pattern);
 	} else
@@ -309,7 +308,7 @@ header_full_regex (struct _ESExp *f, gint argc, struct _ESExpResult **argv, Filt
 	gchar *contents;
 
 	if (camel_search_build_match_regex(&pattern, CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_ICASE|CAMEL_SEARCH_MATCH_NEWLINE,
-					   argc, argv, fms->ex) == 0) {
+					   argc, argv, fms->error) == 0) {
 		message = camel_filter_search_get_message (fms, f);
 		contents = get_full_header (message);
 		r->value.boolean = regexec (&pattern, contents, 0, NULL, 0) == 0;
@@ -343,7 +342,7 @@ body_contains (struct _ESExp *f, gint argc, struct _ESExpResult **argv, FilterMe
 	CamelMimeMessage *message;
 	regex_t pattern;
 
-	if (camel_search_build_match_regex (&pattern, CAMEL_SEARCH_MATCH_ICASE, argc, argv, fms->ex) == 0) {
+	if (camel_search_build_match_regex (&pattern, CAMEL_SEARCH_MATCH_ICASE, argc, argv, fms->error) == 0) {
 		message = camel_filter_search_get_message (fms, f);
 		r->value.boolean = camel_search_message_body_contains ((CamelDataWrapper *) message, &pattern);
 		regfree (&pattern);
@@ -361,7 +360,7 @@ body_regex (struct _ESExp *f, gint argc, struct _ESExpResult **argv, FilterMessa
 	regex_t pattern;
 
 	if (camel_search_build_match_regex(&pattern, CAMEL_SEARCH_MATCH_ICASE|CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_NEWLINE,
-					   argc, argv, fms->ex) == 0) {
+					   argc, argv, fms->error) == 0) {
 		message = camel_filter_search_get_message (fms, f);
 		r->value.boolean = camel_search_message_body_contains ((CamelDataWrapper *) message, &pattern);
 		regfree (&pattern);
@@ -578,8 +577,8 @@ run_command (struct _ESExp *f, gint argc, struct _ESExpResult **argv, FilterMess
 				       &error)) {
 		g_ptr_array_free (args, TRUE);
 
-		camel_exception_setv (
-			fms->ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			fms->error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Failed to create child process '%s': %s"),
 			argv[0]->value.string, error->message);
 		g_error_free (error);
@@ -592,8 +591,8 @@ run_command (struct _ESExp *f, gint argc, struct _ESExpResult **argv, FilterMess
 
 	stream = camel_stream_fs_new_with_fd (pipe_to_child);
 	camel_data_wrapper_write_to_stream (
-		CAMEL_DATA_WRAPPER (message), stream);
-	camel_stream_flush (stream);
+		CAMEL_DATA_WRAPPER (message), stream, NULL);
+	camel_stream_flush (stream, NULL);
 	g_object_unref (stream);
 
 	context = g_main_context_new ();
@@ -699,16 +698,19 @@ junk_test (struct _ESExp *f, gint argc, struct _ESExpResult **argv, FilterMessag
  * @info:
  * @source:
  * @expression:
- * @ex:
+ * @error: return location for a #GError, or %NULL
  *
  * Returns: one of CAMEL_SEARCH_MATCHED, CAMEL_SEARCH_NOMATCH, or
  * CAMEL_SEARCH_ERROR.
  **/
 gint
 camel_filter_search_match (CamelSession *session,
-			   CamelFilterSearchGetMessageFunc get_message, gpointer data,
-			   CamelMessageInfo *info, const gchar *source,
-			   const gchar *expression, CamelException *ex)
+                           CamelFilterSearchGetMessageFunc get_message,
+                           gpointer data,
+                           CamelMessageInfo *info,
+                           const gchar *source,
+                           const gchar *expression,
+                           GError **error)
 {
 	FilterMessageSearch fms;
 	ESExp *sexp;
@@ -722,7 +724,7 @@ camel_filter_search_match (CamelSession *session,
 	fms.message = NULL;
 	fms.info = info;
 	fms.source = source;
-	fms.ex = ex;
+	fms.error = error;
 
 	sexp = e_sexp_new ();
 
@@ -735,21 +737,21 @@ camel_filter_search_match (CamelSession *session,
 
 	e_sexp_input_text (sexp, expression, strlen (expression));
 	if (e_sexp_parse (sexp) == -1) {
-		if (!camel_exception_is_set (ex))
-			/* A filter search is a search through your filters,
-			 * ie. your filters is the corpus being searched thru. */
-			camel_exception_setv (
-				ex, 1, _("Error executing filter search: %s: %s"),
-				e_sexp_error (sexp), expression);
+		/* A filter search is a search through your filters,
+		 * ie. your filters is the corpus being searched thru. */
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+			_("Error executing filter search: %s: %s"),
+			e_sexp_error (sexp), expression);
 		goto error;
 	}
 
 	result = e_sexp_eval (sexp);
 	if (result == NULL) {
-		if (!camel_exception_is_set (ex))
-			camel_exception_setv (
-				ex, 1, _("Error executing filter search: %s: %s"),
-				e_sexp_error (sexp), expression);
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+			_("Error executing filter search: %s: %s"),
+			e_sexp_error (sexp), expression);
 		goto error;
 	}
 
diff --git a/camel/camel-filter-search.h b/camel/camel-filter-search.h
index a14cd1f..0b86806 100644
--- a/camel/camel-filter-search.h
+++ b/camel/camel-filter-search.h
@@ -41,12 +41,12 @@ enum {
 	CAMEL_SEARCH_MATCHED  =  1
 };
 
-typedef CamelMimeMessage * (*CamelFilterSearchGetMessageFunc) (gpointer data, CamelException *ex);
+typedef CamelMimeMessage * (*CamelFilterSearchGetMessageFunc) (gpointer data, GError **error);
 
 gint camel_filter_search_match (struct _CamelSession *session,
 			       CamelFilterSearchGetMessageFunc get_message, gpointer data,
 			       CamelMessageInfo *info, const gchar *source,
-			       const gchar *expression, CamelException *ex);
+			       const gchar *expression, GError **error);
 
 G_END_DECLS
 
diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c
index 09f9daf..6b1ae41 100644
--- a/camel/camel-folder-search.c
+++ b/camel/camel-folder-search.c
@@ -37,7 +37,6 @@
 
 #include <glib/gi18n-lib.h>
 
-#include "camel-exception.h"
 #include "camel-folder-search.h"
 #include "camel-folder-thread.h"
 #include "camel-iconv.h"
@@ -63,7 +62,7 @@
 	((obj), CAMEL_TYPE_FOLDER_SEARCH, CamelFolderSearchPrivate))
 
 struct _CamelFolderSearchPrivate {
-	CamelException *ex;
+	GError **error;
 
 	CamelFolderThread *threads;
 	GHashTable *threads_hash;
@@ -309,7 +308,7 @@ camel_folder_search_set_body_index(CamelFolderSearch *search, CamelIndex *index)
  * camel_folder_search_execute_expression:
  * @search:
  * @expr:
- * @ex:
+ * @error: return location for a #GError, or %NULL
  *
  * Execute the search expression @expr, returning an array of
  * all matches as a GPtrArray of uid's of matching messages.
@@ -326,7 +325,7 @@ camel_folder_search_set_body_index(CamelFolderSearch *search, CamelIndex *index)
 GPtrArray *
 camel_folder_search_execute_expression (CamelFolderSearch *search,
                                         const gchar *expr,
-                                        CamelException *ex)
+                                        GError **error)
 {
 	ESExpResult *r;
 	GPtrArray *matches;
@@ -334,15 +333,15 @@ camel_folder_search_execute_expression (CamelFolderSearch *search,
 	GHashTable *results;
 	CamelFolderSearchPrivate *p = search->priv;
 
-	p->ex = ex;
+	p->error = error;
 
 	/* only re-parse if the search has changed */
 	if (search->last_search == NULL
 	    || strcmp(search->last_search, expr)) {
 		e_sexp_input_text(search->sexp, expr, strlen(expr));
 		if (e_sexp_parse(search->sexp) == -1) {
-			camel_exception_setv (
-				ex, 1,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Cannot parse search expression: %s:\n%s"),
 				e_sexp_error(search->sexp), expr);
 			return NULL;
@@ -353,11 +352,10 @@ camel_folder_search_execute_expression (CamelFolderSearch *search,
 	}
 	r = e_sexp_eval(search->sexp);
 	if (r == NULL) {
-		if (!camel_exception_is_set(ex))
-			camel_exception_setv (
-				ex, 1,
-				_("Error executing search expression: %s:\n%s"),
-				e_sexp_error(search->sexp), expr);
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+			_("Error executing search expression: %s:\n%s"),
+			e_sexp_error(search->sexp), expr);
 		return NULL;
 	}
 
@@ -412,7 +410,7 @@ camel_folder_search_execute_expression (CamelFolderSearch *search,
  * @search:
  * @expr:
  * @uids: to search against, NULL for all uid's.
- * @ex:
+ * @error: return location for a #GError, or %NULL
  *
  * Run a search.  Search must have had Folder already set on it, and
  * it must implement summaries.
@@ -425,7 +423,7 @@ camel_folder_search_execute_expression (CamelFolderSearch *search,
 guint32
 camel_folder_search_count (CamelFolderSearch *search,
                            const gchar *expr,
-                           CamelException *ex)
+                           GError **error)
 {
 	ESExpResult *r;
 	GPtrArray *summary_set;
@@ -439,7 +437,7 @@ camel_folder_search_count (CamelFolderSearch *search,
 
 	g_assert(search->folder);
 
-	p->ex = ex;
+	p->error = error;
 
 	/* We route body-contains search and thread based search through memory and not via db. */
 	if (strstr((const gchar *) expr, "body-contains") || strstr((const gchar *) expr, "match-threads")) {
@@ -453,8 +451,8 @@ camel_folder_search_count (CamelFolderSearch *search,
 		    || strcmp(search->last_search, expr)) {
 			e_sexp_input_text(search->sexp, expr, strlen(expr));
 			if (e_sexp_parse(search->sexp) == -1) {
-				camel_exception_setv (
-					ex, 1,
+				g_set_error (
+					error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 					_("Cannot parse search expression: %s:\n%s"),
 					e_sexp_error(search->sexp), expr);
 				goto fail;
@@ -465,11 +463,10 @@ camel_folder_search_count (CamelFolderSearch *search,
 		}
 		r = e_sexp_eval(search->sexp);
 		if (r == NULL) {
-			if (!camel_exception_is_set(ex))
-				camel_exception_setv (
-					ex, 1,
-					_("Error executing search expression: %s:\n%s"),
-					e_sexp_error(search->sexp), expr);
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+				_("Error executing search expression: %s:\n%s"),
+				e_sexp_error(search->sexp), expr);
 			goto fail;
 		}
 
@@ -497,12 +494,13 @@ camel_folder_search_count (CamelFolderSearch *search,
 	} else {
 		CamelStore *parent_store;
 		const gchar *full_name;
+		GError *local_error = NULL;
 
 		full_name = camel_folder_get_full_name (search->folder);
 		parent_store = camel_folder_get_parent_store (search->folder);
 
 		/* Sync the db, so that we search the db for changes */
-		camel_folder_summary_save_to_db (search->folder->summary, ex);
+		camel_folder_summary_save_to_db (search->folder->summary, error);
 
 		dd(printf ("sexp is : [%s]\n", expr));
 		if (g_getenv("SQL_SEARCH_OLD"))
@@ -516,14 +514,15 @@ camel_folder_search_count (CamelFolderSearch *search,
 		dd(printf("Equivalent sql %s\n", tmp));
 
 		cdb = (CamelDB *) (parent_store->cdb_r);
-		camel_db_count_message_info  (cdb, tmp, &count, ex);
-		if (ex && camel_exception_is_set(ex)) {
-			const gchar *exception = camel_exception_get_description (ex);
-			if (strncmp(exception, "no such table", 13) == 0) {
-				d(g_warning ("Error during searching %s: %s\n", tmp, exception));
+		camel_db_count_message_info  (cdb, tmp, &count, &local_error);
+		if (local_error != NULL) {
+			const gchar *message = local_error->message;
+			if (strncmp(message, "no such table", 13) == 0) {
+				d(g_warning ("Error during searching %s: %s\n", tmp, message));
 				/* Suppress no such table */
-				camel_exception_clear (ex);
+				g_clear_error (&local_error);
 			}
+			g_propagate_error (error, local_error);
 		}
 		g_free (tmp);
 	}
@@ -573,7 +572,7 @@ do_search_in_memory (const gchar *expr)
  * @search:
  * @expr:
  * @uids: to search against, NULL for all uid's.
- * @ex:
+ * @error: return location for a #GError, or %NULL
  *
  * Run a search.  Search must have had Folder already set on it, and
  * it must implement summaries.
@@ -584,7 +583,7 @@ GPtrArray *
 camel_folder_search_search (CamelFolderSearch *search,
                             const gchar *expr,
                             GPtrArray *uids,
-                            CamelException *ex)
+                            GError **error)
 {
 	ESExpResult *r;
 	GPtrArray *matches = NULL, *summary_set;
@@ -597,7 +596,7 @@ camel_folder_search_search (CamelFolderSearch *search,
 
 	g_assert(search->folder);
 
-	p->ex = ex;
+	p->error = error;
 
 	/* We route body-contains / thread based search and uid search through memory and not via db. */
 	if (uids || do_search_in_memory (expr)) {
@@ -623,8 +622,8 @@ camel_folder_search_search (CamelFolderSearch *search,
 		    || strcmp(search->last_search, expr)) {
 			e_sexp_input_text(search->sexp, expr, strlen(expr));
 			if (e_sexp_parse(search->sexp) == -1) {
-				camel_exception_setv (
-					ex, 1,
+				g_set_error (
+					error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 					_("Cannot parse search expression: %s:\n%s"),
 					e_sexp_error(search->sexp), expr);
 				goto fail;
@@ -635,11 +634,10 @@ camel_folder_search_search (CamelFolderSearch *search,
 		}
 		r = e_sexp_eval(search->sexp);
 		if (r == NULL) {
-			if (!camel_exception_is_set(ex))
-				camel_exception_setv (
-					ex, 1,
-					_("Error executing search expression: %s:\n%s"),
-					e_sexp_error(search->sexp), expr);
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+				_("Error executing search expression: %s:\n%s"),
+				e_sexp_error(search->sexp), expr);
 			goto fail;
 		}
 
@@ -669,12 +667,13 @@ camel_folder_search_search (CamelFolderSearch *search,
 	} else {
 		CamelStore *parent_store;
 		const gchar *full_name;
+		GError *local_error = NULL;
 
 		full_name = camel_folder_get_full_name (search->folder);
 		parent_store = camel_folder_get_parent_store (search->folder);
 
 		/* Sync the db, so that we search the db for changes */
-		camel_folder_summary_save_to_db (search->folder->summary, ex);
+		camel_folder_summary_save_to_db (search->folder->summary, error);
 
 		dd(printf ("sexp is : [%s]\n", expr));
 		if (g_getenv("SQL_SEARCH_OLD"))
@@ -689,14 +688,17 @@ camel_folder_search_search (CamelFolderSearch *search,
 
 		matches = g_ptr_array_new();
 		cdb = (CamelDB *) (parent_store->cdb_r);
-		camel_db_select (cdb, tmp, (CamelDBSelectCB) read_uid_callback, matches, ex);
-		if (ex && camel_exception_is_set(ex)) {
-			const gchar *exception = camel_exception_get_description (ex);
-			if (strncmp(exception, "no such table", 13) == 0) {
-				d(g_warning ("Error during searching %s: %s\n", tmp, exception));
+		camel_db_select (
+			cdb, tmp, (CamelDBSelectCB)
+			read_uid_callback, matches, &local_error);
+		if (local_error != NULL) {
+			const gchar *message = local_error->message;
+			if (strncmp(message, "no such table", 13) == 0) {
+				d(g_warning ("Error during searching %s: %s\n", tmp, message));
 				/* Suppress no such table */
-				camel_exception_clear (ex);
+				g_clear_error (&local_error);
 			}
+			g_propagate_error (error, local_error);
 		}
 		g_free (tmp);
 
@@ -862,7 +864,7 @@ search_match_all(struct _ESExp *f, gint argc, struct _ESExpTerm **argv, CamelFol
 	v = search->summary_set?search->summary_set:search->summary;
 
 	if (!CAMEL_IS_VEE_FOLDER (search->folder)) {
-		camel_folder_summary_prepare_fetch_all (search->folder->summary, search->priv->ex);
+		camel_folder_summary_prepare_fetch_all (search->folder->summary, search->priv->error);
 	}
 
 	for (i=0;i<v->len;i++) {
@@ -1040,18 +1042,11 @@ search_match_threads(struct _ESExp *f, gint argc, struct _ESExpTerm **argv, Came
 static CamelMimeMessage *
 get_current_message (CamelFolderSearch *search)
 {
-	CamelException x = CAMEL_EXCEPTION_INITIALISER;
-	CamelMimeMessage *res;
-
 	if (!search || !search->folder || !search->current)
 		return NULL;
 
-	res = camel_folder_get_message (search->folder, search->current->uid, &x);
-
-	if (!res)
-		camel_exception_clear (&x);
-
-	return res;
+	return camel_folder_get_message (
+		search->folder, search->current->uid, NULL);
 }
 
 static ESExpResult *
@@ -1230,7 +1225,7 @@ search_header_regex (struct _ESExp *f, gint argc, struct _ESExpResult **argv, Ca
 
 		if (argc > 1 && argv[0]->type == ESEXP_RES_STRING
 		    && (contents = camel_medium_get_header (CAMEL_MEDIUM (msg), argv[0]->value.string))
-		    && camel_search_build_match_regex (&pattern, CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_ICASE, argc-1, argv+1, search->priv->ex) == 0) {
+		    && camel_search_build_match_regex (&pattern, CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_ICASE, argc-1, argv+1, search->priv->error) == 0) {
 			r->value.boolean = regexec (&pattern, contents, 0, NULL, 0) == 0;
 			regfree (&pattern);
 		} else
@@ -1280,7 +1275,7 @@ search_header_full_regex (struct _ESExp *f, gint argc, struct _ESExpResult **arg
 
 		r = e_sexp_result_new (f, ESEXP_RES_BOOL);
 
-		if (camel_search_build_match_regex (&pattern, CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_ICASE|CAMEL_SEARCH_MATCH_NEWLINE, argc, argv, search->priv->ex) == 0) {
+		if (camel_search_build_match_regex (&pattern, CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_ICASE|CAMEL_SEARCH_MATCH_NEWLINE, argc, argv, search->priv->error) == 0) {
 			gchar *contents;
 
 			contents = get_full_header (msg);
@@ -1325,7 +1320,7 @@ static gint
 match_message_index (CamelIndex *idx,
                      const gchar *uid,
                      const gchar *match,
-                     CamelException *ex)
+                     GError **error)
 {
 	CamelIndexCursor *wc, *nc;
 	const gchar *word, *name;
@@ -1364,7 +1359,7 @@ or
 static GPtrArray *
 match_words_index (CamelFolderSearch *search,
                    struct _camel_search_words *words,
-                   CamelException *ex)
+                   GError **error)
 {
 	GPtrArray *result = g_ptr_array_new();
 	GHashTable *ht = g_hash_table_new(g_str_hash, g_str_equal);
@@ -1437,8 +1432,8 @@ match_words_1message (CamelDataWrapper *object, struct _camel_search_words *word
 		stream = camel_stream_mem_new_with_byte_array (byte_array);
 
 		/* FIXME: The match should be part of a stream op */
-		camel_data_wrapper_decode_to_stream (containee, stream);
-		camel_stream_write (stream, "", 1);
+		camel_data_wrapper_decode_to_stream (containee, stream, NULL);
+		camel_stream_write (stream, "", 1, NULL);
 		for (i=0;i<words->len;i++) {
 			/* FIXME: This is horridly slow, and should use a real search algorithm */
 			if (camel_ustrstrcase((const gchar *) byte_array->data, words->words[i]->word) != NULL) {
@@ -1459,20 +1454,18 @@ static gboolean
 match_words_message (CamelFolder *folder,
                      const gchar *uid,
                      struct _camel_search_words *words,
-                     CamelException *ex)
+                     GError **error)
 {
 	guint32 mask;
 	CamelMimeMessage *msg;
-	CamelException x = CAMEL_EXCEPTION_INITIALISER;
 	gint truth = FALSE;
 
-	msg = camel_folder_get_message(folder, uid, &x);
+	msg = camel_folder_get_message(folder, uid, NULL);
 	if (msg) {
 		mask = 0;
 		truth = match_words_1message((CamelDataWrapper *)msg, words, &mask);
 		g_object_unref (msg);
-	} else
-		camel_exception_clear (&x);
+	}
 
 	return truth;
 }
@@ -1480,7 +1473,7 @@ match_words_message (CamelFolder *folder,
 static GPtrArray *
 match_words_messages (CamelFolderSearch *search,
                       struct _camel_search_words *words,
-                      CamelException *ex)
+                      GError **error)
 {
 	gint i;
 	GPtrArray *matches = g_ptr_array_new();
@@ -1490,13 +1483,13 @@ match_words_messages (CamelFolderSearch *search,
 		struct _camel_search_words *simple;
 
 		simple = camel_search_words_simple(words);
-		indexed = match_words_index(search, simple, ex);
+		indexed = match_words_index(search, simple, error);
 		camel_search_words_free(simple);
 
 		for (i=0;i<indexed->len;i++) {
 			const gchar *uid = g_ptr_array_index(indexed, i);
 
-			if (match_words_message(search->folder, uid, words, ex))
+			if (match_words_message(search->folder, uid, words, error))
 				g_ptr_array_add(matches, (gchar *)uid);
 		}
 
@@ -1507,7 +1500,7 @@ match_words_messages (CamelFolderSearch *search,
 		for (i=0;i<v->len;i++) {
 			gchar *uid  = g_ptr_array_index(v, i);
 
-			if (match_words_message(search->folder, uid, words, ex))
+			if (match_words_message(search->folder, uid, words, error))
 				g_ptr_array_add(matches, (gchar *)uid);
 		}
 	}
@@ -1519,7 +1512,7 @@ static ESExpResult *
 search_body_contains(struct _ESExp *f, gint argc, struct _ESExpResult **argv, CamelFolderSearch *search)
 {
 	gint i, j;
-	CamelException *ex = search->priv->ex;
+	GError **error = search->priv->error;
 	struct _camel_search_words *words;
 	ESExpResult *r;
 	struct IterData lambdafoo;
@@ -1536,10 +1529,10 @@ search_body_contains(struct _ESExp *f, gint argc, struct _ESExpResult **argv, Ca
 					truth = TRUE;
 					if ((words->type & CAMEL_SEARCH_WORD_COMPLEX) == 0 && search->body_index) {
 						for (j=0;j<words->len && truth;j++)
-							truth = match_message_index(search->body_index, camel_message_info_uid(search->current), words->words[j]->word, ex);
+							truth = match_message_index(search->body_index, camel_message_info_uid(search->current), words->words[j]->word, error);
 					} else {
 						/* TODO: cache current message incase of multiple body search terms */
-						truth = match_words_message(search->folder, camel_message_info_uid(search->current), words, ex);
+						truth = match_words_message(search->folder, camel_message_info_uid(search->current), words, error);
 					}
 					camel_search_words_free(words);
 				}
@@ -1567,9 +1560,9 @@ search_body_contains(struct _ESExp *f, gint argc, struct _ESExpResult **argv, Ca
 				if (argv[i]->type == ESEXP_RES_STRING) {
 					words = camel_search_words_split((const guchar *) argv[i]->value.string);
 					if ((words->type & CAMEL_SEARCH_WORD_COMPLEX) == 0 && search->body_index) {
-						matches = match_words_index(search, words, ex);
+						matches = match_words_index(search, words, error);
 					} else {
-						matches = match_words_messages(search, words, ex);
+						matches = match_words_messages(search, words, error);
 					}
 					for (j=0;j<matches->len;j++) {
 						g_hash_table_insert(ht, matches->pdata[j], matches->pdata[j]);
@@ -1598,7 +1591,7 @@ search_body_regex (struct _ESExp *f, gint argc, struct _ESExpResult **argv, Came
 
 		r = e_sexp_result_new (f, ESEXP_RES_BOOL);
 
-		if (camel_search_build_match_regex (&pattern, CAMEL_SEARCH_MATCH_ICASE|CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_NEWLINE, argc, argv, search->priv->ex) == 0) {
+		if (camel_search_build_match_regex (&pattern, CAMEL_SEARCH_MATCH_ICASE|CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_NEWLINE, argc, argv, search->priv->error) == 0) {
 			r->value.boolean = camel_search_message_body_contains ((CamelDataWrapper *) msg, &pattern);
 			regfree (&pattern);
 		} else
@@ -1611,24 +1604,21 @@ search_body_regex (struct _ESExp *f, gint argc, struct _ESExpResult **argv, Came
 		r = e_sexp_result_new(f, ESEXP_RES_ARRAY_PTR);
 		r->value.ptrarray = g_ptr_array_new ();
 
-		if (camel_search_build_match_regex (&pattern, CAMEL_SEARCH_MATCH_ICASE|CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_NEWLINE, argc, argv, search->priv->ex) == 0) {
+		if (camel_search_build_match_regex (&pattern, CAMEL_SEARCH_MATCH_ICASE|CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_NEWLINE, argc, argv, search->priv->error) == 0) {
 			gint i;
 			GPtrArray *v = search->summary_set?search->summary_set:search->summary;
-			CamelException x = CAMEL_EXCEPTION_INITIALISER;
 			CamelMimeMessage *message;
 
 			for (i = 0; i < v->len; i++) {
 				gchar *uid = g_ptr_array_index(v, i);
 
-				message = camel_folder_get_message (search->folder, uid, &x);
+				message = camel_folder_get_message (search->folder, uid, NULL);
 				if (message) {
 					if (camel_search_message_body_contains ((CamelDataWrapper *) message, &pattern)) {
 						g_ptr_array_add (r->value.ptrarray, uid);
 					}
 
 					g_object_unref (message);
-				} else {
-					camel_exception_clear (&x);
 				}
 			}
 
diff --git a/camel/camel-folder-search.h b/camel/camel-folder-search.h
index 27a5ea0..4a28272 100644
--- a/camel/camel-folder-search.h
+++ b/camel/camel-folder-search.h
@@ -157,10 +157,10 @@ void camel_folder_search_set_folder(CamelFolderSearch *search, CamelFolder *fold
 void camel_folder_search_set_summary(CamelFolderSearch *search, GPtrArray *summary);
 void camel_folder_search_set_body_index(CamelFolderSearch *search, CamelIndex *index);
 /* this interface is deprecated */
-GPtrArray *camel_folder_search_execute_expression(CamelFolderSearch *search, const gchar *expr, CamelException *ex);
+GPtrArray *camel_folder_search_execute_expression(CamelFolderSearch *search, const gchar *expr, GError **error);
 
-GPtrArray *camel_folder_search_search(CamelFolderSearch *search, const gchar *expr, GPtrArray *uids, CamelException *ex);
-guint32 camel_folder_search_count(CamelFolderSearch *search, const gchar *expr, CamelException *ex);
+GPtrArray *camel_folder_search_search(CamelFolderSearch *search, const gchar *expr, GPtrArray *uids, GError **error);
+guint32 camel_folder_search_count(CamelFolderSearch *search, const gchar *expr, GError **error);
 void camel_folder_search_free_result(CamelFolderSearch *search, GPtrArray *);
 
 G_END_DECLS
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 615a51a..c8203a9 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -138,7 +138,7 @@ static CamelMessageContentInfo * content_info_new_from_message(CamelFolderSummar
 static CamelMessageContentInfo * content_info_migrate(CamelFolderSummary *, FILE *);
 static void			 content_info_free(CamelFolderSummary *, CamelMessageContentInfo *);
 
-static gint save_message_infos_to_db (CamelFolderSummary *s, gboolean fresh_mir, CamelException *ex);
+static gint save_message_infos_to_db (CamelFolderSummary *s, gboolean fresh_mir, GError **error);
 static gint camel_read_mir_callback (gpointer  ref, gint ncol, gchar ** cols, gchar ** name);
 
 static gchar *next_uid_string(CamelFolderSummary *s);
@@ -278,7 +278,7 @@ summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *record)
 
 static	CamelFIRecord *
 summary_header_to_db (CamelFolderSummary *s,
-                      CamelException *ex)
+                      GError **error)
 {
 	CamelFIRecord * record = g_new0 (CamelFIRecord, 1);
 	CamelStore *parent_store;
@@ -1045,8 +1045,6 @@ camel_folder_summary_set_build_content(CamelFolderSummary *s, gboolean state)
  * Get the number of summary items stored in this summary.
  *
  * Returns: the number of items in the summary
- *
- * @see camel_folder_summary_prepare_fetch_all()
  **/
 guint
 camel_folder_summary_count(CamelFolderSummary *s)
@@ -1065,8 +1063,6 @@ camel_folder_summary_count(CamelFolderSummary *s)
  * ref'd or free'd as appropriate.
  *
  * Returns: the summary item, or %NULL if @index is out of range
- *
- * @see camel_folder_summary_prepare_fetch_all()
  **/
 CamelMessageInfo *
 camel_folder_summary_index (CamelFolderSummary *s, gint i)
@@ -1260,13 +1256,11 @@ message_info_from_uid (CamelFolderSummary *s, const gchar *uid)
 
 	if (!info) {
 		CamelDB *cdb;
-		CamelException ex;
 		CamelStore *parent_store;
 		const gchar *folder_name;
 		struct _db_pass_data data;
 
 		d(printf ("\ncamel_folder_summary_uid called \n"));
-		camel_exception_init (&ex);
 		s->flags &= ~CAMEL_SUMMARY_DIRTY;
 
 		folder_name = camel_folder_get_full_name (s->folder);
@@ -1278,28 +1272,13 @@ message_info_from_uid (CamelFolderSummary *s, const gchar *uid)
 
 		ret = camel_db_read_message_info_record_with_uid (
 			cdb, folder_name, uid, &data,
-			camel_read_mir_callback, &ex);
-		if (ret != 0) {
-			camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
-			if (camel_exception_is_set (&ex))
-				g_warning ("%s: Failed read '%s' in '%s' from db: %s (0x%x)", G_STRFUNC, uid, folder_name, camel_exception_get_description (&ex), camel_exception_get_id (&ex));
-			camel_exception_clear (&ex);
+			camel_read_mir_callback, NULL);
+		if (ret != 0)
 			return NULL;
-		}
 
 		/* We would have double reffed at camel_read_mir_callback */
 		info = g_hash_table_lookup (s->loaded_infos, uid);
 
-		if (!info) {
-			gchar *errmsg = g_strdup_printf ("no uid [%s] exists", uid);
-
-			/* Makes no sense now as the exception is local as of now. FIXME: Pass exception from caller */
-			camel_exception_set (&ex, CAMEL_EXCEPTION_SYSTEM, _(errmsg));
-			d(g_warning ("No uid[%s] exists in %s\n", uid, folder_name));
-			camel_exception_clear (&ex);
-			g_free (errmsg);
-		}
-
 		cfs_schedule_info_release_timer (s);
 	}
 
@@ -1322,8 +1301,6 @@ message_info_from_uid (CamelFolderSummary *s, const gchar *uid)
  * ref'd or free'd as appropriate.
  *
  * Returns: the summary item, or %NULL if the uid @uid is not available
- *
- * @see camel_folder_summary_prepare_fetch_all()
  **/
 CamelMessageInfo *
 camel_folder_summary_uid (CamelFolderSummary *summary,
@@ -1641,7 +1618,7 @@ struct _preview_update_msg {
 	CamelSessionThreadMsg msg;
 
 	CamelFolder *folder;
-	CamelException ex;
+	GError *error;
 };
 
 static void
@@ -1650,21 +1627,16 @@ msg_update_preview (const gchar *uid, gpointer value, CamelFolder *folder)
 	CamelMessageInfoBase *info = (CamelMessageInfoBase *)camel_folder_summary_uid (folder->summary, uid);
 	CamelMimeMessage *msg;
 	CamelStore *parent_store;
-	CamelException ex;
 	const gchar *full_name;
 
 	full_name = camel_folder_get_full_name (folder);
 	parent_store = camel_folder_get_parent_store (folder);
 
-	camel_exception_init(&ex);
-	msg = camel_folder_get_message (folder, uid, &ex);
-	if (camel_exception_is_set(&ex))
-		g_warning ("Error fetching message: %s", camel_exception_get_description(&ex));
-	else {
+	msg = camel_folder_get_message (folder, uid, NULL);
+	if (msg != NULL) {
 		if (camel_mime_message_build_preview ((CamelMimePart *)msg, (CamelMessageInfo *)info) && info->preview)
 			camel_db_write_preview_record (parent_store->cdb_w, full_name, info->uid, info->preview, NULL);
 	}
-	camel_exception_clear(&ex);
 	camel_message_info_free(info);
 }
 
@@ -1741,7 +1713,7 @@ static CamelSessionThreadOps preview_update_ops = {
 /* end */
 
 static gint
-cfs_reload_from_db (CamelFolderSummary *s, CamelException *ex)
+cfs_reload_from_db (CamelFolderSummary *s, GError **error)
 {
 	CamelDB *cdb;
 	CamelStore *parent_store;
@@ -1769,7 +1741,7 @@ cfs_reload_from_db (CamelFolderSummary *s, CamelException *ex)
 
 		m = camel_session_thread_msg_new(((CamelService *)parent_store)->session, &preview_update_ops, sizeof(*m));
 		m->folder = s->folder;
-		camel_exception_init(&m->ex);
+		m->error = NULL;
 		camel_session_thread_queue(((CamelService *)parent_store)->session, &m->msg, 0);
 	}
 
@@ -1792,7 +1764,7 @@ camel_folder_summary_add_preview (CamelFolderSummary *s, CamelMessageInfo *info)
 /**
  * camel_folder_summary_prepare_fetch_all:
  * @s: #CamelFolderSummary object
- * @ex: #CamelException object.
+ * @error: return location for a #GError, or %NULL
  *
  * Loads all infos into memory, if they are not yet and ensures
  * they will not be freed in next couple minutes. Call this function
@@ -1802,7 +1774,8 @@ camel_folder_summary_add_preview (CamelFolderSummary *s, CamelMessageInfo *info)
  * Since: 3.0
  **/
 void
-camel_folder_summary_prepare_fetch_all (CamelFolderSummary *s, CamelException *ex)
+camel_folder_summary_prepare_fetch_all (CamelFolderSummary *s,
+                                        GError **error)
 {
 	guint loaded, known;
 
@@ -1813,7 +1786,7 @@ camel_folder_summary_prepare_fetch_all (CamelFolderSummary *s, CamelException *e
 
 	if (known - loaded > 50) {
 		camel_folder_summary_lock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
-		cfs_reload_from_db (s, ex);
+		cfs_reload_from_db (s, error);
 		camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
 	}
 
@@ -1841,14 +1814,14 @@ camel_folder_summary_get_flag_cache (CamelFolderSummary *summary)
  **/
 gint
 camel_folder_summary_load_from_db (CamelFolderSummary *s,
-                                   CamelException *ex)
+                                   GError **error)
 {
 	CamelDB *cdb;
 	CamelStore *parent_store;
 	const gchar *full_name;
 	gint ret = 0;
-	CamelException ex2;
 	struct _CamelFolderSummaryPrivate *p = CAMEL_FOLDER_SUMMARY_GET_PRIVATE(s);
+	GError *local_error = NULL;
 
 	/* struct _db_pass_data data; */
 	d(printf ("\ncamel_folder_summary_load_from_db called \n"));
@@ -1856,28 +1829,23 @@ camel_folder_summary_load_from_db (CamelFolderSummary *s,
 
 	full_name = camel_folder_get_full_name (s->folder);
 	parent_store = camel_folder_get_parent_store (s->folder);
-	ret = camel_folder_summary_header_load_from_db (s, parent_store, full_name, ex);
+	ret = camel_folder_summary_header_load_from_db (s, parent_store, full_name, error);
 
 	if (ret)
 		return ret;
 
 	cdb = parent_store->cdb_r;
 
-	camel_exception_init (&ex2);
-
 	ret = camel_db_get_folder_uids_flags (
 		cdb, full_name, s->sort_by, s->collate,
-		s->uids, p->flag_cache, &ex2);
+		s->uids, p->flag_cache, &local_error);
 
-	if (camel_exception_is_set (&ex2) && camel_exception_get_description (&ex2) &&
-	    strstr (camel_exception_get_description (&ex2), "no such table") != NULL) {
+	if (local_error != NULL && local_error->message != NULL &&
+		strstr (local_error->message, "no such table") != NULL) {
 		/* create table the first time it is accessed and missing */
-		ret = camel_db_prepare_message_info_table (cdb, full_name, ex);
-	} else if (ex) {
-		camel_exception_xfer (ex, &ex2);
-	}
-
-	camel_exception_clear (&ex2);
+		ret = camel_db_prepare_message_info_table (cdb, full_name, error);
+	} else if (local_error != NULL)
+		g_propagate_error (error, local_error);
 
 	return ret == 0 ? 0 : -1;
 }
@@ -2019,7 +1987,6 @@ camel_folder_summary_migrate_infos(CamelFolderSummary *s)
 	gint ret = 0;
 	CamelDB *cdb;
 	CamelFIRecord *record;
-	CamelException ex;
 
 	parent_store = camel_folder_get_parent_store (s->folder);
 	cdb = parent_store->cdb_w;
@@ -2029,7 +1996,6 @@ camel_folder_summary_migrate_infos(CamelFolderSummary *s)
 		g_source_remove (s->timeout_handle);
 	s->timeout_handle = 0;
 
-	camel_exception_init (&ex);
 	d(g_print ("\ncamel_folder_summary_load from FLAT FILE called \n"));
 
 	if (s->summary_path == NULL) {
@@ -2083,15 +2049,15 @@ camel_folder_summary_migrate_infos(CamelFolderSummary *s)
 		return -1;
 	}
 
-	ret = save_message_infos_to_db (s, TRUE, &ex);
+	ret = save_message_infos_to_db (s, TRUE, NULL);
 
 	if (ret != 0) {
 		return -1;
 	}
 
-	camel_db_begin_transaction (cdb, &ex);
-	ret = camel_db_write_folder_info_record (cdb, record, &ex);
-	camel_db_end_transaction (cdb, &ex);
+	camel_db_begin_transaction (cdb, NULL);
+	ret = camel_db_write_folder_info_record (cdb, record, NULL);
+	camel_db_end_transaction (cdb, NULL);
 
 	g_free (record->bdata);
 	g_free (record);
@@ -2137,7 +2103,7 @@ perform_content_info_save_to_db (CamelFolderSummary *s, CamelMessageContentInfo
 }
 
 typedef struct {
-	CamelException *ex;
+	GError **error;
 	gboolean migration;
 	gint progress;
 } SaveToDBArgs;
@@ -2146,7 +2112,7 @@ static void
 save_to_db_cb (gpointer key, gpointer value, gpointer data)
 {
 	SaveToDBArgs *args = (SaveToDBArgs *) data;
-	CamelException *ex = args->ex;
+	GError **error = args->error;
 	CamelMessageInfoBase *mi = (CamelMessageInfoBase *)value;
 	CamelFolderSummary *s = (CamelFolderSummary *)mi->summary;
 	CamelStore *parent_store;
@@ -2173,20 +2139,20 @@ save_to_db_cb (gpointer key, gpointer value, gpointer data)
 	}
 
 	if (!args->migration) {
-			if (camel_db_write_message_info_record (cdb, full_name, mir, ex) != 0) {
+			if (camel_db_write_message_info_record (cdb, full_name, mir, error) != 0) {
 					camel_db_camel_mir_free (mir);
 					return;
 			}
 	} else {
-			if (camel_db_write_fresh_message_info_record (cdb, CAMEL_DB_IN_MEMORY_TABLE, mir, ex) != 0) {
+			if (camel_db_write_fresh_message_info_record (cdb, CAMEL_DB_IN_MEMORY_TABLE, mir, error) != 0) {
 					camel_db_camel_mir_free (mir);
 					return;
 			}
 
 			if (args->progress > CAMEL_DB_IN_MEMORY_TABLE_LIMIT) {
 			    g_print ("BULK INsert limit reached \n");
-				camel_db_flush_in_memory_transactions (cdb, full_name, ex);
-				camel_db_start_in_memory_transactions (cdb, ex);
+				camel_db_flush_in_memory_transactions (cdb, full_name, error);
+				camel_db_start_in_memory_transactions (cdb, error);
 				args->progress = 0;
 			} else {
 				args->progress ++;
@@ -2204,14 +2170,14 @@ save_to_db_cb (gpointer key, gpointer value, gpointer data)
 static gint
 save_message_infos_to_db (CamelFolderSummary *s,
                           gboolean fresh_mirs,
-                          CamelException *ex)
+                          GError **error)
 {
 	CamelStore *parent_store;
 	CamelDB *cdb;
 	const gchar *full_name;
 	SaveToDBArgs args;
 
-	args.ex = ex;
+	args.error = error;
 	args.migration = fresh_mirs;
 	args.progress = 0;
 
@@ -2219,7 +2185,7 @@ save_message_infos_to_db (CamelFolderSummary *s,
 	parent_store = camel_folder_get_parent_store (s->folder);
 	cdb = parent_store->cdb_w;
 
-	if (camel_db_prepare_message_info_table (cdb, full_name, ex) != 0)
+	if (camel_db_prepare_message_info_table (cdb, full_name, error) != 0)
 		return -1;
 
 	camel_folder_summary_lock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
@@ -2252,7 +2218,7 @@ msg_save_preview (const gchar *uid, gpointer value, CamelFolder *folder)
  **/
 gint
 camel_folder_summary_save_to_db (CamelFolderSummary *s,
-                                 CamelException *ex)
+                                 GError **error)
 {
 	CamelStore *parent_store;
 	CamelDB *cdb;
@@ -2279,59 +2245,62 @@ camel_folder_summary_save_to_db (CamelFolderSummary *s,
 
 	count = cfs_count_dirty(s);
 	if (!count)
-		return camel_folder_summary_header_save_to_db (s, ex);
+		return camel_folder_summary_header_save_to_db (s, error);
 
-	camel_db_begin_transaction (cdb, ex);
+	camel_db_begin_transaction (cdb, NULL);
 
-	ret = save_message_infos_to_db (s, FALSE, ex);
+	ret = save_message_infos_to_db (s, FALSE, error);
 	if (ret != 0) {
-		camel_db_abort_transaction (cdb, ex);
+		camel_db_abort_transaction (cdb, NULL);
 		/* Failed, so lets reset the flag */
 		s->flags |= CAMEL_SUMMARY_DIRTY;
 		return -1;
 	}
 
-	if (ex && camel_exception_is_set (ex) && strstr (camel_exception_get_description (ex), "26 columns but 28 values") != NULL) {
+	/* XXX So... if an error is set, how do we even reach this point
+	 *     given the above error check?  Oye vey this logic is nasty. */
+	if (error != NULL && *error != NULL &&
+		strstr ((*error)->message, "26 columns but 28 values") != NULL) {
 		const gchar *full_name;
 
 		/* This is an error is previous migration. Let remigrate this folder alone. */
-		camel_db_abort_transaction (cdb, ex);
+		camel_db_abort_transaction (cdb, NULL);
 		full_name = camel_folder_get_full_name (s->folder);
-		camel_db_reset_folder_version (cdb, full_name, 0, ex);
+		camel_db_reset_folder_version (cdb, full_name, 0, NULL);
 		g_warning ("Fixing up a broken summary migration on %s\n", full_name);
 		/* Begin everything again. */
-		camel_db_begin_transaction (cdb, ex);
+		camel_db_begin_transaction (cdb, NULL);
 
-		ret = save_message_infos_to_db (s, FALSE, ex);
+		ret = save_message_infos_to_db (s, FALSE, error);
 		if (ret != 0) {
-			camel_db_abort_transaction (cdb, ex);
+			camel_db_abort_transaction (cdb, NULL);
 			/* Failed, so lets reset the flag */
 			s->flags |= CAMEL_SUMMARY_DIRTY;
 			return -1;
 		}
 	}
 
-	camel_db_end_transaction (cdb, ex);
+	camel_db_end_transaction (cdb, NULL);
 
-	record = CAMEL_FOLDER_SUMMARY_GET_CLASS (s)->summary_header_to_db (s, ex);
+	record = CAMEL_FOLDER_SUMMARY_GET_CLASS (s)->summary_header_to_db (s, error);
 	if (!record) {
 		s->flags |= CAMEL_SUMMARY_DIRTY;
 		return -1;
 	}
 
-	camel_db_begin_transaction (cdb, ex);
-	ret = camel_db_write_folder_info_record (cdb, record, ex);
+	camel_db_begin_transaction (cdb, NULL);
+	ret = camel_db_write_folder_info_record (cdb, record, error);
 	g_free (record->folder_name);
 	g_free (record->bdata);
 	g_free (record);
 
 	if (ret != 0) {
-		camel_db_abort_transaction (cdb, ex);
+		camel_db_abort_transaction (cdb, NULL);
 		s->flags |= CAMEL_SUMMARY_DIRTY;
 		return -1;
 	}
 
-	camel_db_end_transaction (cdb, ex);
+	camel_db_end_transaction (cdb, NULL);
 
 	return ret;
 }
@@ -2343,7 +2312,7 @@ camel_folder_summary_save_to_db (CamelFolderSummary *s,
  **/
 gint
 camel_folder_summary_header_save_to_db (CamelFolderSummary *s,
-                                        CamelException *ex)
+                                        GError **error)
 {
 	CamelStore *parent_store;
 	CamelFIRecord *record;
@@ -2355,22 +2324,22 @@ camel_folder_summary_header_save_to_db (CamelFolderSummary *s,
 
 	d(printf ("\ncamel_folder_summary_header_save_to_db called \n"));
 
-	record = CAMEL_FOLDER_SUMMARY_GET_CLASS (s)->summary_header_to_db (s, ex);
+	record = CAMEL_FOLDER_SUMMARY_GET_CLASS (s)->summary_header_to_db (s, error);
 	if (!record) {
 		return -1;
 	}
 
-	camel_db_begin_transaction (cdb, ex);
-	ret = camel_db_write_folder_info_record (cdb, record, ex);
+	camel_db_begin_transaction (cdb, NULL);
+	ret = camel_db_write_folder_info_record (cdb, record, error);
 	g_free (record->bdata);
 	g_free (record);
 
 	if (ret != 0) {
-		camel_db_abort_transaction (cdb, ex);
+		camel_db_abort_transaction (cdb, NULL);
 		return -1;
 	}
 
-	camel_db_end_transaction (cdb, ex);
+	camel_db_end_transaction (cdb, NULL);
 
 	return ret;
 }
@@ -2384,7 +2353,7 @@ gint
 camel_folder_summary_header_load_from_db (CamelFolderSummary *s,
                                           CamelStore *store,
                                           const gchar *folder_name,
-                                          CamelException *ex)
+                                          GError **error)
 {
 	CamelDB *cdb;
 	CamelFIRecord *record;
@@ -2396,7 +2365,7 @@ camel_folder_summary_header_load_from_db (CamelFolderSummary *s,
 	cdb = store->cdb_r;
 
 	record = g_new0 (CamelFIRecord, 1);
-	camel_db_read_folder_info_record (cdb, folder_name, &record, ex);
+	camel_db_read_folder_info_record (cdb, folder_name, &record, error);
 
 	if (record) {
 		if (CAMEL_FOLDER_SUMMARY_GET_CLASS (s)->summary_header_from_db (s, record) == -1)
@@ -2570,12 +2539,18 @@ update_summary (CamelFolderSummary *summary, CamelMessageInfoBase *info)
  * Returns: the newly added record
  **/
 CamelMessageInfo *
-camel_folder_summary_add_from_header(CamelFolderSummary *s, struct _camel_header_raw *h)
+camel_folder_summary_add_from_header (CamelFolderSummary *summary,
+                                      struct _camel_header_raw *h)
 {
-	CamelMessageInfo *info = camel_folder_summary_info_new_from_header(s, h);
+	CamelMessageInfo *info;
+
+	g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary), NULL);
+
+	info = camel_folder_summary_info_new_from_header (summary, h);
+
+	camel_folder_summary_add (summary, info);
+	update_summary (summary, (CamelMessageInfoBase *) info);
 
-	camel_folder_summary_add (s, info);
-	update_summary (s, (CamelMessageInfoBase *) info);
 	return info;
 }
 
@@ -3090,7 +3065,6 @@ camel_folder_summary_remove_range (CamelFolderSummary *s, gint start, gint end)
 		gint i;
 		CamelDB *cdb;
 		CamelStore *parent_store;
-		CamelException ex; /* May be this should come from the caller  */
 		const gchar *folder_name;
 		GSList *uids = NULL;
 
@@ -3108,7 +3082,6 @@ camel_folder_summary_remove_range (CamelFolderSummary *s, gint start, gint end)
 				g_hash_table_remove (s->loaded_infos, uid);
 			}
 		}
-		camel_exception_init (&ex);
 
 		folder_name = camel_folder_get_full_name (s->folder);
 		parent_store = camel_folder_get_parent_store (s->folder);
@@ -3118,7 +3091,7 @@ camel_folder_summary_remove_range (CamelFolderSummary *s, gint start, gint end)
 		 * Add should add to db and del should del to db. Sync only
 		 * the changes at interval and remove those full sync on
 		 * folder switch */
-		camel_db_delete_uids (cdb, folder_name, uids, &ex);
+		camel_db_delete_uids (cdb, folder_name, uids, NULL);
 
 		g_slist_foreach (uids, (GFunc) camel_pstring_free, NULL);
 		g_slist_free (uids);
@@ -3129,8 +3102,6 @@ camel_folder_summary_remove_range (CamelFolderSummary *s, gint start, gint end)
 		s->flags |= CAMEL_SUMMARY_DIRTY;
 
 		camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
-
-		camel_exception_clear (&ex);
 	} else {
 		camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
 	}
@@ -4069,8 +4040,9 @@ summary_build_content_info_message(CamelFolderSummary *s, CamelMessageInfo *msgi
 			CAMEL_STREAM_FILTER (p->filter_stream),
 			p->filter_index);
 
-		camel_data_wrapper_decode_to_stream(containee, p->filter_stream);
-		camel_stream_flush(p->filter_stream);
+		camel_data_wrapper_decode_to_stream (
+			containee, p->filter_stream, NULL);
+		camel_stream_flush (p->filter_stream, NULL);
 
 		camel_stream_filter_remove (
 			CAMEL_STREAM_FILTER (p->filter_stream), idx_id);
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
index 433be92..ba2945e 100644
--- a/camel/camel-folder-summary.h
+++ b/camel/camel-folder-summary.h
@@ -282,7 +282,7 @@ struct _CamelFolderSummaryClass {
 
 	/* Load/Save folder summary from DB*/
 	gint (*summary_header_from_db)(CamelFolderSummary *, struct _CamelFIRecord *);
-	struct _CamelFIRecord * (*summary_header_to_db)(CamelFolderSummary *, CamelException *ex);
+	struct _CamelFIRecord * (*summary_header_to_db)(CamelFolderSummary *, GError **error);
 	CamelMessageInfo * (*message_info_from_db) (CamelFolderSummary *, struct _CamelMIRecord*);
 	struct _CamelMIRecord * (*message_info_to_db) (CamelFolderSummary *, CamelMessageInfo *);
 	CamelMessageContentInfo * (*content_info_from_db) (CamelFolderSummary *, struct _CamelMIRecord *);
@@ -343,13 +343,13 @@ gchar    *camel_folder_summary_next_uid_string (CamelFolderSummary *summary);
 void	 camel_folder_summary_set_uid	      (CamelFolderSummary *summary, guint32 uid);
 
 /* load/save the full summary from/to the db */
-gint camel_folder_summary_save_to_db (CamelFolderSummary *s, CamelException *ex);
-gint camel_folder_summary_load_from_db (CamelFolderSummary *s, CamelException *ex);
+gint camel_folder_summary_save_to_db (CamelFolderSummary *s, GError **error);
+gint camel_folder_summary_load_from_db (CamelFolderSummary *s, GError **error);
 
 /* only load the header */
 gint camel_folder_summary_header_load(CamelFolderSummary *summary);
-gint camel_folder_summary_header_load_from_db (CamelFolderSummary *s, struct _CamelStore *store, const gchar *folder_name, CamelException *ex);
-gint camel_folder_summary_header_save_to_db (CamelFolderSummary *s, CamelException *ex);
+gint camel_folder_summary_header_load_from_db (CamelFolderSummary *s, struct _CamelStore *store, const gchar *folder_name, GError **error);
+gint camel_folder_summary_header_save_to_db (CamelFolderSummary *s, GError **error);
 
 /* set the dirty bit on the summary */
 void camel_folder_summary_touch(CamelFolderSummary *summary);
@@ -363,7 +363,7 @@ CamelMessageInfo * camel_folder_summary_peek_info (CamelFolderSummary *s, const
 /* Get only the uids of dirty/changed things to sync to server/db */
 GPtrArray * camel_folder_summary_get_changed (CamelFolderSummary *s);
 /* reload the summary at any required point if required */
-void camel_folder_summary_prepare_fetch_all (CamelFolderSummary *s, CamelException *ex);
+void camel_folder_summary_prepare_fetch_all (CamelFolderSummary *s, GError **error);
 /* insert mi to summary */
 void camel_folder_summary_insert (CamelFolderSummary *s, CamelMessageInfo *info, gboolean load);
 
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index c15b9b8..874c831 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -32,7 +32,6 @@
 
 #include "camel-db.h"
 #include "camel-debug.h"
-#include "camel-exception.h"
 #include "camel-filter-driver.h"
 #include "camel-folder.h"
 #include "camel-mempool.h"
@@ -80,7 +79,7 @@ struct _folder_filter_msg {
 	GPtrArray *notjunk;
 	CamelFolder *folder;
 	CamelFilterDriver *driver;
-	CamelException ex;
+	GError *error;
 };
 
 enum {
@@ -111,9 +110,9 @@ filter_filter (CamelSession *session, CamelSessionThreadMsg *tmsg)
 	gint i, status = 0;
 	CamelURL *uri;
 	gchar *source_url;
-	CamelException ex = CAMEL_EXCEPTION_INITIALISER;
 	CamelJunkPlugin *csp;
 	const gchar *full_name;
+	GError *local_error = NULL;
 
 	full_name = camel_folder_get_full_name (m->folder);
 	parent_store = camel_folder_get_parent_store (m->folder);
@@ -128,10 +127,9 @@ filter_filter (CamelSession *session, CamelSessionThreadMsg *tmsg)
 			m->junk->len), full_name);
 
 		for (i = 0; i < m->junk->len; i ++) {
-			CamelMimeMessage *msg = camel_folder_get_message (m->folder, m->junk->pdata[i], &ex);
+			CamelMimeMessage *msg = camel_folder_get_message (m->folder, m->junk->pdata[i], NULL);
 			gint pc = 100 * i / m->junk->len;
 
-			camel_exception_clear (&ex);
 			camel_operation_progress (NULL, pc);
 
 			if (msg) {
@@ -150,10 +148,9 @@ filter_filter (CamelSession *session, CamelSessionThreadMsg *tmsg)
 			"Learning new ham messages in '%s'",
 			m->notjunk->len), full_name);
 		for (i = 0; i < m->notjunk->len; i ++) {
-			CamelMimeMessage *msg = camel_folder_get_message (m->folder, m->notjunk->pdata[i], &ex);
+			CamelMimeMessage *msg = camel_folder_get_message (m->folder, m->notjunk->pdata[i], NULL);
 			gint pc = 100 * i / m->notjunk->len;
 
-			camel_exception_clear (&ex);
 			camel_operation_progress (NULL, pc);
 
 			if (msg) {
@@ -202,14 +199,14 @@ filter_filter (CamelSession *session, CamelSessionThreadMsg *tmsg)
 				continue;
 			}
 
-			status = camel_filter_driver_filter_message (m->driver, NULL, info, uid, m->folder, source_url, source_url, &m->ex);
+			status = camel_filter_driver_filter_message (m->driver, NULL, info, uid, m->folder, source_url, source_url, NULL);
 
 			camel_folder_free_message_info (m->folder, info);
 		}
 
-		camel_filter_driver_flush (m->driver, &ex);
-		if (!camel_exception_is_set (&m->ex))
-			camel_exception_xfer (&m->ex, &ex);
+		camel_filter_driver_flush (m->driver, &local_error);
+		if (m->error == NULL)
+			g_propagate_error (&m->error, local_error);
 
 		g_free (source_url);
 
@@ -231,7 +228,7 @@ filter_free (CamelSession *session, CamelSessionThreadMsg *msg)
 	if (m->notjunk)
 		camel_folder_free_deep (m->folder, m->notjunk);
 
-	camel_folder_summary_save_to_db (m->folder->summary, &m->ex);
+	camel_folder_summary_save_to_db (m->folder->summary, &m->error);
 	camel_folder_thaw (m->folder);
 	g_object_unref (m->folder);
 }
@@ -261,14 +258,15 @@ folder_transfer_message_to (CamelFolder *source,
                             CamelFolder *dest,
                             gchar **transferred_uid,
                             gboolean delete_original,
-                            CamelException *ex)
+                            GError **error)
 {
 	CamelMimeMessage *msg;
 	CamelMessageInfo *minfo, *info;
+	GError *local_error = NULL;
 
 	/* Default implementation. */
 
-	msg = camel_folder_get_message (source, uid, ex);
+	msg = camel_folder_get_message (source, uid, error);
 	if (!msg)
 		return;
 
@@ -283,11 +281,16 @@ folder_transfer_message_to (CamelFolder *source,
 	/* we don't want to retain the deleted flag */
 	camel_message_info_set_flags (info, CAMEL_MESSAGE_DELETED, 0);
 
-	camel_folder_append_message (dest, msg, info, transferred_uid, ex);
+	camel_folder_append_message (
+		dest, msg, info, transferred_uid, &local_error);
 	g_object_unref (msg);
 
-	if (delete_original && !camel_exception_is_set (ex))
-		camel_folder_set_message_flags (source, uid, CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_SEEN, ~0);
+	if (local_error != NULL)
+		g_propagate_error (error, local_error);
+	else if (delete_original)
+		camel_folder_set_message_flags (
+			source, uid, CAMEL_MESSAGE_DELETED |
+			CAMEL_MESSAGE_SEEN, ~0);
 
 	camel_message_info_free (info);
 }
@@ -418,7 +421,7 @@ folder_finalize (GObject *object)
 
 static gboolean
 folder_refresh_info (CamelFolder *folder,
-                     CamelException *ex)
+                     GError **error)
 {
 	return TRUE;
 }
@@ -564,7 +567,7 @@ folder_get_uids (CamelFolder *folder)
 static GPtrArray *
 folder_get_uncached_uids (CamelFolder *folder,
                           GPtrArray * uids,
-                          CamelException *ex)
+                          GError **error)
 {
 	GPtrArray *result;
 	gint i;
@@ -670,21 +673,17 @@ folder_transfer_messages_to (CamelFolder *source,
                              CamelFolder *dest,
                              GPtrArray **transferred_uids,
                              gboolean delete_originals,
-                             CamelException *ex)
+                             GError **error)
 {
-	CamelException local;
 	gchar **ret_uid = NULL;
 	gint i;
+	GError *local_error = NULL;
 
 	if (transferred_uids) {
 		*transferred_uids = g_ptr_array_new ();
 		g_ptr_array_set_size (*transferred_uids, uids->len);
 	}
 
-	camel_exception_init (&local);
-	if (ex == NULL)
-		ex = &local;
-
 	if (delete_originals)
 		camel_operation_start (NULL, _("Moving messages"));
 	else
@@ -695,12 +694,13 @@ folder_transfer_messages_to (CamelFolder *source,
 		if (delete_originals)
 			camel_folder_freeze (source);
 	}
-	for (i = 0; i < uids->len && !camel_exception_is_set (ex); i++) {
+
+	for (i = 0; i < uids->len && local_error != NULL; i++) {
 		if (transferred_uids)
 			ret_uid = (gchar **)&((*transferred_uids)->pdata[i]);
 		folder_transfer_message_to (
-			source, uids->pdata[i], dest,
-			ret_uid, delete_originals, ex);
+			source, uids->pdata[i], dest, ret_uid,
+			delete_originals, &local_error);
 		camel_operation_progress (NULL, i * 100 / uids->len);
 	}
 
@@ -711,7 +711,9 @@ folder_transfer_messages_to (CamelFolder *source,
 	}
 
 	camel_operation_end (NULL);
-	camel_exception_clear (&local);
+
+	if (local_error != NULL)
+		g_propagate_error (error, local_error);
 
 	return TRUE;
 }
@@ -870,7 +872,6 @@ folder_changed (CamelFolder *folder,
 		camel_folder_change_info_cat (folder->priv->changed_frozen, info);
 		camel_folder_unlock (folder, CAMEL_FOLDER_CHANGE_LOCK);
 		msg->driver = driver;
-		camel_exception_init (&msg->ex);
 		camel_session_thread_queue (session, &msg->msg, 0);
 		g_signal_stop_emission (folder, signals[CHANGED], 0);
 	}
@@ -1037,6 +1038,19 @@ camel_folder_init (CamelFolder *folder)
 	g_static_mutex_init (&folder->priv->change_lock);
 }
 
+GQuark
+camel_folder_error_quark (void)
+{
+	static GQuark quark = 0;
+
+	if (G_UNLIKELY (quark == 0)) {
+		const gchar *string = "camel-folder-error-quark";
+		quark = g_quark_from_static_string (string);
+	}
+
+	return quark;
+}
+
 /**
  * camel_folder_set_lock_async:
  * @folder: a #CamelFolder
@@ -1063,9 +1077,10 @@ camel_folder_set_lock_async (CamelFolder *folder,
 gchar *
 camel_folder_get_filename (CamelFolder *folder,
                            const gchar *uid,
-                           CamelException *ex)
+                           GError **error)
 {
 	CamelFolderClass *class;
+	gchar *filename;
 
 	g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
 	g_return_val_if_fail (uid != NULL, NULL);
@@ -1073,14 +1088,17 @@ camel_folder_get_filename (CamelFolder *folder,
 	class = CAMEL_FOLDER_GET_CLASS (folder);
 	g_return_val_if_fail (class->get_filename != NULL, NULL);
 
-	return class->get_filename (folder, uid, ex);
+	filename = class->get_filename (folder, uid, error);
+	CAMEL_CHECK_GERROR (folder, get_filename, filename != NULL, error);
+
+	return filename;
 }
 
 /**
  * camel_folder_sync:
  * @folder: a #CamelFolder
  * @expunge: whether or not to expunge deleted messages
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Sync changes made to a folder to its backing store, possibly
  * expunging deleted messages as well.
@@ -1090,7 +1108,7 @@ camel_folder_get_filename (CamelFolder *folder,
 gboolean
 camel_folder_sync (CamelFolder *folder,
                    gboolean expunge,
-                   CamelException *ex)
+                   GError **error)
 {
 	CamelFolderClass *class;
 	gboolean success = TRUE;
@@ -1102,8 +1120,10 @@ camel_folder_sync (CamelFolder *folder,
 
 	camel_folder_lock (folder, CAMEL_FOLDER_REC_LOCK);
 
-	if (!(folder->folder_flags & CAMEL_FOLDER_HAS_BEEN_DELETED))
-		success = class->sync (folder, expunge, ex);
+	if (!(folder->folder_flags & CAMEL_FOLDER_HAS_BEEN_DELETED)) {
+		success = class->sync (folder, expunge, error);
+		CAMEL_CHECK_GERROR (folder, sync, success, error);
+	}
 
 	camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
 
@@ -1113,7 +1133,7 @@ camel_folder_sync (CamelFolder *folder,
 /**
  * camel_folder_refresh_info:
  * @folder: a #CamelFolder
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Updates a folder's summary to be in sync with its backing store.
  *
@@ -1121,7 +1141,7 @@ camel_folder_sync (CamelFolder *folder,
  **/
 gboolean
 camel_folder_refresh_info (CamelFolder *folder,
-                           CamelException *ex)
+                           GError **error)
 {
 	CamelFolderClass *class;
 	gboolean success;
@@ -1133,7 +1153,8 @@ camel_folder_refresh_info (CamelFolder *folder,
 
 	camel_folder_lock (folder, CAMEL_FOLDER_REC_LOCK);
 
-	success = class->refresh_info (folder, ex);
+	success = class->refresh_info (folder, error);
+	CAMEL_CHECK_GERROR (folder, refresh_info, success, error);
 
 	camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
 
@@ -1275,7 +1296,7 @@ camel_folder_get_parent_store (CamelFolder *folder)
 /**
  * camel_folder_expunge:
  * @folder: a #CamelFolder
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Delete messages which have been marked as "DELETED"
  *
@@ -1283,7 +1304,7 @@ camel_folder_get_parent_store (CamelFolder *folder)
  **/
 gboolean
 camel_folder_expunge (CamelFolder *folder,
-                      CamelException *ex)
+                      GError **error)
 {
 	CamelFolderClass *class;
 	gboolean success = TRUE;
@@ -1295,8 +1316,10 @@ camel_folder_expunge (CamelFolder *folder,
 
 	camel_folder_lock (folder, CAMEL_FOLDER_REC_LOCK);
 
-	if (!(folder->folder_flags & CAMEL_FOLDER_HAS_BEEN_DELETED))
-		success = class->expunge (folder, ex);
+	if (!(folder->folder_flags & CAMEL_FOLDER_HAS_BEEN_DELETED)) {
+		success = class->expunge (folder, error);
+		CAMEL_CHECK_GERROR (folder, expunge, success, error);
+	}
 
 	camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
 
@@ -1364,7 +1387,7 @@ camel_folder_get_deleted_message_count (CamelFolder *folder)
  * new message, or %NULL
  * @appended_uid: if non-%NULL, the UID of the appended message will
  * be returned here, if it is known.
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Append @message to @folder. Only the flag and tag data from @info
  * are used. If @info is %NULL, no flags or tags will be set.
@@ -1376,7 +1399,7 @@ camel_folder_append_message (CamelFolder *folder,
                              CamelMimeMessage *message,
                              const CamelMessageInfo *info,
                              gchar **appended_uid,
-                             CamelException *ex)
+                             GError **error)
 {
 	CamelFolderClass *class;
 	gboolean success;
@@ -1390,7 +1413,8 @@ camel_folder_append_message (CamelFolder *folder,
 	camel_folder_lock (folder, CAMEL_FOLDER_REC_LOCK);
 
 	success = class->append_message (
-		folder, message, info, appended_uid, ex);
+		folder, message, info, appended_uid, error);
+	CAMEL_CHECK_GERROR (folder, append_message, success, error);
 
 	camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
 
@@ -1703,7 +1727,7 @@ camel_folder_has_summary_capability (CamelFolder *folder)
  * camel_folder_get_message:
  * @folder: a #CamelFolder
  * @uid: the UID
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Get a message from its UID in the folder.
  *
@@ -1712,7 +1736,7 @@ camel_folder_has_summary_capability (CamelFolder *folder)
 CamelMimeMessage *
 camel_folder_get_message (CamelFolder *folder,
                           const gchar *uid,
-                          CamelException *ex)
+                          GError **error)
 {
 	CamelFolderClass *class;
 	CamelMimeMessage *ret;
@@ -1725,7 +1749,8 @@ camel_folder_get_message (CamelFolder *folder,
 
 	camel_folder_lock (folder, CAMEL_FOLDER_REC_LOCK);
 
-	ret = class->get_message (folder, uid, ex);
+	ret = class->get_message (folder, uid, error);
+	CAMEL_CHECK_GERROR (folder, get_message, ret != NULL, error);
 
 	camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
 
@@ -1743,7 +1768,7 @@ camel_folder_get_message (CamelFolder *folder,
  * camel_folder_sync_message:
  * @folder: a #CamelFolder
  * @uid: the UID
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Ensure that a message identified by UID has been synced in the folder (so
  * that camel_folder_get_message on it later will work in offline mode).
@@ -1755,7 +1780,7 @@ camel_folder_get_message (CamelFolder *folder,
 gboolean
 camel_folder_sync_message (CamelFolder *folder,
                            const gchar *uid,
-                           CamelException *ex)
+                           GError **error)
 {
 	CamelFolderClass *class;
 	gboolean success = FALSE;
@@ -1769,12 +1794,15 @@ camel_folder_sync_message (CamelFolder *folder,
 	camel_folder_lock (folder, CAMEL_FOLDER_REC_LOCK);
 
 	/* Use the sync_message method if the class implements it. */
-	if (class->sync_message != NULL)
-		success = class->sync_message (folder, uid, ex);
-	else {
+	if (class->sync_message != NULL) {
+		success = class->sync_message (folder, uid, error);
+		CAMEL_CHECK_GERROR (folder, sync_message, success, error);
+	} else {
 		CamelMimeMessage *message;
 
-		message = class->get_message (folder, uid, ex);
+		message = class->get_message (folder, uid, error);
+		CAMEL_CHECK_GERROR (folder, get_message, message != NULL, error);
+
 		if (message != NULL) {
 			g_object_unref (message);
 			success = TRUE;
@@ -1847,10 +1875,11 @@ camel_folder_free_uids (CamelFolder *folder,
  **/
 GPtrArray *
 camel_folder_get_uncached_uids (CamelFolder *folder,
-                                GPtrArray * uids,
-                                CamelException *ex)
+                                GPtrArray *uids,
+                                GError **error)
 {
 	CamelFolderClass *class;
+	GPtrArray *uncached_uids;
 
 	g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
 	g_return_val_if_fail (uids != NULL, NULL);
@@ -1858,7 +1887,10 @@ camel_folder_get_uncached_uids (CamelFolder *folder,
 	class = CAMEL_FOLDER_GET_CLASS (folder);
 	g_return_val_if_fail (class->get_uncached_uids != NULL, NULL);
 
-	return class->get_uncached_uids (folder, uids, ex);
+	uncached_uids = class->get_uncached_uids (folder, uids, error);
+	CAMEL_CHECK_GERROR (folder, get_uncached_uids, uncached_uids != NULL, error);
+
+	return uncached_uids;
 }
 
 /**
@@ -1980,7 +2012,7 @@ camel_folder_has_search_capability (CamelFolder *folder)
  * camel_folder_search_by_expression:
  * @folder: a #CamelFolder
  * @expr: a search expression
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Searches the folder for messages matching the given search expression.
  *
@@ -1990,9 +2022,10 @@ camel_folder_has_search_capability (CamelFolder *folder)
 GPtrArray *
 camel_folder_search_by_expression (CamelFolder *folder,
                                    const gchar *expression,
-                                   CamelException *ex)
+                                   GError **error)
 {
 	CamelFolderClass *class;
+	GPtrArray *matches;
 
 	g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
 	g_return_val_if_fail (folder->folder_flags & CAMEL_FOLDER_HAS_SEARCH_CAPABILITY, NULL);
@@ -2002,14 +2035,17 @@ camel_folder_search_by_expression (CamelFolder *folder,
 
 	/* NOTE: that it is upto the callee to CAMEL_FOLDER_REC_LOCK */
 
-	return class->search_by_expression (folder, expression, ex);
+	matches = class->search_by_expression (folder, expression, error);
+	CAMEL_CHECK_GERROR (folder, search_by_expression, matches != NULL, error);
+
+	return matches;
 }
 
 /**
  * camel_folder_count_by_expression:
  * @folder: a #CamelFolder
  * @expr: a search expression
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Searches the folder for count of messages matching the given search expression.
  *
@@ -2020,7 +2056,7 @@ camel_folder_search_by_expression (CamelFolder *folder,
 guint32
 camel_folder_count_by_expression (CamelFolder *folder,
                                   const gchar *expression,
-                                  CamelException *ex)
+                                  GError **error)
 {
 	CamelFolderClass *class;
 
@@ -2032,7 +2068,7 @@ camel_folder_count_by_expression (CamelFolder *folder,
 
 	/* NOTE: that it is upto the callee to CAMEL_FOLDER_REC_LOCK */
 
-	return class->count_by_expression (folder, expression, ex);
+	return class->count_by_expression (folder, expression, error);
 }
 
 /**
@@ -2040,7 +2076,7 @@ camel_folder_count_by_expression (CamelFolder *folder,
  * @folder: a #CamelFolder
  * @expr: search expression
  * @uids: array of uid's to match against.
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Search a subset of uid's for an expression match.
  *
@@ -2051,9 +2087,10 @@ GPtrArray *
 camel_folder_search_by_uids (CamelFolder *folder,
                              const gchar *expr,
                              GPtrArray *uids,
-                             CamelException *ex)
+                             GError **error)
 {
 	CamelFolderClass *class;
+	GPtrArray *matches;
 
 	g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
 	g_return_val_if_fail (folder->folder_flags & CAMEL_FOLDER_HAS_SEARCH_CAPABILITY, NULL);
@@ -2063,7 +2100,10 @@ camel_folder_search_by_uids (CamelFolder *folder,
 
 	/* NOTE: that it is upto the callee to CAMEL_FOLDER_REC_LOCK */
 
-	return class->search_by_uids (folder, expr, uids, ex);
+	matches = class->search_by_uids (folder, expr, uids, error);
+	CAMEL_CHECK_GERROR (folder, search_by_uids, matches != NULL, error);
+
+	return matches;
 }
 
 /**
@@ -2099,7 +2139,7 @@ camel_folder_search_free (CamelFolder *folder,
  * @transferred_uids: if non-%NULL, the UIDs of the resulting messages
  * in @dest will be stored here, if known.
  * @delete_originals: whether or not to delete the original messages
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * This copies or moves messages from one folder to another. If the
  * @source and @dest folders have the same parent_store, this may be
@@ -2113,7 +2153,7 @@ camel_folder_transfer_messages_to (CamelFolder *source,
                                    CamelFolder *dest,
                                    GPtrArray **transferred_uids,
                                    gboolean delete_originals,
-                                   CamelException *ex)
+                                   GError **error)
 {
 	CamelFolderClass *class;
 	gboolean success;
@@ -2136,11 +2176,11 @@ camel_folder_transfer_messages_to (CamelFolder *source,
 			class = CAMEL_FOLDER_GET_CLASS (source);
 		success = class->transfer_messages_to (
 			source, uids, dest, transferred_uids,
-			delete_originals, ex);
+			delete_originals, error);
 	} else
 		success = folder_transfer_messages_to (
 			source, uids, dest, transferred_uids,
-			delete_originals, ex);
+			delete_originals, error);
 
 	return success;
 }
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
index 2c3517c..18eb881 100644
--- a/camel/camel-folder.h
+++ b/camel/camel-folder.h
@@ -50,6 +50,14 @@
 	(G_TYPE_INSTANCE_GET_CLASS \
 	((obj), CAMEL_TYPE_FOLDER, CamelFolderClass))
 
+/**
+ * CAMEL_FOLDER_ERROR:
+ *
+ * Since: 3.0
+ **/
+#define CAMEL_FOLDER_ERROR \
+	(camel_folder_error_quark ())
+
 G_BEGIN_DECLS
 
 struct _CamelStore;
@@ -62,6 +70,22 @@ typedef struct _CamelFolderClass CamelFolderClass;
 typedef struct _CamelFolderPrivate CamelFolderPrivate;
 
 /**
+ * CamelFolderError:
+ *
+ * Since: 3.0
+ **/
+typedef enum {
+	CAMEL_FOLDER_ERROR_INVALID,
+	CAMEL_FOLDER_ERROR_INVALID_STATE,
+	CAMEL_FOLDER_ERROR_NON_EMPTY,
+	CAMEL_FOLDER_ERROR_NON_UID,
+	CAMEL_FOLDER_ERROR_INSUFFICIENT_PERMISSION,
+	CAMEL_FOLDER_ERROR_INVALID_PATH,
+	CAMEL_FOLDER_ERROR_INVALID_UID,
+	CAMEL_FOLDER_ERROR_SUMMARY_INVALID
+} CamelFolderError;
+
+/**
  * CamelFolderLock:
  *
  * Since: 3.0
@@ -121,18 +145,18 @@ struct _CamelFolderClass {
 
 	/* Methods */
 	gboolean	(*refresh_info)		(CamelFolder *folder,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*sync)			(CamelFolder *folder,
 						 gboolean expunge,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*expunge)		(CamelFolder *folder,
-						 CamelException *ex);
+						 GError **error);
 	gint		(*get_message_count)	(CamelFolder *folder);
 	gboolean	(*append_message)	(CamelFolder *folder,
 						 CamelMimeMessage *message,
 						 const CamelMessageInfo *info,
 						 gchar **appended_uid,
-						 CamelException *ex);
+						 GError **error);
 	guint32		(*get_permanent_flags)	(CamelFolder *folder);
 	guint32		(*get_message_flags)	(CamelFolder *folder,
 						 const gchar *uid);
@@ -156,7 +180,7 @@ struct _CamelFolderClass {
 	CamelMimeMessage *
 			(*get_message)		(CamelFolder *folder,
 						 const gchar *uid,
-						 CamelException *ex);
+						 GError **error);
 	GPtrArray *	(*get_uids)		(CamelFolder *folder);
 	void		(*free_uids)		(CamelFolder *folder,
 						 GPtrArray *array);
@@ -171,11 +195,11 @@ struct _CamelFolderClass {
 	gboolean	(*has_search_capability)(CamelFolder *folder);
 	GPtrArray *	(*search_by_expression)	(CamelFolder *folder,
 						 const gchar *expression,
-						 CamelException *ex);
+						 GError **error);
 	GPtrArray *	(*search_by_uids)	(CamelFolder *folder,
 						 const gchar *expression,
 						 GPtrArray *uids,
-						 CamelException *ex);
+						 GError **error);
 	void		(*search_free)		(CamelFolder *folder,
 						 GPtrArray *result);
 	CamelMessageInfo *
@@ -190,7 +214,7 @@ struct _CamelFolderClass {
 						 CamelFolder *destination,
 						 GPtrArray **transferred_uids,
 						 gboolean delete_originals,
-						 CamelException *ex);
+						 GError **error);
 	void		(*delete)		(CamelFolder *folder);
 	void		(*rename)		(CamelFolder *folder,
 						 const gchar *newname);
@@ -201,16 +225,16 @@ struct _CamelFolderClass {
 			(*get_quota_info)	(CamelFolder *folder);
 	guint32		(*count_by_expression)	(CamelFolder *folder,
 						 const gchar *expression,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*sync_message)		(CamelFolder *folder,
 						 const gchar *uid,
-						 CamelException *ex);
+						 GError **error);
 	GPtrArray *	(*get_uncached_uids)	(CamelFolder *folder,
-						 GPtrArray * uids,
-						 CamelException *ex);
+						 GPtrArray *uids,
+						 GError **error);
 	gchar *		(*get_filename)		(CamelFolder *folder,
 						 const gchar *uid,
-						 CamelException *ex);
+						 GError **error);
 
 	/* Signals */
 	void		(*changed)		(CamelFolder *folder,
@@ -221,11 +245,12 @@ struct _CamelFolderClass {
 };
 
 GType		camel_folder_get_type		(void);
+GQuark		camel_folder_error_quark	(void) G_GNUC_CONST;
 gboolean	camel_folder_refresh_info	(CamelFolder *folder,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_folder_sync		(CamelFolder *folder,
 						 gboolean expunge,
-						 CamelException *ex);
+						 GError **error);
 void		camel_folder_set_lock_async	(CamelFolder *folder,
 						 gboolean skip_folder_lock);
 
@@ -234,7 +259,7 @@ struct _CamelStore *
 
 /* delete operations */
 gboolean	camel_folder_expunge		(CamelFolder *folder,
-						 CamelException *ex);
+						 GError **error);
 
 /* folder name operations */
 const gchar *	camel_folder_get_name		(CamelFolder *folder);
@@ -287,7 +312,7 @@ gboolean	camel_folder_append_message	(CamelFolder *folder,
 						 CamelMimeMessage *message,
 						 const CamelMessageInfo *info,
 						 gchar **appended_uid,
-						 CamelException *ex);
+						 GError **error);
 
 /* summary related operations */
 gboolean	camel_folder_has_summary_capability
@@ -311,10 +336,11 @@ void		camel_folder_free_summary	(CamelFolder *folder,
 CamelMimeMessage *
 		camel_folder_get_message	(CamelFolder *folder,
 						 const gchar *uid,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_folder_sync_message	(CamelFolder *folder,
 						 const gchar *uid,
-						 CamelException *ex);
+						 GError **error);
+
 #define camel_folder_delete_message(folder, uid) \
 	(camel_folder_set_message_flags \
 	(folder, uid, CAMEL_MESSAGE_DELETED | \
@@ -325,7 +351,7 @@ void		camel_folder_free_uids		(CamelFolder *folder,
 						 GPtrArray *array);
 GPtrArray *	camel_folder_get_uncached_uids	(CamelFolder *folder,
 						 GPtrArray *uids,
-						 CamelException *ex);
+						 GError **error);
 gint		camel_folder_cmp_uids		(CamelFolder *folder,
 						 const gchar *uid1,
 						 const gchar *uid2);
@@ -338,16 +364,16 @@ gboolean	camel_folder_has_search_capability
 GPtrArray *	camel_folder_search_by_expression
 						(CamelFolder *folder,
 						 const gchar *expr,
-						 CamelException *ex);
+						 GError **error);
 GPtrArray *	camel_folder_search_by_uids	(CamelFolder *folder,
 						 const gchar *expr,
 						 GPtrArray *uids,
-						 CamelException *ex);
+						 GError **error);
 void		camel_folder_search_free	(CamelFolder *folder,
 						 GPtrArray *result);
 guint32		camel_folder_count_by_expression(CamelFolder *folder,
 						 const gchar *expression,
-						 CamelException *ex);
+						 GError **error);
 
 /* summary info */
 CamelMessageInfo *
@@ -366,7 +392,7 @@ gboolean	camel_folder_transfer_messages_to
 						 CamelFolder *dest,
 						 GPtrArray **transferred_uids,
 						 gboolean delete_originals,
-						 CamelException *ex);
+						 GError **error);
 
 void		camel_folder_delete		(CamelFolder *folder);
 void		camel_folder_rename		(CamelFolder *folder,
@@ -401,7 +427,7 @@ void		camel_folder_free_deep		(CamelFolder *folder,
 
 gchar *		camel_folder_get_filename	(CamelFolder *folder,
 						 const gchar *uid,
-						 CamelException *ex);
+						 GError **error);
 
 /* update functions for change info */
 CamelFolderChangeInfo *
diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c
index f6c390d..7ecd2ac 100644
--- a/camel/camel-gpg-context.c
+++ b/camel/camel-gpg-context.c
@@ -385,7 +385,7 @@ gpg_ctx_get_diagnostics (struct _GpgCtx *gpg)
 {
 	if (!gpg->diagflushed) {
 		gpg->diagflushed = TRUE;
-		camel_stream_flush (gpg->diagnostics);
+		camel_stream_flush (gpg->diagnostics, NULL);
 		if (gpg->diagbuf->len == 0)
 			return NULL;
 
@@ -589,8 +589,9 @@ gpg_ctx_get_argv (struct _GpgCtx *gpg, gint status_fd, gchar **sfd, gint passwd_
 
 #endif
 
-static gint
-gpg_ctx_op_start (struct _GpgCtx *gpg)
+static gboolean
+gpg_ctx_op_start (struct _GpgCtx *gpg,
+                  GError **error)
 {
 #ifndef G_OS_WIN32
 	gchar *status_fd = NULL, *passwd_fd = NULL;
@@ -674,9 +675,9 @@ gpg_ctx_op_start (struct _GpgCtx *gpg)
 	flags = fcntl (gpg->status_fd, F_GETFL);
 	fcntl (gpg->status_fd, F_SETFL, flags | O_NONBLOCK);
 
-	return 0;
+	return TRUE;
 
- exception:
+exception:
 
 	errnosave = errno;
 
@@ -693,7 +694,18 @@ gpg_ctx_op_start (struct _GpgCtx *gpg)
 	errno = EINVAL;
 #endif
 
-	return -1;
+	if (errno != 0)
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			_("Failed to execute gpg: %s"),
+			g_strerror (errno));
+	else
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+			_("Failed to execute gpg: %s"), _("Unknown"));
+
+	return FALSE;
 }
 
 #ifndef G_OS_WIN32
@@ -724,7 +736,7 @@ next_token (const gchar *in, gchar **token)
 
 static gint
 gpg_ctx_parse_status (struct _GpgCtx *gpg,
-                      CamelException *ex)
+                      GError **error)
 {
 	register guchar *inptr;
 	const guchar *status;
@@ -753,8 +765,8 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg,
 
 		message = g_locale_to_utf8 (
 			(const gchar *) status, -1, NULL, NULL, NULL);
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Unexpected GnuPG status message encountered:\n\n%s"),
 			message);
 		g_free(message);
@@ -770,8 +782,8 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg,
 		status += 12;
 		status = (const guchar *) next_token ((gchar *) status, &hint);
 		if (!hint) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Failed to parse gpg userid hint."));
 			return -1;
 		}
@@ -795,8 +807,8 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg,
 
 		status = (const guchar *) next_token ((gchar *) status, &userid);
 		if (!userid) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Failed to parse gpg passphrase request."));
 			return -1;
 		}
@@ -810,8 +822,8 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg,
 
 		status = (const guchar *) next_token ((gchar *) status, &userid);
 		if (!userid) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Failed to parse gpg passphrase request."));
 			return -1;
 		}
@@ -822,6 +834,7 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg,
 		const gchar *name = NULL;
 		gchar *prompt, *passwd;
 		guint32 flags;
+		GError *local_error = NULL;
 
 		status += 11;
 
@@ -840,8 +853,8 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg,
 				  "user: \"%s\""), name);
 		} else {
 			next_token ((gchar *) status, &prompt);
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Unexpected request from GnuPG for '%s'"),
 				prompt);
 			g_free (prompt);
@@ -849,7 +862,7 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg,
 		}
 
 		flags = CAMEL_SESSION_PASSWORD_SECRET | CAMEL_SESSION_PASSPHRASE;
-		if ((passwd = camel_session_get_password (gpg->session, NULL, NULL, prompt, gpg->need_id, flags, ex))) {
+		if ((passwd = camel_session_get_password (gpg->session, NULL, NULL, prompt, gpg->need_id, flags, &local_error))) {
 			if (!gpg->utf8) {
 				gchar *opasswd = passwd;
 
@@ -867,10 +880,13 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg,
 
 			gpg->send_passwd = TRUE;
 		} else {
-			if (!camel_exception_is_set (ex))
-				camel_exception_set (
-					ex, CAMEL_EXCEPTION_USER_CANCEL,
-					_("Canceled."));
+			if (local_error == NULL)
+				g_set_error (
+					error, G_IO_ERROR,
+					G_IO_ERROR_CANCELLED,
+					_("Cancelled"));
+			g_propagate_error (error, local_error);
+
 			return -1;
 		}
 
@@ -880,11 +896,12 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg,
 	} else if (!strncmp ((gchar *) status, "BAD_PASSPHRASE", 14)) {
 		gpg->bad_passwds++;
 
-		camel_session_forget_password (gpg->session, NULL, NULL, gpg->need_id, ex);
+		camel_session_forget_password (gpg->session, NULL, NULL, gpg->need_id, error);
 
 		if (gpg->bad_passwds == 3) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				_("Failed to unlock secret key: "
 				  "3 bad passphrases given."));
 			return -1;
@@ -895,8 +912,8 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg,
 
 		message = g_locale_to_utf8 (
 			(const gchar *) status+11, -1, NULL, NULL, NULL);
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Unexpected response from GnuPG: %s"), message);
 		g_free (message);
 
@@ -1026,8 +1043,8 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg,
 			} else if (!strncmp ((gchar *) status, "END_ENCRYPTION", 14)) {
 				/* nothing to do, but we know the end is near? */
 			} else if (!strncmp ((gchar *) status, "NO_RECP", 7)) {
-				camel_exception_set (
-					ex, CAMEL_EXCEPTION_SYSTEM,
+				g_set_error (
+					error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 					_("Failed to encrypt: No valid recipients specified."));
 				return -1;
 			}
@@ -1105,7 +1122,7 @@ gpg_ctx_op_cancel (struct _GpgCtx *gpg)
 
 static gint
 gpg_ctx_op_step (struct _GpgCtx *gpg,
-                 CamelException *ex)
+                 GError **error)
 {
 #ifndef G_OS_WIN32
 	GPollFD polls[6];
@@ -1152,8 +1169,10 @@ gpg_ctx_op_step (struct _GpgCtx *gpg,
 		goto exception;
 
 	if ((polls[5].revents & G_IO_IN) && camel_operation_cancel_check(NULL)) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_USER_CANCEL, _("Canceled."));
+		g_set_error (
+			error, G_IO_ERROR,
+			G_IO_ERROR_CANCELLED,
+			_("Cancelled"));
 		gpg_ctx_op_cancel(gpg);
 
 		return -1;
@@ -1181,7 +1200,7 @@ gpg_ctx_op_step (struct _GpgCtx *gpg,
 		if (nread > 0) {
 			status_backup (gpg, buffer, nread);
 
-			if (gpg_ctx_parse_status (gpg, ex) == -1)
+			if (gpg_ctx_parse_status (gpg, error) == -1)
 				return -1;
 		} else {
 			gpg->complete = TRUE;
@@ -1202,9 +1221,9 @@ gpg_ctx_op_step (struct _GpgCtx *gpg,
 
 		if (nread > 0) {
 			gsize written = camel_stream_write (
-				gpg->ostream, buffer, (gsize) nread);
+				gpg->ostream, buffer, (gsize) nread, error);
 			if (written != nread)
-				goto exception;
+				return -1;
 		} else {
 			gpg->seen_eof1 = TRUE;
 		}
@@ -1225,7 +1244,7 @@ gpg_ctx_op_step (struct _GpgCtx *gpg,
 			goto exception;
 
 		if (nread > 0) {
-			camel_stream_write (gpg->diagnostics, buffer, nread);
+			camel_stream_write (gpg->diagnostics, buffer, nread, error);
 		} else {
 			gpg->seen_eof2 = TRUE;
 		}
@@ -1267,7 +1286,7 @@ gpg_ctx_op_step (struct _GpgCtx *gpg,
 
 		/* write our stream to gpg's stdin */
 		nread = camel_stream_read (
-			gpg->istream, buffer, sizeof (buffer));
+			gpg->istream, buffer, sizeof (buffer), NULL);
 		if (nread > 0) {
 			gssize w, nwritten = 0;
 
@@ -1305,8 +1324,9 @@ gpg_ctx_op_step (struct _GpgCtx *gpg,
 
  exception:
 	/* always called on an i/o error */
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, G_IO_ERROR,
+		g_io_error_from_errno (errno),
 		_("Failed to execute gpg: %s"), g_strerror (errno));
 	gpg_ctx_op_cancel(gpg);
 #endif
@@ -1388,7 +1408,7 @@ gpg_sign (CamelCipherContext *context,
           CamelCipherHash hash,
           CamelMimePart *ipart,
           CamelMimePart *opart,
-          CamelException *ex)
+          GError **error)
 {
 	struct _GpgCtx *gpg = NULL;
 	CamelCipherContextClass *class;
@@ -1409,11 +1429,9 @@ gpg_sign (CamelCipherContext *context,
 		ipart, CAMEL_MIME_FILTER_CANON_STRIP |
 		CAMEL_MIME_FILTER_CANON_CRLF |
 		CAMEL_MIME_FILTER_CANON_FROM,
-		istream) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Could not generate signing data: %s"),
-			g_strerror(errno));
+		istream, error) == -1) {
+		g_prefix_error (
+			error, _("Could not generate signing data: "));
 		goto fail;
 	}
 
@@ -1443,16 +1461,11 @@ gpg_sign (CamelCipherContext *context,
 	gpg_ctx_set_istream (gpg, istream);
 	gpg_ctx_set_ostream (gpg, ostream);
 
-	if (gpg_ctx_op_start (gpg) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Failed to execute gpg: %s"),
-			g_strerror (errno));
+	if (!gpg_ctx_op_start (gpg, error))
 		goto fail;
-	}
 
 	while (!gpg_ctx_op_complete (gpg)) {
-		if (gpg_ctx_op_step (gpg, ex) == -1) {
+		if (gpg_ctx_op_step (gpg, error) == -1) {
 			gpg_ctx_op_cancel (gpg);
 			goto fail;
 		}
@@ -1462,8 +1475,8 @@ gpg_sign (CamelCipherContext *context,
 		const gchar *diagnostics;
 
 		diagnostics = gpg_ctx_get_diagnostics (gpg);
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC, "%s",
 			(diagnostics != NULL && *diagnostics != '\0') ?
 			diagnostics : _("Failed to execute gpg."));
 
@@ -1473,8 +1486,8 @@ gpg_sign (CamelCipherContext *context,
 	res = 0;
 
 	dw = camel_data_wrapper_new();
-	camel_stream_reset(ostream);
-	camel_data_wrapper_construct_from_stream(dw, ostream);
+	camel_stream_reset(ostream, NULL);
+	camel_data_wrapper_construct_from_stream(dw, ostream, NULL);
 
 	sigpart = camel_mime_part_new();
 	ct = camel_content_type_new("application", "pgp-signature");
@@ -1497,7 +1510,7 @@ gpg_sign (CamelCipherContext *context,
 
 	mps->signature = sigpart;
 	mps->contentraw = istream;
-	camel_stream_reset(istream);
+	camel_stream_reset(istream, NULL);
 	g_object_ref (istream);
 
 	camel_medium_set_content ((CamelMedium *)opart, (CamelDataWrapper *)mps);
@@ -1511,7 +1524,8 @@ fail:
 }
 
 static gchar *
-swrite (CamelMimePart *sigpart)
+swrite (CamelMimePart *sigpart,
+        GError **error)
 {
 	CamelStream *ostream;
 	gchar *template;
@@ -1527,11 +1541,11 @@ swrite (CamelMimePart *sigpart)
 
 	ostream = camel_stream_fs_new_with_fd (fd);
 	ret = camel_data_wrapper_write_to_stream (
-		CAMEL_DATA_WRAPPER (sigpart), ostream);
+		CAMEL_DATA_WRAPPER (sigpart), ostream, error);
 	if (ret != -1) {
-		ret = camel_stream_flush (ostream);
+		ret = camel_stream_flush (ostream, error);
 		if (ret != -1)
-			ret = camel_stream_close (ostream);
+			ret = camel_stream_close (ostream, error);
 	}
 
 	g_object_unref (ostream);
@@ -1575,7 +1589,7 @@ add_signers (CamelCipherValidity *validity, const GString *signers)
 static CamelCipherValidity *
 gpg_verify (CamelCipherContext *context,
             CamelMimePart *ipart,
-            CamelException *ex)
+            GError **error)
 {
 	CamelCipherContextClass *class;
 	CamelCipherValidity *validity;
@@ -1603,24 +1617,24 @@ gpg_verify (CamelCipherContext *context,
 		if (!CAMEL_IS_MULTIPART_SIGNED(mps)
 		    || tmp == NULL
 		    || g_ascii_strcasecmp(tmp, class->sign_protocol) != 0) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Cannot verify message signature: "
 				  "Incorrect message format"));
 			return NULL;
 		}
 
 		if (!(istream = camel_multipart_signed_get_content_stream ((CamelMultipartSigned *) mps, NULL))) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Cannot verify message signature: "
 				  "Incorrect message format"));
 			return NULL;
 		}
 
 		if (!(sigpart = camel_multipart_get_part (mps, CAMEL_MULTIPART_SIGNED_SIGNATURE))) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Cannot verify message signature: "
 				  "Incorrect message format"));
 			g_object_unref (istream);
@@ -1631,13 +1645,13 @@ gpg_verify (CamelCipherContext *context,
 		CamelDataWrapper *content;
 		content = camel_medium_get_content ((CamelMedium *) ipart);
 		istream = camel_stream_mem_new();
-		camel_data_wrapper_decode_to_stream (content, istream);
-		camel_stream_reset(istream);
+		camel_data_wrapper_decode_to_stream (content, istream, NULL);
+		camel_stream_reset(istream, NULL);
 		sigpart = NULL;
 	} else {
 		/* Invalid Mimetype */
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot verify message signature: "
 			  "Incorrect message format"));
 		return NULL;
@@ -1675,18 +1689,15 @@ gpg_verify (CamelCipherContext *context,
 #endif
 
 	if (sigpart) {
-		sigfile = swrite (sigpart);
+		sigfile = swrite (sigpart, error);
 		if (sigfile == NULL) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
-				_("Cannot verify message signature: "
-				  "could not create temp file: %s"),
-				g_strerror (errno));
+			g_prefix_error (
+				error, _("Cannot verify message signature: "));
 			goto exception;
 		}
 	}
 
-	camel_stream_reset(istream);
+	camel_stream_reset (istream, NULL);
 	canon_stream = camel_stream_mem_new ();
 
 	/* strip trailing white-spaces */
@@ -1695,12 +1706,12 @@ gpg_verify (CamelCipherContext *context,
 	camel_stream_filter_add (CAMEL_STREAM_FILTER (filter), canon);
 	g_object_unref (canon);
 
-	camel_stream_write_to_stream (istream, filter);
+	camel_stream_write_to_stream (istream, filter, NULL);
 
 	g_object_unref (filter);
-	camel_stream_reset (istream);
+	camel_stream_reset (istream, NULL);
 
-	camel_stream_reset (canon_stream);
+	camel_stream_reset (canon_stream, NULL);
 
 	gpg = gpg_ctx_new (context);
 	gpg_ctx_set_mode (gpg, GPG_CTX_MODE_VERIFY);
@@ -1708,15 +1719,11 @@ gpg_verify (CamelCipherContext *context,
                 gpg_ctx_set_sigfile (gpg, sigfile);
 	gpg_ctx_set_istream (gpg, canon_stream);
 
-	if (gpg_ctx_op_start (gpg) == -1) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Failed to execute gpg."));
+	if (!gpg_ctx_op_start (gpg, error))
 		goto exception;
-	}
 
 	while (!gpg_ctx_op_complete (gpg)) {
-		if (gpg_ctx_op_step (gpg, ex) == -1) {
+		if (gpg_ctx_op_step (gpg, error) == -1) {
 			gpg_ctx_op_cancel (gpg);
 			goto exception;
 		}
@@ -1727,8 +1734,8 @@ gpg_verify (CamelCipherContext *context,
 		const gchar *diagnostics;
 
 		diagnostics = gpg_ctx_get_diagnostics (gpg);
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC, "%s",
 			(diagnostics != NULL && *diagnostics != '\0') ?
 			diagnostics : _("Failed to execute gpg."));
 		goto exception;
@@ -1785,7 +1792,7 @@ gpg_encrypt (CamelCipherContext *context,
              GPtrArray *recipients,
              CamelMimePart *ipart,
              CamelMimePart *opart,
-             CamelException *ex)
+             GError **error)
 {
 	CamelCipherContextClass *class;
 	CamelGpgContext *ctx = (CamelGpgContext *) context;
@@ -1801,10 +1808,10 @@ gpg_encrypt (CamelCipherContext *context,
 
 	ostream = camel_stream_mem_new();
 	istream = camel_stream_mem_new();
-	if (camel_cipher_canonical_to_stream(ipart, CAMEL_MIME_FILTER_CANON_CRLF, istream) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Could not generate encrypting data: %s"), g_strerror(errno));
+	if (camel_cipher_canonical_to_stream (
+		ipart, CAMEL_MIME_FILTER_CANON_CRLF, istream, error) == -1) {
+		g_prefix_error (
+			error, _("Could not generate encrypting data: "));
 		goto fail1;
 	}
 
@@ -1820,16 +1827,12 @@ gpg_encrypt (CamelCipherContext *context,
 		gpg_ctx_add_recipient (gpg, recipients->pdata[i]);
 	}
 
-	if (gpg_ctx_op_start (gpg) == -1) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Failed to execute gpg."));
+	if (!gpg_ctx_op_start (gpg, error))
 		goto fail;
-	}
 
 	/* FIXME: move this to a common routine */
 	while (!gpg_ctx_op_complete(gpg)) {
-		if (gpg_ctx_op_step (gpg, ex) == -1) {
+		if (gpg_ctx_op_step (gpg, error) == -1) {
 			gpg_ctx_op_cancel (gpg);
 			goto fail;
 		}
@@ -1839,8 +1842,8 @@ gpg_encrypt (CamelCipherContext *context,
 		const gchar *diagnostics;
 
 		diagnostics = gpg_ctx_get_diagnostics (gpg);
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC, "%s",
 			(diagnostics != NULL && *diagnostics != '\0') ?
 			diagnostics : _("Failed to execute gpg."));
 		goto fail;
@@ -1849,7 +1852,7 @@ gpg_encrypt (CamelCipherContext *context,
 	res = 0;
 
 	dw = camel_data_wrapper_new();
-	camel_data_wrapper_construct_from_stream (dw, ostream);
+	camel_data_wrapper_construct_from_stream (dw, ostream, NULL);
 
 	encpart = camel_mime_part_new();
 	ct = camel_content_type_new("application", "octet-stream");
@@ -1863,13 +1866,13 @@ gpg_encrypt (CamelCipherContext *context,
 	camel_mime_part_set_description(encpart, _("This is a digitally encrypted message part"));
 
 	vstream = camel_stream_mem_new();
-	camel_stream_write (vstream, "Version: 1\n", strlen("Version: 1\n"));
-	camel_stream_reset (vstream);
+	camel_stream_write (vstream, "Version: 1\n", strlen("Version: 1\n"), NULL);
+	camel_stream_reset (vstream, NULL);
 
 	verpart = camel_mime_part_new();
 	dw = camel_data_wrapper_new();
 	camel_data_wrapper_set_mime_type(dw, class->encrypt_protocol);
-	camel_data_wrapper_construct_from_stream (dw, vstream);
+	camel_data_wrapper_construct_from_stream (dw, vstream, NULL);
 	g_object_unref (vstream);
 	camel_medium_set_content ((CamelMedium *)verpart, dw);
 	g_object_unref (dw);
@@ -1902,7 +1905,7 @@ static CamelCipherValidity *
 gpg_decrypt (CamelCipherContext *context,
              CamelMimePart *ipart,
              CamelMimePart *opart,
-             CamelException *ex)
+             GError **error)
 {
 	struct _GpgCtx *gpg;
 	CamelCipherValidity *valid = NULL;
@@ -1914,8 +1917,8 @@ gpg_decrypt (CamelCipherContext *context,
 	gint rv;
 
 	if (!ipart) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot decrypt message: Incorrect message format"));
 		return NULL;
 	}
@@ -1923,8 +1926,8 @@ gpg_decrypt (CamelCipherContext *context,
 	content = camel_medium_get_content ((CamelMedium *)ipart);
 
 	if (!content) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot decrypt message: Incorrect message format"));
 		return NULL;
 	}
@@ -1934,9 +1937,10 @@ gpg_decrypt (CamelCipherContext *context,
 	if (camel_content_type_is(ct, "multipart", "encrypted")) {
 		mp = (CamelMultipart *) camel_medium_get_content ((CamelMedium *) ipart);
 		if (!(encrypted = camel_multipart_get_part (mp, CAMEL_MULTIPART_ENCRYPTED_CONTENT))) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SYSTEM,
-				_("Failed to decrypt MIME part: protocol error"));
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+				_("Failed to decrypt MIME part: "
+				  "protocol error"));
 			return NULL;
 		}
 
@@ -1945,15 +1949,15 @@ gpg_decrypt (CamelCipherContext *context,
 		content = camel_medium_get_content ((CamelMedium *) ipart);
 	} else {
 		/* Invalid Mimetype */
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot decrypt message: Incorrect message format"));
 		return NULL;
 	}
 
 	istream = camel_stream_mem_new();
-	camel_data_wrapper_decode_to_stream (content, istream);
-	camel_stream_reset (istream);
+	camel_data_wrapper_decode_to_stream (content, istream, NULL);
+	camel_stream_reset (istream, NULL);
 
 	ostream = camel_stream_mem_new();
 	camel_stream_mem_set_secure((CamelStreamMem *)ostream);
@@ -1963,15 +1967,11 @@ gpg_decrypt (CamelCipherContext *context,
 	gpg_ctx_set_istream (gpg, istream);
 	gpg_ctx_set_ostream (gpg, ostream);
 
-	if (gpg_ctx_op_start (gpg) == -1) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Failed to execute gpg."));
+	if (!gpg_ctx_op_start (gpg, error))
 		goto fail;
-	}
 
 	while (!gpg_ctx_op_complete (gpg)) {
-		if (gpg_ctx_op_step (gpg, ex) == -1) {
+		if (gpg_ctx_op_step (gpg, error) == -1) {
 			gpg_ctx_op_cancel (gpg);
 			goto fail;
 		}
@@ -1981,28 +1981,28 @@ gpg_decrypt (CamelCipherContext *context,
 		const gchar *diagnostics;
 
 		diagnostics = gpg_ctx_get_diagnostics (gpg);
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC, "%s",
 			(diagnostics != NULL && *diagnostics != '\0') ?
 			diagnostics : _("Failed to execute gpg."));
 		goto fail;
 	}
 
-	camel_stream_reset (ostream);
+	camel_stream_reset (ostream, NULL);
 	if (camel_content_type_is(ct, "multipart", "encrypted")) {
 		CamelDataWrapper *dw;
 		CamelStream *null = camel_stream_null_new ();
 
 		/* Multipart encrypted - parse a full mime part */
 		rv = camel_data_wrapper_construct_from_stream (
-			CAMEL_DATA_WRAPPER (opart), ostream);
+			CAMEL_DATA_WRAPPER (opart), ostream, error);
 
 		dw = camel_medium_get_content ((CamelMedium *)opart);
-		if (!camel_data_wrapper_decode_to_stream (dw, null)) {
+		if (!camel_data_wrapper_decode_to_stream (dw, null, NULL)) {
 			/* nothing had been decoded from the stream, it doesn't
 			   contain any header, like Content-Type or such, thus
 			   write it as a message body */
-			rv = camel_data_wrapper_construct_from_stream (dw, ostream);
+			rv = camel_data_wrapper_construct_from_stream (dw, ostream, error);
 		}
 
 		g_object_unref (null);
@@ -2010,7 +2010,7 @@ gpg_decrypt (CamelCipherContext *context,
 		/* Inline signed - raw data (may not be a mime part) */
 		CamelDataWrapper *dw;
 		dw = camel_data_wrapper_new ();
-		rv = camel_data_wrapper_construct_from_stream (dw, ostream);
+		rv = camel_data_wrapper_construct_from_stream (dw, ostream, error);
 		camel_data_wrapper_set_mime_type(dw, "application/octet-stream");
 		camel_medium_set_content ((CamelMedium *)opart, dw);
 		g_object_unref (dw);
@@ -2039,10 +2039,6 @@ gpg_decrypt (CamelCipherContext *context,
 
 			add_signers (valid, gpg->signers);
 		}
-	} else {
-		camel_exception_setv(
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Unable to parse message content"));
 	}
 
  fail:
@@ -2056,7 +2052,7 @@ gpg_decrypt (CamelCipherContext *context,
 static gint
 gpg_import_keys (CamelCipherContext *context,
                  CamelStream *istream,
-                 CamelException *ex)
+                 GError **error)
 {
 	struct _GpgCtx *gpg;
 	gint res = -1;
@@ -2065,16 +2061,11 @@ gpg_import_keys (CamelCipherContext *context,
 	gpg_ctx_set_mode (gpg, GPG_CTX_MODE_IMPORT);
 	gpg_ctx_set_istream (gpg, istream);
 
-	if (gpg_ctx_op_start (gpg) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Failed to execute gpg: %s"),
-			errno ? g_strerror (errno) : _("Unknown"));
+	if (!gpg_ctx_op_start (gpg, error))
 		goto fail;
-	}
 
 	while (!gpg_ctx_op_complete (gpg)) {
-		if (gpg_ctx_op_step (gpg, ex) == -1) {
+		if (gpg_ctx_op_step (gpg, error) == -1) {
 			gpg_ctx_op_cancel (gpg);
 			goto fail;
 		}
@@ -2084,8 +2075,8 @@ gpg_import_keys (CamelCipherContext *context,
 		const gchar *diagnostics;
 
 		diagnostics = gpg_ctx_get_diagnostics (gpg);
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC, "%s",
 			(diagnostics != NULL && *diagnostics != '\0') ?
 			diagnostics : _("Failed to execute gpg."));
 		goto fail;
@@ -2102,7 +2093,7 @@ static gint
 gpg_export_keys (CamelCipherContext *context,
                  GPtrArray *keys,
                  CamelStream *ostream,
-                 CamelException *ex)
+                 GError **error)
 {
 	struct _GpgCtx *gpg;
 	gint i;
@@ -2117,16 +2108,11 @@ gpg_export_keys (CamelCipherContext *context,
 		gpg_ctx_add_recipient (gpg, keys->pdata[i]);
 	}
 
-	if (gpg_ctx_op_start (gpg) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Failed to execute gpg: %s"),
-			errno ? g_strerror (errno) : _("Unknown"));
+	if (!gpg_ctx_op_start (gpg, error))
 		goto fail;
-	}
 
 	while (!gpg_ctx_op_complete (gpg)) {
-		if (gpg_ctx_op_step (gpg, ex) == -1) {
+		if (gpg_ctx_op_step (gpg, error) == -1) {
 			gpg_ctx_op_cancel (gpg);
 			goto fail;
 		}
@@ -2136,8 +2122,8 @@ gpg_export_keys (CamelCipherContext *context,
 		const gchar *diagnostics;
 
 		diagnostics = gpg_ctx_get_diagnostics (gpg);
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC, "%s",
 			(diagnostics != NULL && *diagnostics != '\0') ?
 			diagnostics : _("Failed to execute gpg."));
 		goto fail;
diff --git a/camel/camel-http-stream.c b/camel/camel-http-stream.c
index b6a56e5..efa0486 100644
--- a/camel/camel-http-stream.c
+++ b/camel/camel-http-stream.c
@@ -30,7 +30,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "camel-exception.h"
 #include "camel-http-stream.h"
 #include "camel-mime-utils.h"
 #include "camel-net-utils.h"
@@ -56,7 +55,8 @@ G_DEFINE_TYPE (CamelHttpStream, camel_http_stream, CAMEL_TYPE_STREAM)
 
 static CamelStream *
 http_connect (CamelHttpStream *http,
-              CamelURL *url)
+              CamelURL *url,
+              GError **error)
 {
 	CamelTcpStream *tcp_stream;
 	CamelStream *stream = NULL;
@@ -76,6 +76,10 @@ http_connect (CamelHttpStream *http,
 
 	if (stream == NULL) {
 		errno = EINVAL;
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			"%s", g_strerror (errno));
 		return NULL;
 	}
 
@@ -87,7 +91,7 @@ http_connect (CamelHttpStream *http,
 	}
 	hints.ai_socktype = SOCK_STREAM;
 
-	ai = camel_getaddrinfo(url->host, serv, &hints, NULL);
+	ai = camel_getaddrinfo(url->host, serv, &hints, error);
 	if (ai == NULL) {
 		g_object_unref (stream);
 		return NULL;
@@ -95,7 +99,7 @@ http_connect (CamelHttpStream *http,
 
 	tcp_stream = CAMEL_TCP_STREAM (stream);
 
-	if (camel_tcp_stream_connect (tcp_stream, ai) == -1) {
+	if (camel_tcp_stream_connect (tcp_stream, ai, error) == -1) {
 		errsave = errno;
 		g_object_unref (stream);
 		camel_freeaddrinfo(ai);
@@ -131,7 +135,8 @@ http_disconnect (CamelHttpStream *http)
 }
 
 static gint
-http_method_invoke (CamelHttpStream *http)
+http_method_invoke (CamelHttpStream *http,
+                    GError **error)
 {
 	const gchar *method = NULL, *use_url;
 	gchar *url;
@@ -167,6 +172,10 @@ http_method_invoke (CamelHttpStream *http)
 		"%s %s HTTP/1.0\r\nUser-Agent: %s\r\nHost: %s\r\n",
 		method, use_url, http->user_agent ? http->user_agent :
 		"CamelHttpStream/1.0", http->url->host) == -1) {
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			"%s", g_strerror (errno));
 		http_disconnect(http);
 		g_free (url);
 		return -1;
@@ -180,6 +189,10 @@ http_method_invoke (CamelHttpStream *http)
 	if (http->authrealm && camel_stream_printf (
 		http->raw, "WWW-Authenticate: %s\r\n",
 		http->authrealm) == -1) {
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			"%s", g_strerror (errno));
 		http_disconnect(http);
 		return -1;
 	}
@@ -191,13 +204,17 @@ http_method_invoke (CamelHttpStream *http)
 	if (http->authpass && http->proxy && camel_stream_printf (
 		http->raw, "Proxy-Authorization: Basic %s\r\n",
 		http->authpass) == -1) {
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			"%s", g_strerror (errno));
 		http_disconnect(http);
 		return -1;
 	}
 
 	/* end the headers */
-	if (camel_stream_write (http->raw, "\r\n", 2) == -1 ||
-		camel_stream_flush (http->raw) == -1) {
+	if (camel_stream_write (http->raw, "\r\n", 2, error) == -1 ||
+		camel_stream_flush (http->raw, error) == -1) {
 		http_disconnect(http);
 		return -1;
 	}
@@ -206,7 +223,8 @@ http_method_invoke (CamelHttpStream *http)
 }
 
 static gint
-http_get_headers (CamelHttpStream *http)
+http_get_headers (CamelHttpStream *http,
+                  GError **error)
 {
 	struct _camel_header_raw *headers, *node, *tail;
 	const gchar *type;
@@ -218,7 +236,7 @@ http_get_headers (CamelHttpStream *http)
 		g_object_unref (http->parser);
 
 	http->parser = camel_mime_parser_new ();
-	camel_mime_parser_init_with_stream (http->parser, http->read);
+	camel_mime_parser_init_with_stream (http->parser, http->read, NULL);
 
 	switch (camel_mime_parser_step (http->parser, &buf, &len)) {
 	case CAMEL_MIME_PARSER_STATE_MESSAGE:
@@ -259,6 +277,10 @@ http_get_headers (CamelHttpStream *http)
 	err = camel_mime_parser_errno (http->parser);
 
 	if (err != 0) {
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (err),
+			"%s", g_strerror (err));
 		g_object_unref (http->parser);
 		http->parser = NULL;
 		goto exception;
@@ -289,14 +311,15 @@ http_next_token (const guchar *in)
 }
 
 static gint
-http_get_statuscode (CamelHttpStream *http)
+http_get_statuscode (CamelHttpStream *http,
+                     GError **error)
 {
 	const gchar *token;
 	gchar buffer[4096];
 
 	if (camel_stream_buffer_gets (
 		CAMEL_STREAM_BUFFER (http->read),
-		buffer, sizeof (buffer)) <= 0)
+		buffer, sizeof (buffer), error) <= 0)
 		return -1;
 
 	d(printf("HTTP Status: %s\n", buffer));
@@ -370,14 +393,20 @@ http_stream_finalize (GObject *object)
 static gssize
 http_stream_read (CamelStream *stream,
                   gchar *buffer,
-                  gsize n)
+                  gsize n,
+                  GError **error)
 {
 	CamelHttpStream *http = CAMEL_HTTP_STREAM (stream);
 	const gchar *parser_buf;
 	gssize nread;
 
-	if (http->method != CAMEL_HTTP_METHOD_GET && http->method != CAMEL_HTTP_METHOD_HEAD) {
+	if (http->method != CAMEL_HTTP_METHOD_GET &&
+		http->method != CAMEL_HTTP_METHOD_HEAD) {
 		errno = EIO;
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			"%s", g_strerror (errno));
 		return -1;
 	}
 
@@ -386,20 +415,20 @@ http_stream_read (CamelStream *stream,
 	if (!http->raw) {
 		if (http_connect (
 			http, http->proxy ? http->proxy :
-			http->url) == NULL)
+			http->url, error) == NULL)
 			return -1;
 
-		if (http_method_invoke (http) == -1) {
+		if (http_method_invoke (http, error) == -1) {
 			http_disconnect(http);
 			return -1;
 		}
 
-		if (http_get_statuscode (http) == -1) {
+		if (http_get_statuscode (http, error) == -1) {
 			http_disconnect(http);
 			return -1;
 		}
 
-		if (http_get_headers (http) == -1) {
+		if (http_get_headers (http, error) == -1) {
 			http_disconnect(http);
 			return -1;
 		}
@@ -454,7 +483,7 @@ http_stream_read (CamelStream *stream,
 	if (n == 0)
 		return 0;
 
-	nread = camel_mime_parser_read (http->parser, &parser_buf, n);
+	nread = camel_mime_parser_read (http->parser, &parser_buf, n, error);
 
 	if (nread > 0)
 		memcpy (buffer, parser_buf, nread);
@@ -467,29 +496,32 @@ http_stream_read (CamelStream *stream,
 static gssize
 http_stream_write (CamelStream *stream,
                    const gchar *buffer,
-                   gsize n)
+                   gsize n,
+                   GError **error)
 {
 	return -1;
 }
 
 static gint
-http_stream_flush (CamelStream *stream)
+http_stream_flush (CamelStream *stream,
+                   GError **error)
 {
 	CamelHttpStream *http = (CamelHttpStream *) stream;
 
 	if (http->raw)
-		return camel_stream_flush (http->raw);
+		return camel_stream_flush (http->raw, error);
 	else
 		return 0;
 }
 
 static gint
-http_stream_close (CamelStream *stream)
+http_stream_close (CamelStream *stream,
+                   GError **error)
 {
 	CamelHttpStream *http = (CamelHttpStream *) stream;
 
 	if (http->raw) {
-		if (camel_stream_close (http->raw) == -1)
+		if (camel_stream_close (http->raw, error) == -1)
 			return -1;
 
 		http_disconnect(http);
@@ -499,7 +531,8 @@ http_stream_close (CamelStream *stream)
 }
 
 static gint
-http_stream_reset (CamelStream *stream)
+http_stream_reset (CamelStream *stream,
+                   GError **error)
 {
 	CamelHttpStream *http = CAMEL_HTTP_STREAM (stream);
 
@@ -569,7 +602,7 @@ camel_http_stream_get_content_type (CamelHttpStream *http_stream)
 	if (!http_stream->content_type && !http_stream->raw) {
 		CamelStream *stream = CAMEL_STREAM (http_stream);
 
-		if (http_stream_read (stream, NULL, 0) == -1)
+		if (http_stream_read (stream, NULL, 0, NULL) == -1)
 			return NULL;
 	}
 
diff --git a/camel/camel-index-control.c b/camel/camel-index-control.c
index dd0e885..771cba2 100644
--- a/camel/camel-index-control.c
+++ b/camel/camel-index-control.c
@@ -188,8 +188,8 @@ do_perf(gint argc, gchar **argv)
 		camel_mime_filter_index_set_name (
 			CAMEL_MIME_FILTER_INDEX (filter_index), idn);
 		name = g_strdup_printf("%s/%s", path, d->d_name);
-		stream = camel_stream_fs_new_with_name(name, O_RDONLY, 0);
-		camel_stream_write_to_stream(stream, filter);
+		stream = camel_stream_fs_new_with_name(name, O_RDONLY, 0, NULL);
+		camel_stream_write_to_stream(stream, filter, NULL);
 		g_object_unref (stream);
 		g_free(name);
 
diff --git a/camel/camel-index.h b/camel/camel-index.h
index 1821d8d..3ca7249 100644
--- a/camel/camel-index.h
+++ b/camel/camel-index.h
@@ -25,7 +25,6 @@
 #ifndef CAMEL_INDEX_H
 #define CAMEL_INDEX_H
 
-#include <camel/camel-exception.h>
 #include <camel/camel-object.h>
 
 /* Standard GObject macros */
diff --git a/camel/camel-lock-client.c b/camel/camel-lock-client.c
index 52a4f39..60c4fe8 100644
--- a/camel/camel-lock-client.c
+++ b/camel/camel-lock-client.c
@@ -33,9 +33,9 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 
-#include "camel-exception.h"
 #include "camel-lock-client.h"
 #include "camel-lock-helper.h"
+#include "camel-object.h"
 
 #define d(x)
 
@@ -90,7 +90,7 @@ static gint write_n(gint fd, gpointer buffer, gint inlen)
 }
 
 static gint
-lock_helper_init (CamelException *ex)
+lock_helper_init (GError **error)
 {
 	gint i;
 
@@ -100,8 +100,9 @@ lock_helper_init (CamelException *ex)
 	lock_stdout_pipe[1] = -1;
 	if (pipe(lock_stdin_pipe) == -1
 	    || pipe(lock_stdout_pipe) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Cannot build locking helper pipe: %s"),
 			g_strerror (errno));
 		if (lock_stdin_pipe[0] != -1)
@@ -123,8 +124,9 @@ lock_helper_init (CamelException *ex)
 		close(lock_stdin_pipe[1]);
 		close(lock_stdout_pipe[0]);
 		close(lock_stdout_pipe[1]);
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Cannot fork locking helper: %s"),
 			g_strerror (errno));
 		return -1;
@@ -156,7 +158,7 @@ lock_helper_init (CamelException *ex)
 
 gint
 camel_lock_helper_lock (const gchar *path,
-                        CamelException *ex)
+                        GError **error)
 {
 	struct _CamelLockHelperMsg *msg;
 	gint len = strlen(path);
@@ -166,7 +168,7 @@ camel_lock_helper_lock (const gchar *path,
 	LOCK();
 
 	if (lock_helper_pid == -1) {
-		if (lock_helper_init(ex) == -1) {
+		if (lock_helper_init(error) == -1) {
 			UNLOCK();
 			return -1;
 		}
@@ -203,8 +205,9 @@ again:
 		    || msg->seq > lock_sequence) {
 			res = CAMEL_LOCK_HELPER_STATUS_PROTOCOL;
 			d(printf("lock child protocol error\n"));
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR,
+				CAMEL_ERROR_GENERIC,
 				_("Could not lock '%s': protocol "
 				"error with lock-helper"), path);
 			goto fail;
@@ -218,10 +221,11 @@ again:
 			res = msg->data;
 			break;
 		default:
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR,
+				CAMEL_ERROR_GENERIC,
 				_("Could not lock '%s'"), path);
-			d(printf("locking failed !status = %d\n", msg->id));
+			d(printf("locking failed ! status = %d\n", msg->id));
 			break;
 		}
 	} else if (retry > 0) {
@@ -229,8 +233,9 @@ again:
 		retry--;
 		goto again;
 	} else {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR,
+			CAMEL_ERROR_GENERIC,
 			_("Could not lock '%s': protocol "
 			"error with lock-helper"), path);
 	}
diff --git a/camel/camel-lock-client.h b/camel/camel-lock-client.h
index f0e1c45..bd3da9b 100644
--- a/camel/camel-lock-client.h
+++ b/camel/camel-lock-client.h
@@ -28,11 +28,11 @@
 #ifndef CAMEL_LOCK_CLIENT_H
 #define CAMEL_LOCK_CLIENT_H
 
-#include <camel/camel-exception.h>
+#include <glib.h>
 
 G_BEGIN_DECLS
 
-gint camel_lock_helper_lock(const gchar *path , CamelException *ex);
+gint camel_lock_helper_lock(const gchar *path , GError **error);
 gint camel_lock_helper_unlock(gint lockid);
 
 G_END_DECLS
diff --git a/camel/camel-lock-helper.c b/camel/camel-lock-helper.c
index a250bb2..48f8b4f 100644
--- a/camel/camel-lock-helper.c
+++ b/camel/camel-lock-helper.c
@@ -34,6 +34,8 @@
 #include <sys/time.h>
 #include <sys/types.h>
 
+#include <glib/gstdio.h>
+
 #define SETEUID_SAVES (1)
 
 /* we try and include as little as possible */
@@ -98,18 +100,6 @@ static gint write_n(gint fd, gpointer buffer, gint inlen)
 	return inlen;
 }
 
-void
-camel_exception_setv (CamelException *ex, ExceptionId id, const gchar *format, ...)
-{
-	;
-}
-
-void
-camel_exception_clear (CamelException *exception)
-{
-	;
-}
-
 gchar *gettext (const gchar *msgid);
 
 gchar *
@@ -138,7 +128,7 @@ static gint lock_path(const gchar *path, guint32 *lockid)
 	}
 
 	/* check we are allowed to lock it, we must own it, be able to write to it, and it has to exist */
-	if (stat(path, &st) == -1
+	if (g_stat(path, &st) == -1
 	    || st.st_uid != getuid()
 	    || !S_ISREG(st.st_mode)
 	    || (st.st_mode & 0400) == 0) {
diff --git a/camel/camel-lock.c b/camel/camel-lock.c
index c2da364..a5b1059 100644
--- a/camel/camel-lock.c
+++ b/camel/camel-lock.c
@@ -31,10 +31,6 @@
 #include <time.h>
 #include <sys/stat.h>
 
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
 #ifdef USE_DOT
 #include <fcntl.h>
 #include <sys/stat.h>
@@ -50,6 +46,7 @@
 #include <sys/file.h>
 #endif
 
+#include <gio/gio.h>
 #include <glib/gi18n-lib.h>
 #include <glib/gstdio.h>
 
@@ -64,7 +61,7 @@
 /**
  * camel_lock_dot:
  * @path:
- * @ex:
+ * @error: return location for a #GError, or %NULL
  *
  * Create an exclusive lock using .lock semantics.
  * All locks are equivalent to write locks (exclusive).
@@ -73,7 +70,7 @@
  **/
 gint
 camel_lock_dot (const gchar *path,
-                CamelException *ex)
+                GError **error)
 {
 #ifdef USE_DOT
 	gchar *locktmp, *lock;
@@ -99,8 +96,9 @@ camel_lock_dot (const gchar *path,
 		sprintf(locktmp, "%sXXXXXX", path);
 		fdtmp = g_mkstemp(locktmp);
 		if (fdtmp == -1) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Could not create lock file for %s: %s"),
 				path, g_strerror (errno));
 			return -1;
@@ -111,7 +109,7 @@ camel_lock_dot (const gchar *path,
 		link(locktmp, lock);
 
 		/* but we check stat instead (again, see link(2)) */
-		if (stat(locktmp, &st) == -1) {
+		if (g_stat(locktmp, &st) == -1) {
 			d(printf("Our lock file %s vanished!?\n", locktmp));
 
 			/* well that was unexpected, try cleanup/retry */
@@ -128,7 +126,7 @@ camel_lock_dot (const gchar *path,
 		}
 
 		/* check for stale lock, kill it */
-		if (stat(lock, &st) == 0) {
+		if (g_stat(lock, &st) == 0) {
 			time_t now = time (NULL);
 			(printf("There is an existing lock %ld seconds old\n", now-st.st_ctime));
 			if (st.st_ctime < now - CAMEL_LOCK_DOT_STALE) {
@@ -142,9 +140,9 @@ camel_lock_dot (const gchar *path,
 
 	d(printf("failed to get lock after %d retries\n", retry));
 
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_SYSTEM,
-		_("Timed out trying to get lock file on %s. "
+	g_set_error (
+		error, G_IO_ERROR, G_IO_ERROR_FAILED,
+		_("Timed out trying to get lock file on %s.  "
 		"Try again later."), path);
 	return -1;
 #else /* !USE_DOT */
@@ -175,7 +173,7 @@ camel_unlock_dot(const gchar *path)
  * camel_lock_fcntl:
  * @fd:
  * @type:
- * @ex:
+ * @error: return location for a #GError, or %NULL
  *
  * Create a lock using fcntl(2).
  *
@@ -187,7 +185,7 @@ camel_unlock_dot(const gchar *path)
 gint
 camel_lock_fcntl (gint fd,
                   CamelLockType type,
-                  CamelException *ex)
+                  GError **error)
 {
 #ifdef USE_FCNTL
 	struct flock lock;
@@ -201,8 +199,9 @@ camel_lock_fcntl (gint fd,
 		   we assume the filesystem doesn't support fcntl() locking */
 		/* this is somewhat system-dependent */
 		if (errno != EINVAL && errno != ENOLCK) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Failed to get lock using fcntl(2): %s"),
 				g_strerror (errno));
 			return -1;
@@ -242,7 +241,7 @@ camel_unlock_fcntl(gint fd)
  * camel_lock_flock:
  * @fd:
  * @type:
- * @ex:
+ * @error: return location for a #GError, or %NULL
  *
  * Create a lock using flock(2).
  *
@@ -254,7 +253,7 @@ camel_unlock_fcntl(gint fd)
 gint
 camel_lock_flock (gint fd,
                   CamelLockType type,
-                  CamelException *ex)
+                  GError **error)
 {
 #ifdef USE_FLOCK
 	gint op;
@@ -267,8 +266,9 @@ camel_lock_flock (gint fd,
 		op = LOCK_EX|LOCK_NB;
 
 	if (flock(fd, op) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Failed to get lock using flock(2): %s"),
 			g_strerror (errno));
 		return -1;
@@ -298,7 +298,7 @@ camel_unlock_flock(gint fd)
  * @path: Path to the file to lock (used for .locking only).
  * @fd: Open file descriptor of the right type to lock.
  * @type: Type of lock, CAMEL_LOCK_READ or CAMEL_LOCK_WRITE.
- * @ex:
+ * @error: return location for a #GError, or %NULL
  *
  * Attempt to lock a folder, multiple attempts will be made using all
  * locking strategies available.
@@ -309,7 +309,7 @@ gint
 camel_lock_folder (const gchar *path,
                    gint fd,
                    CamelLockType type,
-                   CamelException *ex)
+                   GError **error)
 {
 	gint retry = 0;
 
@@ -317,9 +317,9 @@ camel_lock_folder (const gchar *path,
 		if (retry > 0)
 			g_usleep(CAMEL_LOCK_DELAY*1000000);
 
-		if (camel_lock_fcntl(fd, type, ex) == 0) {
-			if (camel_lock_flock(fd, type, ex) == 0) {
-				if (camel_lock_dot(path, ex) == 0)
+		if (camel_lock_fcntl(fd, type, error) == 0) {
+			if (camel_lock_flock(fd, type, error) == 0) {
+				if (camel_lock_dot(path, error) == 0)
 					return 0;
 				camel_unlock_flock(fd);
 			}
@@ -349,24 +349,23 @@ camel_unlock_folder(const gchar *path, gint fd)
 #if 0
 gint main(gint argc, gchar **argv)
 {
-	CamelException *ex;
+	GError *error = NULL;
 	gint fd1, fd2;
 
-	ex = camel_exception_new();
-
 #if 0
-	if (camel_lock_dot("mylock", ex) == 0) {
-		if (camel_lock_dot("mylock", ex) == 0) {
+	if (camel_lock_dot("mylock", &error) == 0) {
+		if (camel_lock_dot("mylock", &error) == 0) {
 			printf("Got lock twice?\n");
 		} else {
-			printf("failed to get lock 2: %s\n", camel_exception_get_description(ex));
+			printf("failed to get lock 2: %s\n", error->message);
 		}
 		camel_unlock_dot("mylock");
 	} else {
-		printf("failed to get lock 1: %s\n", camel_exception_get_description(ex));
+		printf("failed to get lock 1: %s\n", error->message);
 	}
 
-	camel_exception_clear(ex);
+	if (error != NULL)
+		g_clear_error (&error);
 #endif
 
 	fd1 = open("mylock", O_RDWR);
@@ -381,49 +380,53 @@ gint main(gint argc, gchar **argv)
 		return 1;
 	}
 
-	if (camel_lock_fcntl(fd1, CAMEL_LOCK_WRITE, ex) == 0) {
+	if (camel_lock_fcntl(fd1, CAMEL_LOCK_WRITE, &error) == 0) {
 		printf("got fcntl write lock once\n");
 		g_usleep(5000000);
-		if (camel_lock_fcntl(fd2, CAMEL_LOCK_WRITE, ex) == 0) {
+		if (camel_lock_fcntl(fd2, CAMEL_LOCK_WRITE, &error) == 0) {
 			printf("got fcntl write lock twice!\n");
 		} else {
-			printf("failed to get write lock: %s\n", camel_exception_get_description(ex));
+			printf("failed to get write lock: %s\n", error->message);
 		}
 
-		camel_exception_clear(ex);
+		if (error != NULL)
+			g_clear_error (&error);
 
-		if (camel_lock_fcntl(fd2, CAMEL_LOCK_READ, ex) == 0) {
+		if (camel_lock_fcntl(fd2, CAMEL_LOCK_READ, &error) == 0) {
 			printf("got fcntl read lock as well?\n");
 			camel_unlock_fcntl(fd2);
 		} else {
-			printf("failed to get read lock: %s\n", camel_exception_get_description(ex));
+			printf("failed to get read lock: %s\n", error->message);
 		}
 
-		camel_exception_clear(ex);
+		if (error != NULL)
+			g_clear_error (&error);
 		camel_unlock_fcntl(fd1);
 	} else {
-		printf("failed to get write lock at all: %s\n", camel_exception_get_description(ex));
+		printf("failed to get write lock at all: %s\n", error->message);
 	}
 
-	if (camel_lock_fcntl(fd1, CAMEL_LOCK_READ, ex) == 0) {
+	if (camel_lock_fcntl(fd1, CAMEL_LOCK_READ, &error) == 0) {
 		printf("got fcntl read lock once\n");
 		g_usleep(5000000);
-		if (camel_lock_fcntl(fd2, CAMEL_LOCK_WRITE, ex) == 0) {
+		if (camel_lock_fcntl(fd2, CAMEL_LOCK_WRITE, &error) == 0) {
 			printf("got fcntl write lock too?!\n");
 		} else {
-			printf("failed to get write lock: %s\n", camel_exception_get_description(ex));
+			printf("failed to get write lock: %s\n", error->message);
 		}
 
-		camel_exception_clear(ex);
+		if (error != NULL)
+			g_clear_error (&error);
 
-		if (camel_lock_fcntl(fd2, CAMEL_LOCK_READ, ex) == 0) {
+		if (camel_lock_fcntl(fd2, CAMEL_LOCK_READ, &error) == 0) {
 			printf("got fcntl read lock twice\n");
 			camel_unlock_fcntl(fd2);
 		} else {
-			printf("failed to get read lock: %s\n", camel_exception_get_description(ex));
+			printf("failed to get read lock: %s\n", error->message);
 		}
 
-		camel_exception_clear(ex);
+		if (error != NULL)
+			g_clear_error (&error);
 		camel_unlock_fcntl(fd1);
 	}
 
diff --git a/camel/camel-lock.h b/camel/camel-lock.h
index 28067e2..6b9e225 100644
--- a/camel/camel-lock.h
+++ b/camel/camel-lock.h
@@ -26,7 +26,7 @@
 #ifndef CAMEL_LOCK_H
 #define CAMEL_LOCK_H
 
-#include <camel/camel-exception.h>
+#include <glib.h>
 
 /* for .lock locking, retry, delay and stale counts */
 #define CAMEL_LOCK_DOT_RETRY (5) /* number of times to retry lock */
@@ -45,16 +45,16 @@ typedef enum {
 } CamelLockType;
 
 /* specific locking strategies */
-gint camel_lock_dot(const gchar *path, CamelException *ex);
-gint camel_lock_fcntl(gint fd, CamelLockType type, CamelException *ex);
-gint camel_lock_flock(gint fd, CamelLockType type, CamelException *ex);
+gint camel_lock_dot(const gchar *path, GError **error);
+gint camel_lock_fcntl(gint fd, CamelLockType type, GError **error);
+gint camel_lock_flock(gint fd, CamelLockType type, GError **error);
 
 void camel_unlock_dot(const gchar *path);
 void camel_unlock_fcntl(gint fd);
 void camel_unlock_flock(gint fd);
 
 /* lock a folder in a standard way */
-gint camel_lock_folder(const gchar *path, gint fd, CamelLockType type, CamelException *ex);
+gint camel_lock_folder(const gchar *path, gint fd, CamelLockType type, GError **error);
 void camel_unlock_folder(const gchar *path, gint fd);
 
 G_END_DECLS
diff --git a/camel/camel-mime-filter-save.c b/camel/camel-mime-filter-save.c
index 2260cf3..3de1ef3 100644
--- a/camel/camel-mime-filter-save.c
+++ b/camel/camel-mime-filter-save.c
@@ -51,7 +51,7 @@ mime_filter_save_filter (CamelMimeFilter *mime_filter,
 	priv = CAMEL_MIME_FILTER_SAVE_GET_PRIVATE (mime_filter);
 
 	if (priv->stream != NULL)
-		camel_stream_write (priv->stream, in, len);
+		camel_stream_write (priv->stream, in, len, NULL);
 
 	*out = (gchar *) in;
 	*outlen = len;
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
index 8a41efe..c754f0a 100644
--- a/camel/camel-mime-message.c
+++ b/camel/camel-mime-message.c
@@ -217,7 +217,8 @@ mime_message_finalize (GObject *object)
 
 static gssize
 mime_message_write_to_stream (CamelDataWrapper *data_wrapper,
-                              CamelStream *stream)
+                              CamelStream *stream,
+                              GError **error)
 {
 	CamelDataWrapperClass *data_wrapper_class;
 	CamelMimeMessage *mm = CAMEL_MIME_MESSAGE (data_wrapper);
@@ -244,7 +245,7 @@ mime_message_write_to_stream (CamelDataWrapper *data_wrapper,
 
 	/* Chain up to parent's write_to_stream() method. */
 	data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (camel_mime_message_parent_class);
-	return data_wrapper_class->write_to_stream (data_wrapper, stream);
+	return data_wrapper_class->write_to_stream (data_wrapper, stream, error);
 }
 
 static void
@@ -286,7 +287,8 @@ mime_message_remove_header (CamelMedium *medium,
 
 static gint
 mime_message_construct_from_parser (CamelMimePart *dw,
-                                    CamelMimeParser *mp)
+                                    CamelMimeParser *mp,
+                                    GError **error)
 {
 	CamelMimePartClass *mime_part_class;
 	gchar *buf;
@@ -301,7 +303,7 @@ mime_message_construct_from_parser (CamelMimePart *dw,
 
 	/* let the mime-part construct the guts ... */
 	mime_part_class = CAMEL_MIME_PART_CLASS (camel_mime_message_parent_class);
-	ret = mime_part_class->construct_from_parser (dw, mp);
+	ret = mime_part_class->construct_from_parser (dw, mp, error);
 
 	if (ret == -1)
 		return -1;
@@ -325,6 +327,10 @@ mime_message_construct_from_parser (CamelMimePart *dw,
 	err = camel_mime_parser_errno(mp);
 	if (err != 0) {
 		errno = err;
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			"%s", g_strerror (errno));
 		ret = -1;
 	}
 
@@ -899,7 +905,7 @@ find_best_encoding (CamelMimePart *part, CamelBestencRequired required, CamelBes
 	idb = camel_stream_filter_add (
 		CAMEL_STREAM_FILTER (filter), bestenc);
 	d(printf("writing to checking stream\n"));
-	camel_data_wrapper_decode_to_stream (content, filter);
+	camel_data_wrapper_decode_to_stream (content, filter, NULL);
 	camel_stream_filter_remove (CAMEL_STREAM_FILTER (filter), idb);
 	if (idc != -1) {
 		camel_stream_filter_remove (CAMEL_STREAM_FILTER (filter), idc);
@@ -942,7 +948,8 @@ find_best_encoding (CamelMimePart *part, CamelBestencRequired required, CamelBes
 				CAMEL_STREAM_FILTER (filter), bestenc);
 
 			/* and write it to the new stream */
-			camel_data_wrapper_write_to_stream (content, filter);
+			camel_data_wrapper_write_to_stream (
+				content, filter, NULL);
 
 			g_object_unref (charenc);
 		}
diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c
index 7994173..5d340e5 100644
--- a/camel/camel-mime-parser.c
+++ b/camel/camel-mime-parser.c
@@ -144,7 +144,7 @@ struct _header_scan_filter {
 static void folder_scan_step(struct _header_scan_state *s, gchar **databuffer, gsize *datalength);
 static void folder_scan_drop_step(struct _header_scan_state *s);
 static gint folder_scan_init_with_fd(struct _header_scan_state *s, gint fd);
-static gint folder_scan_init_with_stream(struct _header_scan_state *s, CamelStream *stream);
+static gint folder_scan_init_with_stream(struct _header_scan_state *s, CamelStream *stream, GError **error);
 static struct _header_scan_state *folder_scan_init(void);
 static void folder_scan_close(struct _header_scan_state *s);
 static struct _header_scan_stack *folder_scan_content(struct _header_scan_state *s, gint *lastone, gchar **data, gsize *length);
@@ -449,6 +449,7 @@ camel_mime_parser_init_with_fd(CamelMimeParser *m, gint fd)
  * camel_mime_parser_init_with_stream:
  * @m:
  * @stream:
+ * @error: return location for a #GError, or %NULL
  *
  * Initialise the scanner with a source stream.  The scanner's
  * offsets will be relative to the current file position of
@@ -459,11 +460,12 @@ camel_mime_parser_init_with_fd(CamelMimeParser *m, gint fd)
  **/
 gint
 camel_mime_parser_init_with_stream (CamelMimeParser *parser,
-                                    CamelStream *stream)
+                                    CamelStream *stream,
+                                    GError **error)
 {
 	struct _header_scan_state *s = _PRIVATE (parser);
 
-	return folder_scan_init_with_stream (s, stream);
+	return folder_scan_init_with_stream (s, stream, error);
 }
 
 /**
@@ -624,6 +626,7 @@ camel_mime_parser_step (CamelMimeParser *parser, gchar **databuffer, gsize *data
  * @parser: MIME parser object
  * @databuffer:
  * @len:
+ * @error: return location for a #GError, or %NULL
  *
  * Read at most @len bytes from the internal mime parser buffer.
  *
@@ -640,7 +643,10 @@ camel_mime_parser_step (CamelMimeParser *parser, gchar **databuffer, gsize *data
  * Returns: The number of bytes available, or -1 on error.
  **/
 gint
-camel_mime_parser_read (CamelMimeParser *parser, const gchar **databuffer, gint len)
+camel_mime_parser_read (CamelMimeParser *parser,
+                        const gchar **databuffer,
+                        gint len,
+                        GError **error)
 {
 	struct _header_scan_state *s = _PRIVATE (parser);
 	gint there;
@@ -658,8 +664,15 @@ camel_mime_parser_read (CamelMimeParser *parser, const gchar **databuffer, gint
 		return there;
 	}
 
-	if (folder_read(s) == -1)
+	if (folder_read(s) == -1) {
+		gint err = camel_mime_parser_errno (parser);
+
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (err),
+			"%s", g_strerror (err));
 		return -1;
+	}
 
 	there = MIN(s->inend - s->inptr, len);
 	d(printf("parser::read() had to re-read, now there = %d bytes\n", there));
@@ -903,7 +916,8 @@ folder_read(struct _header_scan_state *s)
 		memmove(s->inbuf, s->inptr, inoffset);
 	}
 	if (s->stream) {
-		len = camel_stream_read(s->stream, s->inbuf+inoffset, SCAN_BUF-inoffset);
+		len = camel_stream_read (
+			s->stream, s->inbuf+inoffset, SCAN_BUF-inoffset, NULL);
 	} else {
 		len = read(s->fd, s->inbuf+inoffset, SCAN_BUF-inoffset);
 	}
@@ -952,7 +966,7 @@ folder_seek(struct _header_scan_state *s, off_t offset, gint whence)
 			   the case (or bloody well should've been) */
 			newoffset = camel_seekable_stream_seek (
 				CAMEL_SEEKABLE_STREAM (s->stream),
-				offset, whence);
+				offset, whence, NULL);
 		} else {
 			newoffset = -1;
 			errno = EINVAL;
@@ -1505,7 +1519,8 @@ folder_scan_init_with_fd(struct _header_scan_state *s, gint fd)
 
 static gint
 folder_scan_init_with_stream (struct _header_scan_state *s,
-                              CamelStream *stream)
+                              CamelStream *stream,
+                              GError **error)
 {
 	folder_scan_reset(s);
 	s->stream = g_object_ref (stream);
diff --git a/camel/camel-mime-parser.h b/camel/camel-mime-parser.h
index 232b407..916824c 100644
--- a/camel/camel-mime-parser.h
+++ b/camel/camel-mime-parser.h
@@ -103,7 +103,7 @@ gint		camel_mime_parser_errno (CamelMimeParser *parser);
 
 /* using an fd will be a little faster, but not much (over a simple stream) */
 gint		camel_mime_parser_init_with_fd (CamelMimeParser *m, gint fd);
-gint		camel_mime_parser_init_with_stream (CamelMimeParser *m, CamelStream *stream);
+gint		camel_mime_parser_init_with_stream (CamelMimeParser *m, CamelStream *stream, GError **error);
 
 /* get the stream or fd back of the parser */
 CamelStream    *camel_mime_parser_stream (CamelMimeParser *parser);
@@ -125,7 +125,7 @@ camel_mime_parser_state_t camel_mime_parser_state (CamelMimeParser *parser);
 void camel_mime_parser_push_state(CamelMimeParser *mp, camel_mime_parser_state_t newstate, const gchar *boundary);
 
 /* read through the parser */
-gint camel_mime_parser_read (CamelMimeParser *parser, const gchar **databuffer, gint len);
+gint camel_mime_parser_read (CamelMimeParser *parser, const gchar **databuffer, gint len, GError **error);
 
 /* get content type for the current part/header */
 CamelContentType *camel_mime_parser_content_type (CamelMimeParser *parser);
diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c
index a516fab..f33cd8e 100644
--- a/camel/camel-mime-part-utils.c
+++ b/camel/camel-mime-part-utils.c
@@ -54,13 +54,16 @@
 	       #include <stdio.h>*/
 
 /* simple data wrapper */
-static void
-simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser *mp)
+static gboolean
+simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw,
+                                           CamelMimeParser *mp,
+                                           GError **error)
 {
 	gchar *buf;
 	GByteArray *buffer;
 	CamelStream *mem;
 	gsize len;
+	gint retval;
 
 	d(printf ("simple_data_wrapper_construct_from_parser()\n"));
 
@@ -74,8 +77,10 @@ simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser
 	d(printf("message part kept in memory!\n"));
 
 	mem = camel_stream_mem_new_with_byte_array (buffer);
-	camel_data_wrapper_construct_from_stream (dw, mem);
+	retval = camel_data_wrapper_construct_from_stream (dw, mem, error);
 	g_object_unref (mem);
+
+	return (retval == 0);
 }
 
 /**
@@ -83,14 +88,17 @@ simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser
  *
  * Since: 2.24
  **/
-void
-camel_mime_part_construct_content_from_parser (CamelMimePart *dw, CamelMimeParser *mp)
+gboolean
+camel_mime_part_construct_content_from_parser (CamelMimePart *dw,
+                                               CamelMimeParser *mp,
+                                               GError **error)
 {
 	CamelDataWrapper *content = NULL;
 	CamelContentType *ct;
 	gchar *encoding;
+	gboolean success = TRUE;
 
-	g_return_if_fail (CAMEL_IS_MIME_PART (dw));
+	g_return_val_if_fail (CAMEL_IS_MIME_PART (dw), FALSE);
 
 	ct = camel_mime_parser_content_type (mp);
 
@@ -105,13 +113,15 @@ camel_mime_part_construct_content_from_parser (CamelMimePart *dw, CamelMimeParse
 			camel_multipart_construct_from_parser ((CamelMultipart *) content, mp);
 		} else {
 			content = camel_data_wrapper_new ();
-			simple_data_wrapper_construct_from_parser (content, mp);
+			success = simple_data_wrapper_construct_from_parser (
+				content, mp, error);
 		}
 		break;
 	case CAMEL_MIME_PARSER_STATE_MESSAGE:
 		d(printf("Creating message part\n"));
 		content = (CamelDataWrapper *) camel_mime_message_new ();
-		camel_mime_part_construct_from_parser ((CamelMimePart *)content, mp);
+		success = (camel_mime_part_construct_from_parser (
+			(CamelMimePart *)content, mp, error) == 0);
 		break;
 	case CAMEL_MIME_PARSER_STATE_MULTIPART:
 		d(printf("Creating multi-part\n"));
@@ -140,6 +150,8 @@ camel_mime_part_construct_content_from_parser (CamelMimePart *dw, CamelMimeParse
 	}
 
 	g_free (encoding);
+
+	return success;
 }
 
 /**
@@ -172,15 +184,15 @@ camel_mime_message_build_preview (CamelMimePart *msg,
 		    !camel_content_type_is (dw->mime_type, "text", "calendar")) {
 		CamelStream *mstream, *bstream;
 		mstream = camel_stream_mem_new();
-		if (camel_data_wrapper_decode_to_stream (dw, mstream) > 0) {
+		if (camel_data_wrapper_decode_to_stream (dw, mstream, NULL) > 0) {
 			gchar *line = NULL;
 			GString *str = g_string_new (NULL);
 
-			camel_stream_reset (mstream);
+			camel_stream_reset (mstream, NULL);
 			bstream = camel_stream_buffer_new (mstream, CAMEL_STREAM_BUFFER_READ|CAMEL_STREAM_BUFFER_BUFFER);
 
 			/* We should fetch just 200 unquoted lines. */
-			while ((line = camel_stream_buffer_read_line((CamelStreamBuffer *)bstream)) && str->len < 200) {
+			while ((line = camel_stream_buffer_read_line((CamelStreamBuffer *)bstream, NULL)) && str->len < 200) {
 				gchar *tmp = line;
 				if (!line)
 					continue;
diff --git a/camel/camel-mime-part-utils.h b/camel/camel-mime-part-utils.h
index c9d5be8..0bb95c3 100644
--- a/camel/camel-mime-part-utils.h
+++ b/camel/camel-mime-part-utils.h
@@ -35,9 +35,10 @@
 
 G_BEGIN_DECLS
 
-void		camel_mime_part_construct_content_from_parser
+gboolean	camel_mime_part_construct_content_from_parser
 						(CamelMimePart *mime_part,
-						 CamelMimeParser *mp);
+						 CamelMimeParser *mp,
+						 GError **error);
 gboolean	camel_mime_message_build_preview(CamelMimePart *mime_part,
 						 CamelMessageInfo *info);
 
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index 80ce93f..bf1c574 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -33,7 +33,7 @@
 #include <string.h>
 
 #include "camel-charset-map.h"
-#include "camel-exception.h"
+#include "camel-debug.h"
 #include "camel-iconv.h"
 #include "camel-mime-filter-basic.h"
 #include "camel-mime-filter-charset.h"
@@ -136,13 +136,13 @@ write_references (CamelStream *stream,
 			total += out;
 			len = 0;
 		}
-		out = camel_stream_write (stream, ids, ide-ids);
+		out = camel_stream_write (stream, ids, ide-ids, NULL);
 		if (out == -1)
 			return -1;
 		len += out;
 		total += out;
 	}
-	camel_stream_write (stream, "\n", 1);
+	camel_stream_write (stream, "\n", 1, NULL);
 
 	return total;
 }
@@ -477,7 +477,8 @@ mime_part_set_content (CamelMedium *medium,
 
 static gssize
 mime_part_write_to_stream (CamelDataWrapper *dw,
-                           CamelStream *stream)
+                           CamelStream *stream,
+                           GError **error)
 {
 	CamelMimePart *mp = CAMEL_MIME_PART (dw);
 	CamelMedium *medium = CAMEL_MEDIUM (dw);
@@ -511,14 +512,19 @@ mime_part_write_to_stream (CamelDataWrapper *dw,
 			} else {
 				count = writefn(stream, h);
 			}
-			if (count == -1)
+			if (count == -1) {
+				g_set_error (
+					error, G_IO_ERROR,
+					g_io_error_from_errno (errno),
+					"%s", g_strerror (errno));
 				return -1;
+			}
 			total += count;
 			h = h->next;
 		}
 	}
 
-	count = camel_stream_write (stream, "\n", 1);
+	count = camel_stream_write (stream, "\n", 1, error);
 	if (count == -1)
 		return -1;
 	total += count;
@@ -556,8 +562,13 @@ mime_part_write_to_stream (CamelDataWrapper *dw,
 				count = camel_stream_printf (
 					ostream, "begin 644 %s\n",
 					filename ? filename : "untitled");
-				if (count == -1)
+				if (count == -1) {
+					g_set_error (
+						error, G_IO_ERROR,
+						g_io_error_from_errno (errno),
+						"%s", g_strerror (errno));
 					return -1;
+				}
 				total += count;
 				filter = camel_mime_filter_basic_new (CAMEL_MIME_FILTER_BASIC_UU_ENC);
 				break;
@@ -603,13 +614,15 @@ mime_part_write_to_stream (CamelDataWrapper *dw,
 		}
 
 		if (reencode)
-			count = camel_data_wrapper_decode_to_stream (content, stream);
+			count = camel_data_wrapper_decode_to_stream (
+				content, stream, error);
 		else
-			count = camel_data_wrapper_write_to_stream (content, stream);
+			count = camel_data_wrapper_write_to_stream (
+				content, stream, error);
 
 		if (filter_stream) {
 			errnosav = errno;
-			camel_stream_flush (stream);
+			camel_stream_flush (stream, NULL);
 			g_object_unref (filter_stream);
 			errno = errnosav;
 		}
@@ -620,7 +633,7 @@ mime_part_write_to_stream (CamelDataWrapper *dw,
 		total += count;
 
 		if (reencode && mp->priv->encoding == CAMEL_TRANSFER_ENCODING_UUENCODE) {
-			count = camel_stream_write (ostream, "end\n", 4);
+			count = camel_stream_write (ostream, "end\n", 4, error);
 			if (count == -1)
 				return -1;
 			total += count;
@@ -634,7 +647,8 @@ mime_part_write_to_stream (CamelDataWrapper *dw,
 
 static gint
 mime_part_construct_from_stream (CamelDataWrapper *dw,
-                                 CamelStream *s)
+                                 CamelStream *s,
+                                 GError **error)
 {
 	CamelMimeParser *mp;
 	gint ret;
@@ -642,12 +656,11 @@ mime_part_construct_from_stream (CamelDataWrapper *dw,
 	d(printf("mime_part::construct_from_stream()\n"));
 
 	mp = camel_mime_parser_new();
-	if (camel_mime_parser_init_with_stream (mp, s) == -1) {
-		g_warning ("Cannot create parser for stream");
+	if (camel_mime_parser_init_with_stream (mp, s, error) == -1) {
 		ret = -1;
 	} else {
 		ret = camel_mime_part_construct_from_parser (
-			CAMEL_MIME_PART (dw), mp);
+			CAMEL_MIME_PART (dw), mp, error);
 	}
 	g_object_unref (mp);
 	return ret;
@@ -655,7 +668,8 @@ mime_part_construct_from_stream (CamelDataWrapper *dw,
 
 static gint
 mime_part_construct_from_parser (CamelMimePart *mime_part,
-                                 CamelMimeParser *mp)
+                                 CamelMimeParser *mp,
+                                 GError **error)
 {
 	CamelDataWrapper *dw = (CamelDataWrapper *) mime_part;
 	struct _camel_header_raw *headers;
@@ -663,6 +677,8 @@ mime_part_construct_from_parser (CamelMimePart *mime_part,
 	gchar *buf;
 	gsize len;
 	gint err;
+	gboolean success;
+	gboolean retval = 0;
 
 	d(printf("mime_part::construct_from_parser()\n"));
 
@@ -691,7 +707,9 @@ mime_part_construct_from_parser (CamelMimePart *mime_part,
 			headers = headers->next;
 		}
 
-		camel_mime_part_construct_content_from_parser (mime_part, mp);
+		success = camel_mime_part_construct_content_from_parser (
+			mime_part, mp, error);
+		retval = success ? 0 : -1;
 		break;
 	default:
 		g_warning("Invalid state encountered???: %u", camel_mime_parser_state(mp));
@@ -701,10 +719,14 @@ mime_part_construct_from_parser (CamelMimePart *mime_part,
 	err = camel_mime_parser_errno(mp);
 	if (err != 0) {
 		errno = err;
-		return -1;
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			"%s", g_strerror (errno));
+		retval = -1;
 	}
 
-	return 0;
+	return retval;
 }
 
 static void
@@ -1233,9 +1255,11 @@ camel_mime_part_get_content_type (CamelMimePart *mime_part)
  **/
 gint
 camel_mime_part_construct_from_parser (CamelMimePart *mime_part,
-                                       CamelMimeParser *mp)
+                                       CamelMimeParser *mp,
+                                       GError **error)
 {
 	CamelMimePartClass *class;
+	gint retval;
 
 	g_return_val_if_fail (CAMEL_IS_MIME_PART (mime_part), -1);
 	g_return_val_if_fail (CAMEL_IS_MIME_PARSER (mp), -1);
@@ -1243,7 +1267,10 @@ camel_mime_part_construct_from_parser (CamelMimePart *mime_part,
 	class = CAMEL_MIME_PART_GET_CLASS (mime_part);
 	g_return_val_if_fail (class->construct_from_parser != NULL, -1);
 
-	return class->construct_from_parser (mime_part, mp);
+	retval = class->construct_from_parser (mime_part, mp, error);
+	CAMEL_CHECK_GERROR (mime_part, construct_from_parser, retval == 0, error);
+
+	return retval;
 }
 
 /**
@@ -1285,7 +1312,7 @@ camel_mime_part_set_content (CamelMimePart *mime_part,
 		dw = camel_data_wrapper_new ();
 		camel_data_wrapper_set_mime_type (dw, type);
 		stream = camel_stream_mem_new_with_buffer (data, length);
-		camel_data_wrapper_construct_from_stream (dw, stream);
+		camel_data_wrapper_construct_from_stream (dw, stream, NULL);
 		g_object_unref (stream);
 		camel_medium_set_content (medium, dw);
 		g_object_unref (dw);
@@ -1315,7 +1342,7 @@ camel_mime_part_get_content_size (CamelMimePart *mime_part)
 	dw = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
 
 	null = (CamelStreamNull *) camel_stream_null_new ();
-	camel_data_wrapper_decode_to_stream (dw, (CamelStream *) null);
+	camel_data_wrapper_decode_to_stream (dw, (CamelStream *) null, NULL);
 	size = null->written;
 
 	g_object_unref (null);
diff --git a/camel/camel-mime-part.h b/camel/camel-mime-part.h
index c13297d..216a780 100644
--- a/camel/camel-mime-part.h
+++ b/camel/camel-mime-part.h
@@ -70,7 +70,8 @@ struct _CamelMimePartClass {
 	CamelMediumClass parent_class;
 
 	gint		(*construct_from_parser)(CamelMimePart *mime_part,
-						 CamelMimeParser *parser);
+						 CamelMimeParser *parser,
+						 GError **error);
 };
 
 GType camel_mime_part_get_type (void);
@@ -108,7 +109,7 @@ void               camel_mime_part_set_content_type	(CamelMimePart *mime_part, c
 CamelContentType  *camel_mime_part_get_content_type	(CamelMimePart *mime_part);
 
 /* construction */
-gint		camel_mime_part_construct_from_parser  (CamelMimePart *mime_part, CamelMimeParser *parser);
+gint		camel_mime_part_construct_from_parser  (CamelMimePart *mime_part, CamelMimeParser *parser, GError **error);
 
 /* utility functions */
 void	camel_mime_part_set_content	       (CamelMimePart *mime_part,
diff --git a/camel/camel-movemail.c b/camel/camel-movemail.c
index 11fde95..fa546ba 100644
--- a/camel/camel-movemail.c
+++ b/camel/camel-movemail.c
@@ -37,13 +37,9 @@
 #include <sys/stat.h>
 #include <sys/uio.h>
 
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
+#include <glib/gstdio.h>
 #include <glib/gi18n-lib.h>
 
-#include "camel-exception.h"
 #include "camel-lock-client.h"
 #include "camel-mime-filter-from.h"
 #include "camel-mime-filter.h"
@@ -56,15 +52,15 @@
 #include <sys/wait.h>
 
 static void movemail_external (const gchar *source, const gchar *dest,
-			       CamelException *ex);
+			       GError **error);
 #endif
 
 #ifdef HAVE_BROKEN_SPOOL
 static gint camel_movemail_copy_filter(gint fromfd, gint tofd, off_t start, gsize bytes, CamelMimeFilter *filter);
-static gint camel_movemail_solaris (gint oldsfd, gint dfd, CamelException *ex);
+static gint camel_movemail_solaris (gint oldsfd, gint dfd, GError **error);
 #else
 /* these could probably be exposed as a utility? (but only mbox needs it) */
-static gint camel_movemail_copy_file(gint sfd, gint dfd, CamelException *ex);
+static gint camel_movemail_copy_file(gint sfd, gint dfd, GError **error);
 #endif
 
 #if 0
@@ -75,7 +71,7 @@ static gint camel_movemail_copy(gint fromfd, gint tofd, off_t start, gsize bytes
  * camel_movemail:
  * @source: source file
  * @dest: destination file
- * @ex: a CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * This copies an mbox file from a shared directory with multiple
  * readers and writers into a private (presumably Camel-controlled)
@@ -87,7 +83,7 @@ static gint camel_movemail_copy(gint fromfd, gint tofd, off_t start, gsize bytes
 gint
 camel_movemail (const gchar *source,
                 const gchar *dest,
-                CamelException *ex)
+                GError **error)
 {
 	gint lockid = -1;
 	gint res = -1;
@@ -101,10 +97,11 @@ camel_movemail (const gchar *source,
 	 * assuming it's unlocked is equivalent to pretending we were
 	 * called a fraction earlier.)
 	 */
-	if (stat (source, &st) == -1) {
+	if (g_stat (source, &st) == -1) {
 		if (errno != ENOENT)
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Could not check mail file %s: %s"),
 				source, g_strerror (errno));
 		return -1;
@@ -116,8 +113,9 @@ camel_movemail (const gchar *source,
 	/* open files */
 	sfd = open (source, O_RDWR);
 	if (sfd == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not open mail file %s: %s"),
 			source, g_strerror (errno));
 		return -1;
@@ -125,16 +123,17 @@ camel_movemail (const gchar *source,
 
 	dfd = open (dest, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
 	if (dfd == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Could not open temporary mail "
-			"file %s: %s"), dest, g_strerror (errno));
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			_("Could not open temporary mail file %s: %s"),
+			dest, g_strerror (errno));
 		close (sfd);
 		return -1;
 	}
 
 	/* lock our source mailbox */
-	lockid = camel_lock_helper_lock(source, ex);
+	lockid = camel_lock_helper_lock(source, error);
 	if (lockid == -1) {
 		close(sfd);
 		close(dfd);
@@ -144,7 +143,7 @@ camel_movemail (const gchar *source,
 #ifdef HAVE_BROKEN_SPOOL
 	res = camel_movemail_solaris(sfd, dfd, ex);
 #else
-	res = camel_movemail_copy_file(sfd, dfd, ex);
+	res = camel_movemail_copy_file(sfd, dfd, error);
 #endif
 
 	/* If no errors occurred copying the data, and we successfully
@@ -154,8 +153,9 @@ camel_movemail (const gchar *source,
 		if (close (dfd) == 0) {
 			ftruncate (sfd, 0);
 		} else {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Failed to store mail in temp file %s: %s"),
 				dest, g_strerror (errno));
 			res = -1;
@@ -173,7 +173,7 @@ camel_movemail (const gchar *source,
 static void
 movemail_external (const gchar *source,
                    const gchar *dest,
-                   CamelException *ex)
+                   GError **error)
 {
 	sigset_t mask, omask;
 	pid_t pid;
@@ -187,8 +187,9 @@ movemail_external (const gchar *source,
 
 	if (pipe (fd) == -1) {
 		sigprocmask (SIG_SETMASK, &omask, NULL);
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not create pipe: %s"),
 			g_strerror (errno));
 		return;
@@ -200,8 +201,9 @@ movemail_external (const gchar *source,
 		close (fd[0]);
 		close (fd[1]);
 		sigprocmask (SIG_SETMASK, &omask, NULL);
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not fork: %s"), g_strerror (errno));
 		return;
 
@@ -238,8 +240,8 @@ movemail_external (const gchar *source,
 	sigprocmask (SIG_SETMASK, &omask, NULL);
 
 	if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Movemail program failed: %s"),
 			output ? output : _("(Unknown error)"));
 	}
@@ -251,7 +253,7 @@ movemail_external (const gchar *source,
 static gint
 camel_movemail_copy_file (gint sfd,
                           gint dfd,
-                          CamelException *ex)
+                          GError **error)
 {
 	gint nread, nwrote;
 	gchar buf[4096];
@@ -265,8 +267,9 @@ camel_movemail_copy_file (gint sfd,
 		else if (nread == -1) {
 			if (errno == EINTR)
 				continue;
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Error reading mail file: %s"),
 				g_strerror (errno));
 			return -1;
@@ -277,8 +280,9 @@ camel_movemail_copy_file (gint sfd,
 			if (nwrote == -1) {
 				if (errno == EINTR)
 					continue; /* continues inner loop */
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_SYSTEM,
+				g_set_error (
+					error, G_IO_ERROR,
+					g_io_error_from_errno (errno),
 					_("Error writing mail temp file: %s"),
 					g_strerror (errno));
 				return -1;
@@ -460,7 +464,7 @@ solaris_header_write(gint fd, struct _camel_header_raw *header)
 static gint
 camel_movemail_solaris (gint oldsfd,
                         gint dfd,
-                        CamelException *ex)
+                        GError **error)
 {
 	CamelMimeParser *mp;
 	gchar *buffer;
@@ -473,8 +477,9 @@ camel_movemail_solaris (gint oldsfd,
 	/* need to dup as the mime parser will close on finish */
 	sfd = dup(oldsfd);
 	if (sfd == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Error copying mail temp file: %s"),
 			g_strerror (errno));
 		return -1;
@@ -541,8 +546,9 @@ camel_movemail_solaris (gint oldsfd,
 fail:
 	g_free(from);
 
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, G_IO_ERROR,
+		g_io_error_from_errno (errno),
 		_("Error copying mail temp file: %s"),
 		g_strerror (errno));
 
diff --git a/camel/camel-movemail.h b/camel/camel-movemail.h
index 2923274..2d26f74 100644
--- a/camel/camel-movemail.h
+++ b/camel/camel-movemail.h
@@ -29,11 +29,11 @@
 #ifndef CAMEL_MOVEMAIL_H
 #define CAMEL_MOVEMAIL_H
 
-#include <camel/camel-exception.h>
+#include <glib.h>
 
 G_BEGIN_DECLS
 
-gint camel_movemail (const gchar *source, const gchar *dest, CamelException *ex);
+gint camel_movemail (const gchar *source, const gchar *dest, GError **error);
 
 G_END_DECLS
 
diff --git a/camel/camel-multipart-signed.c b/camel/camel-multipart-signed.c
index 2d71381..fae9d10 100644
--- a/camel/camel-multipart-signed.c
+++ b/camel/camel-multipart-signed.c
@@ -30,13 +30,8 @@
 #include <time.h>
 #include <unistd.h>
 
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
 #include <glib/gi18n-lib.h>
 
-#include "camel-exception.h"
 #include "camel-mime-filter-canon.h"
 #include "camel-mime-filter-crlf.h"
 #include "camel-mime-message.h"
@@ -118,9 +113,9 @@ multipart_signed_parse_content (CamelMultipartSigned *mps)
 	   This is so we can parse all cases properly, without altering the content.
 	   All we are doing is finding part offsets. */
 
-	camel_stream_reset (stream);
+	camel_stream_reset (stream, NULL);
 	cmp = camel_mime_parser_new ();
-	camel_mime_parser_init_with_stream (cmp, stream);
+	camel_mime_parser_init_with_stream (cmp, stream, NULL);
 	camel_mime_parser_push_state(cmp, CAMEL_MIME_PARSER_STATE_MULTIPART, boundary);
 
 	mps->start1 = -1;
@@ -260,7 +255,8 @@ multipart_signed_set_mime_type_field (CamelDataWrapper *data_wrapper,
 
 static gssize
 multipart_signed_write_to_stream (CamelDataWrapper *data_wrapper,
-                                  CamelStream *stream)
+                                  CamelStream *stream,
+                                  GError **error)
 {
 	CamelMultipartSigned *mps = (CamelMultipartSigned *)data_wrapper;
 	CamelMultipart *mp = (CamelMultipart *)mps;
@@ -277,18 +273,31 @@ multipart_signed_write_to_stream (CamelDataWrapper *data_wrapper,
 	/* 1 */
 	/* FIXME: locking? */
 	if (data_wrapper->stream) {
-		camel_stream_reset (data_wrapper->stream);
-		return camel_stream_write_to_stream (data_wrapper->stream, stream);
+		camel_stream_reset (data_wrapper->stream, NULL);
+		return camel_stream_write_to_stream (
+			data_wrapper->stream, stream, error);
+	}
+
+	/* 3 */
+	if (mps->contentraw == NULL) {
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+			_("No content available"));
+		return -1;
 	}
 
 	/* 3 */
-	if (mps->signature == NULL || mps->contentraw == NULL)
+	if (mps->signature == NULL) {
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+			_("No signature available"));
 		return -1;
+	}
 
 	/* 2 */
 	boundary = camel_multipart_get_boundary(mp);
 	if (mp->preface) {
-		count = camel_stream_write_string (stream, mp->preface);
+		count = camel_stream_write_string (stream, mp->preface, error);
 		if (count == -1)
 			return -1;
 		total += count;
@@ -297,12 +306,12 @@ multipart_signed_write_to_stream (CamelDataWrapper *data_wrapper,
 	/* first boundary */
 	count = camel_stream_printf (stream, "\n--%s\n", boundary);
 	if (count == -1)
-		return -1;
+		goto file_error;
 	total += count;
 
 	/* output content part */
-	camel_stream_reset (mps->contentraw);
-	count = camel_stream_write_to_stream (mps->contentraw, stream);
+	camel_stream_reset (mps->contentraw, NULL);
+	count = camel_stream_write_to_stream (mps->contentraw, stream, error);
 	if (count == -1)
 		return -1;
 	total += count;
@@ -310,12 +319,12 @@ multipart_signed_write_to_stream (CamelDataWrapper *data_wrapper,
 	/* boundary */
 	count = camel_stream_printf (stream, "\n--%s\n", boundary);
 	if (count == -1)
-		return -1;
+		goto file_error;
 	total += count;
 
 	/* signature */
 	count = camel_data_wrapper_write_to_stream (
-		CAMEL_DATA_WRAPPER (mps->signature), stream);
+		CAMEL_DATA_WRAPPER (mps->signature), stream, error);
 	if (count == -1)
 		return -1;
 	total += count;
@@ -323,28 +332,37 @@ multipart_signed_write_to_stream (CamelDataWrapper *data_wrapper,
 	/* write the terminating boudary delimiter */
 	count = camel_stream_printf (stream, "\n--%s--\n", boundary);
 	if (count == -1)
-		return -1;
+		goto file_error;
 	total += count;
 
 	/* and finally the postface */
 	if (mp->postface) {
-		count = camel_stream_write_string (stream, mp->postface);
+		count = camel_stream_write_string (stream, mp->postface, error);
 		if (count == -1)
 			return -1;
 		total += count;
 	}
 
 	return total;
+
+file_error:
+	g_set_error (
+		error, G_IO_ERROR,
+		g_io_error_from_errno (errno),
+		"%s", g_strerror (errno));
+
+	return -1;
 }
 
 static gint
 multipart_signed_construct_from_stream (CamelDataWrapper *data_wrapper,
-                                        CamelStream *stream)
+                                        CamelStream *stream,
+                                        GError **error)
 {
 	CamelMultipartSigned *mps = (CamelMultipartSigned *)data_wrapper;
 	CamelStream *mem = camel_stream_mem_new();
 
-	if (camel_stream_write_to_stream (stream, mem) == -1)
+	if (camel_stream_write_to_stream (stream, mem, error) == -1)
 		return -1;
 
 	multipart_signed_set_stream (mps, mem);
@@ -409,10 +427,10 @@ multipart_signed_get_part (CamelMultipart *multipart,
 		} else {
 			stream = camel_seekable_substream_new((CamelSeekableStream *)dw->stream, mps->start1, mps->end1);
 		}
-		camel_stream_reset (stream);
+		camel_stream_reset (stream, NULL);
 		mps->content = camel_mime_part_new();
 		camel_data_wrapper_construct_from_stream (
-			CAMEL_DATA_WRAPPER (mps->content), stream);
+			CAMEL_DATA_WRAPPER (mps->content), stream, NULL);
 		g_object_unref (stream);
 		return mps->content;
 	case CAMEL_MULTIPART_SIGNED_SIGNATURE:
@@ -426,10 +444,10 @@ multipart_signed_get_part (CamelMultipart *multipart,
 			return NULL;
 		}
 		stream = camel_seekable_substream_new((CamelSeekableStream *)dw->stream, mps->start2, mps->end2);
-		camel_stream_reset (stream);
+		camel_stream_reset (stream, NULL);
 		mps->signature = camel_mime_part_new();
 		camel_data_wrapper_construct_from_stream (
-			CAMEL_DATA_WRAPPER (mps->signature), stream);
+			CAMEL_DATA_WRAPPER (mps->signature), stream, NULL);
 		g_object_unref (stream);
 		return mps->signature;
 	default:
@@ -481,7 +499,7 @@ multipart_signed_construct_from_parser (CamelMultipart *multipart,
 
 	stream = camel_stream_mem_new();
 	while (camel_mime_parser_step(mp, &buf, &len) != CAMEL_MIME_PARSER_STATE_BODY_END)
-		camel_stream_write(stream, buf, len);
+		camel_stream_write(stream, buf, len, NULL);
 
 	multipart_signed_set_stream (mps, stream);
 
@@ -566,7 +584,7 @@ camel_multipart_signed_new (void)
 /**
  * camel_multipart_signed_get_content_stream:
  * @mps: a #CamlMultipartSigned object
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Get the raw signed content stream of the multipart/signed MIME part
  * suitable for use with verification of the signature.
@@ -575,7 +593,7 @@ camel_multipart_signed_new (void)
  **/
 CamelStream *
 camel_multipart_signed_get_content_stream (CamelMultipartSigned *mps,
-                                           CamelException *ex)
+                                           GError **error)
 {
 	CamelStream *constream;
 
@@ -588,8 +606,9 @@ camel_multipart_signed_get_content_stream (CamelMultipartSigned *mps,
 		CamelMimeFilter *canon_filter;
 
 		if (mps->start1 == -1 && multipart_signed_parse_content(mps) == -1) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR,
+				CAMEL_ERROR_GENERIC,
 				_("parse error"));
 			return NULL;
 		}
diff --git a/camel/camel-multipart-signed.h b/camel/camel-multipart-signed.h
index 20b1054..b118274 100644
--- a/camel/camel-multipart-signed.h
+++ b/camel/camel-multipart-signed.h
@@ -104,7 +104,7 @@ GType camel_multipart_signed_get_type (void);
 /* public methods */
 CamelMultipartSigned *camel_multipart_signed_new           (void);
 
-CamelStream *camel_multipart_signed_get_content_stream(CamelMultipartSigned *mps, CamelException *ex);
+CamelStream *camel_multipart_signed_get_content_stream(CamelMultipartSigned *mps, GError **error);
 
 G_END_DECLS
 
diff --git a/camel/camel-multipart.c b/camel/camel-multipart.c
index 1c66bac..fe73caf 100644
--- a/camel/camel-multipart.c
+++ b/camel/camel-multipart.c
@@ -31,7 +31,6 @@
 #include <time.h>   /* for time */
 #include <unistd.h> /* for getpid */
 
-#include "camel-exception.h"
 #include "camel-mime-part.h"
 #include "camel-multipart.h"
 #include "camel-stream-mem.h"
@@ -68,7 +67,8 @@ multipart_finalize (GObject *object)
 /* this is MIME specific, doesn't belong here really */
 static gssize
 multipart_write_to_stream (CamelDataWrapper *data_wrapper,
-                           CamelStream *stream)
+                           CamelStream *stream,
+                           GError **error)
 {
 	CamelMultipart *multipart = CAMEL_MULTIPART (data_wrapper);
 	const gchar *boundary;
@@ -88,7 +88,8 @@ multipart_write_to_stream (CamelDataWrapper *data_wrapper,
 	 *    your mail client probably doesn't support ...."
 	 */
 	if (multipart->preface) {
-		count = camel_stream_write_string (stream, multipart->preface);
+		count = camel_stream_write_string (
+			stream, multipart->preface, error);
 		if (count == -1)
 			return -1;
 		total += count;
@@ -103,11 +104,11 @@ multipart_write_to_stream (CamelDataWrapper *data_wrapper,
 		count = camel_stream_printf (
 			stream, "\n--%s\n", boundary);
 		if (count == -1)
-			return -1;
+			goto file_error;
 		total += count;
 
 		count = camel_data_wrapper_write_to_stream (
-			CAMEL_DATA_WRAPPER (node->data), stream);
+			CAMEL_DATA_WRAPPER (node->data), stream, error);
 		if (count == -1)
 			return -1;
 		total += count;
@@ -118,19 +119,27 @@ multipart_write_to_stream (CamelDataWrapper *data_wrapper,
 	count = camel_stream_printf (
 		stream, "\n--%s--\n", boundary);
 	if (count == -1)
-		return -1;
+		goto file_error;
 	total += count;
 
 	/* and finally the postface */
 	if (multipart->postface) {
 		count = camel_stream_write_string (
-			stream, multipart->postface);
+			stream, multipart->postface, error);
 		if (count == -1)
 			return -1;
 		total += count;
 	}
 
 	return total;
+
+file_error:
+	g_set_error (
+		error, G_IO_ERROR,
+		g_io_error_from_errno (errno),
+		"%s", g_strerror (errno));
+
+	return -1;
 }
 
 static gboolean
@@ -301,7 +310,7 @@ multipart_construct_from_parser (CamelMultipart *multipart,
 	while (camel_mime_parser_step(mp, &buf, &len) != CAMEL_MIME_PARSER_STATE_MULTIPART_END) {
 		camel_mime_parser_unstep(mp);
 		bodypart = camel_mime_part_new();
-		camel_mime_part_construct_from_parser (bodypart, mp);
+		camel_mime_part_construct_from_parser (bodypart, mp, NULL);
 		camel_multipart_add_part(multipart, bodypart);
 		g_object_unref (bodypart);
 	}
diff --git a/camel/camel-net-utils.c b/camel/camel-net-utils.c
index cf7fd23..70d4b92 100644
--- a/camel/camel-net-utils.c
+++ b/camel/camel-net-utils.c
@@ -30,7 +30,6 @@
 
 #include <glib/gi18n-lib.h>
 
-#include "camel-exception.h"
 #include "camel-msgport.h"
 #include "camel-net-utils.h"
 #ifdef G_OS_WIN32
@@ -38,6 +37,7 @@
 #include <ws2tcpip.h>
 #include "camel-net-utils-win32.h"
 #endif
+#include "camel-object.h"
 #include "camel-operation.h"
 
 #define d(x)
@@ -447,11 +447,10 @@ static gint
 cs_waitinfo (gpointer (worker)(gpointer),
              struct _addrinfo_msg *msg,
              const gchar *errmsg,
-             CamelException *ex)
+             GError **error)
 {
 	CamelMsgPort *reply_port;
 	GThread *thread;
-	GError *err = NULL;
 	gint cancel_fd, cancel = 0, fd;
 
 	cancel_fd = camel_operation_cancel_fd(NULL);
@@ -462,7 +461,7 @@ cs_waitinfo (gpointer (worker)(gpointer),
 
 	reply_port = msg->msg.reply_port = camel_msgport_new();
 	fd = camel_msgport_fd(msg->msg.reply_port);
-	if ((thread = g_thread_create (worker, msg, TRUE, &err)) != NULL) {
+	if ((thread = g_thread_create (worker, msg, TRUE, error)) != NULL) {
 		gint status;
 #ifndef G_OS_WIN32
 		GPollFD polls[2];
@@ -496,8 +495,9 @@ cs_waitinfo (gpointer (worker)(gpointer),
 #endif
 						   ) {
 			if (status == -1)
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_SYSTEM,
+				g_set_error (
+					error, G_IO_ERROR,
+					g_io_error_from_errno (errno),
 					"%s: %s", errmsg,
 #ifndef G_OS_WIN32
 					g_strerror (errno)
@@ -506,9 +506,10 @@ cs_waitinfo (gpointer (worker)(gpointer),
 #endif
 					);
 			else
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_USER_CANCEL,
-					_("Canceled"));
+				g_set_error (
+					error, G_IO_ERROR,
+					G_IO_ERROR_CANCELLED,
+					_("Cancelled"));
 
 			/* We cancel so if the thread impl is decent it causes immediate exit.
 			   We check the reply port incase we had a reply in the mean time, which we free later */
@@ -527,13 +528,6 @@ cs_waitinfo (gpointer (worker)(gpointer),
 			if (reply != msg)
 				g_warning ("%s: Received msg reply %p doesn't match msg %p", G_STRFUNC, reply, msg);
 		}
-	} else {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			"%s: %s: %s", errmsg, _("cannot create thread"),
-			err ? err->message : _("Unknown error"));
-		if (err)
-			g_error_free (err);
 	}
 	camel_msgport_destroy(reply_port);
 
@@ -679,7 +673,7 @@ struct addrinfo *
 camel_getaddrinfo (const gchar *name,
                    const gchar *service,
                    const struct addrinfo *hints,
-                   CamelException *ex)
+                   GError **error)
 {
 	struct _addrinfo_msg *msg;
 	struct addrinfo *res = NULL;
@@ -689,9 +683,10 @@ camel_getaddrinfo (const gchar *name,
 	g_return_val_if_fail(name != NULL, NULL);
 
 	if (camel_operation_cancel_check(NULL)) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_USER_CANCEL,
-			_("Canceled"));
+		g_set_error (
+			error, G_IO_ERROR,
+			G_IO_ERROR_CANCELLED,
+			_("Cancelled"));
 		return NULL;
 	}
 
@@ -717,10 +712,10 @@ camel_getaddrinfo (const gchar *name,
 	msg->hostbuflen = 1024;
 	msg->hostbufmem = g_malloc(msg->hostbuflen);
 #endif
-	if (cs_waitinfo(cs_getaddrinfo, msg, _("Host lookup failed"), ex) == 0) {
+	if (cs_waitinfo(cs_getaddrinfo, msg, _("Host lookup failed"), error) == 0) {
 		if (msg->result != 0) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Host lookup failed: %s: %s"),
 				name, gai_strerror (msg->result));
 		}
@@ -831,15 +826,16 @@ camel_getnameinfo (const struct sockaddr *sa,
                    gchar **host,
                    gchar **serv,
                    gint flags,
-                   CamelException *ex)
+                   GError **error)
 {
 	struct _addrinfo_msg *msg;
 	gint result;
 
-	if (camel_operation_cancel_check(NULL)) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_USER_CANCEL,
-			_("Canceled"));
+	if (camel_operation_cancel_check (NULL)) {
+		g_set_error (
+			error, G_IO_ERROR,
+			G_IO_ERROR_CANCELLED,
+			_("Cancelled"));
 		return -1;
 	}
 
@@ -863,11 +859,11 @@ camel_getnameinfo (const struct sockaddr *sa,
 	msg->hostbuflen = 1024;
 	msg->hostbufmem = g_malloc(msg->hostbuflen);
 #endif
-	cs_waitinfo(cs_getnameinfo, msg, _("Name lookup failed"), ex);
+	cs_waitinfo(cs_getnameinfo, msg, _("Name lookup failed"), error);
 
 	if ((result = msg->result) != 0)
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Name lookup failed: %s"), gai_strerror (result));
 	else {
 		if (host)
diff --git a/camel/camel-net-utils.h b/camel/camel-net-utils.h
index 37210be..17ef3a3 100644
--- a/camel/camel-net-utils.h
+++ b/camel/camel-net-utils.h
@@ -40,8 +40,6 @@ struct addrinfo;
 
 G_BEGIN_DECLS
 
-struct _CamelException;
-
 #ifndef _WIN32
 #ifdef NEED_ADDRINFO
 /* Some of this is copied from GNU's netdb.h
@@ -91,10 +89,10 @@ struct addrinfo {
 #endif
 
 struct addrinfo *camel_getaddrinfo(const gchar *name, const gchar *service,
-				   const struct addrinfo *hints, struct _CamelException *ex);
+				   const struct addrinfo *hints, GError **error);
 void camel_freeaddrinfo(struct addrinfo *host);
 gint camel_getnameinfo(const struct sockaddr *sa, socklen_t salen, gchar **host, gchar **serv,
-		      gint flags, struct _CamelException *ex);
+		      gint flags, GError **error);
 
 G_END_DECLS
 
diff --git a/camel/camel-object.c b/camel/camel-object.c
index 26729bb..b2fda38 100644
--- a/camel/camel-object.c
+++ b/camel/camel-object.c
@@ -367,6 +367,19 @@ camel_object_init (CamelObject *object)
 	object->priv = CAMEL_OBJECT_GET_PRIVATE (object);
 }
 
+GQuark
+camel_error_quark (void)
+{
+	static GQuark quark = 0;
+
+	if (G_UNLIKELY (quark == 0)) {
+		const gchar *string = "camel-error-quark";
+		quark = g_quark_from_static_string (string);
+	}
+
+	return quark;
+}
+
 /**
  * camel_object_state_read:
  * @object: a #CamelObject
diff --git a/camel/camel-object.h b/camel/camel-object.h
index 0dbe294..bd9ccf4 100644
--- a/camel/camel-object.h
+++ b/camel/camel-object.h
@@ -29,10 +29,10 @@
 #ifndef CAMEL_OBJECT_H
 #define CAMEL_OBJECT_H
 
-#include <glib-object.h>
 #include <stdio.h>		/* FILE */
 #include <stdlib.h>		/* gsize */
 #include <stdarg.h>
+#include <gio/gio.h>
 
 /* Standard GObject macros */
 #define CAMEL_TYPE_OBJECT \
@@ -53,6 +53,9 @@
 	(G_TYPE_INSTANCE_GET_CLASS \
 	((obj), CAMEL_TYPE_OBJECT, CamelObjectClass))
 
+#define CAMEL_ERROR \
+	(camel_error_quark ())
+
 G_BEGIN_DECLS
 
 typedef struct _CamelObject CamelObject;
@@ -75,6 +78,10 @@ typedef enum {
 	CAMEL_PARAM_PERSISTENT = 1 << (G_PARAM_USER_SHIFT + 0)
 } CamelParamFlags;
 
+typedef enum {
+	CAMEL_ERROR_GENERIC		/* lazy fallback error */
+} CamelError;
+
 struct _CamelObject {
 	GObject parent;
 	CamelObjectPrivate *priv;
@@ -90,6 +97,7 @@ struct _CamelObjectClass {
 };
 
 GType		camel_object_get_type		(void);
+GQuark		camel_error_quark		(void) G_GNUC_CONST;
 gint		camel_object_state_read		(CamelObject *object);
 gint		camel_object_state_write	(CamelObject *object);
 const gchar *	camel_object_get_state_filename	(CamelObject *object);
diff --git a/camel/camel-offline-folder.c b/camel/camel-offline-folder.c
index 86b6aa0..40527b6 100644
--- a/camel/camel-offline-folder.c
+++ b/camel/camel-offline-folder.c
@@ -26,6 +26,7 @@
 
 #include <glib/gi18n-lib.h>
 
+#include "camel-debug.h"
 #include "camel-offline-folder.h"
 #include "camel-operation.h"
 #include "camel-service.h"
@@ -69,10 +70,10 @@ offline_downsync_sync (CamelSession *session, CamelSessionThreadMsg *mm)
 			gint pc = i * 100 / m->changes->uid_added->len;
 
 			camel_operation_progress (NULL, pc);
-			camel_folder_sync_message (m->folder, m->changes->uid_added->pdata[i], &mm->ex);
+			camel_folder_sync_message (m->folder, m->changes->uid_added->pdata[i], &mm->error);
 		}
 	} else {
-		camel_offline_folder_downsync ((CamelOfflineFolder *) m->folder, "(match-all)", &mm->ex);
+		camel_offline_folder_downsync ((CamelOfflineFolder *) m->folder, "(match-all)", &mm->error);
 	}
 
 	camel_operation_end (NULL);
@@ -158,7 +159,7 @@ offline_folder_get_property (GObject *object,
 static gboolean
 offline_folder_downsync (CamelOfflineFolder *offline,
                          const gchar *expression,
-                         CamelException *ex)
+                         GError **error)
 {
 	CamelFolder *folder = (CamelFolder *) offline;
 	GPtrArray *uids, *uncached_uids = NULL;
@@ -169,13 +170,13 @@ offline_folder_downsync (CamelOfflineFolder *offline,
 		camel_folder_get_full_name (folder));
 
 	if (expression)
-		uids = camel_folder_search_by_expression (folder, expression, ex);
+		uids = camel_folder_search_by_expression (folder, expression, NULL);
 	else
 		uids = camel_folder_get_uids (folder);
 
 	if (!uids)
 		goto done;
-	uncached_uids = camel_folder_get_uncached_uids(folder, uids, ex);
+	uncached_uids = camel_folder_get_uncached_uids(folder, uids, NULL);
 	if (uids) {
 		if (expression)
 			camel_folder_search_free (folder, uids);
@@ -188,7 +189,7 @@ offline_folder_downsync (CamelOfflineFolder *offline,
 
 	for (i = 0; i < uncached_uids->len; i++) {
 		gint pc = i * 100 / uncached_uids->len;
-		camel_folder_sync_message (folder, uncached_uids->pdata[i], ex);
+		camel_folder_sync_message (folder, uncached_uids->pdata[i], NULL);
 		camel_operation_progress (NULL, pc);
 	}
 
@@ -272,7 +273,7 @@ camel_offline_folder_set_offline_sync (CamelOfflineFolder *offline_folder,
  * camel_offline_folder_downsync:
  * @offline: a #CamelOfflineFolder object
  * @expression: search expression describing which set of messages to downsync (%NULL for all)
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Syncs messages in @offline described by the search @expression to
  * the local machine for offline availability.
@@ -282,14 +283,18 @@ camel_offline_folder_set_offline_sync (CamelOfflineFolder *offline_folder,
 gboolean
 camel_offline_folder_downsync (CamelOfflineFolder *offline,
                                const gchar *expression,
-                               CamelException *ex)
+                               GError **error)
 {
 	CamelOfflineFolderClass *class;
+	gboolean success;
 
 	g_return_val_if_fail (CAMEL_IS_OFFLINE_FOLDER (offline), FALSE);
 
 	class = CAMEL_OFFLINE_FOLDER_GET_CLASS (offline);
 	g_return_val_if_fail (class->downsync != NULL, FALSE);
 
-	return class->downsync (offline, expression, ex);
+	success = class->downsync (offline, expression, error);
+	CAMEL_CHECK_GERROR (offline, downsync, success, error);
+
+	return success;
 }
diff --git a/camel/camel-offline-folder.h b/camel/camel-offline-folder.h
index 7afece9..9032abd 100644
--- a/camel/camel-offline-folder.h
+++ b/camel/camel-offline-folder.h
@@ -64,7 +64,7 @@ struct _CamelOfflineFolderClass {
 
 	gboolean	(*downsync)		(CamelOfflineFolder *folder,
 						 const gchar *expression,
-						 CamelException *ex);
+						 GError **error);
 };
 
 GType		camel_offline_folder_get_type	(void);
@@ -75,7 +75,7 @@ void		camel_offline_folder_set_offline_sync
 						 gboolean offline_sync);
 gboolean	camel_offline_folder_downsync	(CamelOfflineFolder *offline,
 						 const gchar *expression,
-						 CamelException *ex);
+						 GError **error);
 
 G_END_DECLS
 
diff --git a/camel/camel-offline-journal.c b/camel/camel-offline-journal.c
index b232c06..76006cb 100644
--- a/camel/camel-offline-journal.c
+++ b/camel/camel-offline-journal.c
@@ -123,7 +123,7 @@ camel_offline_journal_set_filename (CamelOfflineJournal *journal, const gchar *f
 /**
  * camel_offline_journal_write:
  * @journal: a #CamelOfflineJournal object
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Save the journal to disk.
  *
@@ -131,15 +131,16 @@ camel_offline_journal_set_filename (CamelOfflineJournal *journal, const gchar *f
  **/
 gint
 camel_offline_journal_write (CamelOfflineJournal *journal,
-                             CamelException *ex)
+                             GError **error)
 {
 	CamelDListNode *entry;
 	FILE *fp;
 	gint fd;
 
 	if ((fd = g_open (journal->filename, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0666)) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Cannot write offline journal for folder '%s': %s"),
 			camel_folder_get_full_name (journal->folder),
 			g_strerror (errno));
@@ -163,8 +164,9 @@ camel_offline_journal_write (CamelOfflineJournal *journal,
 
  exception:
 
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, G_IO_ERROR,
+		g_io_error_from_errno (errno),
 		_("Cannot write offline journal for folder '%s': %s"),
 		camel_folder_get_full_name (journal->folder),
 		g_strerror (errno));
@@ -177,7 +179,7 @@ camel_offline_journal_write (CamelOfflineJournal *journal,
 /**
  * camel_offline_journal_replay:
  * @journal: a #CamelOfflineJournal object
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Replay all entries in the journal.
  *
@@ -185,21 +187,21 @@ camel_offline_journal_write (CamelOfflineJournal *journal,
  **/
 gint
 camel_offline_journal_replay (CamelOfflineJournal *journal,
-                              CamelException *ex)
+                              GError **error)
 {
 	CamelDListNode *entry, *next;
-	CamelException lex;
+	GError *local_error = NULL;
 	gint failed = 0;
 
-	camel_exception_init (&lex);
-
 	entry = journal->queue.head;
 	while (entry->next) {
 		next = entry->next;
-		if (CAMEL_OFFLINE_JOURNAL_GET_CLASS (journal)->entry_play (journal, entry, &lex) == -1) {
-			if (failed == 0)
-				camel_exception_xfer (ex, &lex);
-			camel_exception_clear (&lex);
+		if (CAMEL_OFFLINE_JOURNAL_GET_CLASS (journal)->entry_play (journal, entry, &local_error) == -1) {
+			if (failed == 0) {
+				g_propagate_error (error, local_error);
+				local_error = NULL;
+			}
+			g_clear_error (&local_error);
 			failed++;
 		} else {
 			camel_dlist_remove (entry);
diff --git a/camel/camel-offline-journal.h b/camel/camel-offline-journal.h
index ec21026..f280449 100644
--- a/camel/camel-offline-journal.h
+++ b/camel/camel-offline-journal.h
@@ -76,7 +76,7 @@ struct _CamelOfflineJournalClass {
 
 	CamelDListNode * (* entry_load) (CamelOfflineJournal *journal, FILE *in);
 	gint (* entry_write) (CamelOfflineJournal *journal, CamelDListNode *entry, FILE *out);
-	gint (* entry_play) (CamelOfflineJournal *journal, CamelDListNode *entry, CamelException *ex);
+	gint (* entry_play) (CamelOfflineJournal *journal, CamelDListNode *entry, GError **error);
 };
 
 GType camel_offline_journal_get_type (void);
@@ -84,8 +84,8 @@ GType camel_offline_journal_get_type (void);
 void camel_offline_journal_construct (CamelOfflineJournal *journal, struct _CamelFolder *folder, const gchar *filename);
 void camel_offline_journal_set_filename (CamelOfflineJournal *journal, const gchar *filename);
 
-gint camel_offline_journal_write (CamelOfflineJournal *journal, CamelException *ex);
-gint camel_offline_journal_replay (CamelOfflineJournal *journal, CamelException *ex);
+gint camel_offline_journal_write (CamelOfflineJournal *journal, GError **error);
+gint camel_offline_journal_replay (CamelOfflineJournal *journal, GError **error);
 
 G_END_DECLS
 
diff --git a/camel/camel-offline-store.c b/camel/camel-offline-store.c
index d2425d8..aefd401 100644
--- a/camel/camel-offline-store.c
+++ b/camel/camel-offline-store.c
@@ -38,14 +38,14 @@ offline_store_construct (CamelService *service,
                          CamelSession *session,
                          CamelProvider *provider,
                          CamelURL *url,
-                         CamelException *ex)
+                         GError **error)
 {
 	CamelOfflineStore *store = CAMEL_OFFLINE_STORE (service);
 	CamelServiceClass *service_class;
 
 	/* Chain up to parent's construct() method. */
 	service_class = CAMEL_SERVICE_CLASS (camel_offline_store_parent_class);
-	if (!service_class->construct (service, session, provider, url, ex))
+	if (!service_class->construct (service, session, provider, url, error))
 		return FALSE;
 
 	store->state = camel_session_get_online (session) ?
@@ -73,7 +73,7 @@ camel_offline_store_init (CamelOfflineStore *store)
 /**
  * camel_offline_store_get_network_state:
  * @store: a #CamelOfflineStore object
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Return the network state either #CAMEL_OFFLINE_STORE_NETWORK_AVAIL
  * or #CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL.
@@ -82,7 +82,7 @@ camel_offline_store_init (CamelOfflineStore *store)
  **/
 gint
 camel_offline_store_get_network_state (CamelOfflineStore *store,
-                                       CamelException *ex)
+                                       GError **error)
 {
 	return store->state;
 }
@@ -91,7 +91,7 @@ camel_offline_store_get_network_state (CamelOfflineStore *store,
  * camel_offline_store_set_network_state:
  * @store: a #CamelOfflineStore object
  * @state: the network state
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Set the network state to either #CAMEL_OFFLINE_STORE_NETWORK_AVAIL
  * or #CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL.
@@ -99,9 +99,8 @@ camel_offline_store_get_network_state (CamelOfflineStore *store,
 gboolean
 camel_offline_store_set_network_state (CamelOfflineStore *store,
                                        gint state,
-                                       CamelException *ex)
+                                       GError **error)
 {
-	CamelException lex;
 	CamelService *service = CAMEL_SERVICE (store);
 	gboolean network_available;
 
@@ -111,7 +110,6 @@ camel_offline_store_set_network_state (CamelOfflineStore *store,
 	network_available =
 		camel_session_get_network_available (service->session);
 
-	camel_exception_init (&lex);
 	if (store->state == CAMEL_OFFLINE_STORE_NETWORK_AVAIL) {
 		/* network available -> network unavailable */
 		if (network_available) {
@@ -128,8 +126,7 @@ camel_offline_store_set_network_state (CamelOfflineStore *store,
 
 					if (G_TYPE_CHECK_INSTANCE_TYPE (folder, CAMEL_TYPE_OFFLINE_FOLDER)
 					    && (sync || camel_offline_folder_get_offline_sync (CAMEL_OFFLINE_FOLDER (folder)))) {
-						camel_offline_folder_downsync ((CamelOfflineFolder *) folder, NULL, &lex);
-						camel_exception_clear (&lex);
+						camel_offline_folder_downsync ((CamelOfflineFolder *) folder, NULL, NULL);
 					}
 
 					g_object_unref (folder);
@@ -138,16 +135,15 @@ camel_offline_store_set_network_state (CamelOfflineStore *store,
 				g_ptr_array_free (folders, TRUE);
 			}
 
-			camel_store_sync (CAMEL_STORE (store), FALSE, &lex);
-			camel_exception_clear (&lex);
+			camel_store_sync (CAMEL_STORE (store), FALSE, NULL);
 		}
 
-		if (!camel_service_disconnect (CAMEL_SERVICE (store), network_available, ex))
+		if (!camel_service_disconnect (CAMEL_SERVICE (store), network_available, error))
 			return FALSE;
 	} else {
 		store->state = state;
 		/* network unavailable -> network available */
-		if (!camel_service_connect (CAMEL_SERVICE (store), ex)) {
+		if (!camel_service_connect (CAMEL_SERVICE (store), error)) {
 			store->state = CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL;
 			return FALSE;
 		}
@@ -165,15 +161,13 @@ camel_offline_store_set_network_state (CamelOfflineStore *store,
  **/
 gboolean
 camel_offline_store_prepare_for_offline (CamelOfflineStore *store,
-                                         CamelException *ex)
+                                         GError **error)
 {
-	CamelException lex;
 	CamelService *service = CAMEL_SERVICE (store);
 	gboolean network_available;
 
 	network_available = camel_session_get_network_available (service->session);
 
-	camel_exception_init (&lex);
 	if (network_available) {
 		if (store->state == CAMEL_OFFLINE_STORE_NETWORK_AVAIL) {
 			if (((CamelStore *) store)->folders) {
@@ -189,8 +183,7 @@ camel_offline_store_prepare_for_offline (CamelOfflineStore *store,
 
 					if (G_TYPE_CHECK_INSTANCE_TYPE (folder, CAMEL_TYPE_OFFLINE_FOLDER)
 					    && (sync || camel_offline_folder_get_offline_sync (CAMEL_OFFLINE_FOLDER (folder)))) {
-						camel_offline_folder_downsync ((CamelOfflineFolder *) folder, NULL, &lex);
-						camel_exception_clear (&lex);
+						camel_offline_folder_downsync ((CamelOfflineFolder *) folder, NULL, NULL);
 					}
 					g_object_unref (folder);
 				}
@@ -198,8 +191,7 @@ camel_offline_store_prepare_for_offline (CamelOfflineStore *store,
 			}
 		}
 
-		camel_store_sync (CAMEL_STORE (store), FALSE, &lex);
-		camel_exception_clear (&lex);
+		camel_store_sync (CAMEL_STORE (store), FALSE, NULL);
 	}
 
 	return TRUE;
diff --git a/camel/camel-offline-store.h b/camel/camel-offline-store.h
index 43b0f63..8900f89 100644
--- a/camel/camel-offline-store.h
+++ b/camel/camel-offline-store.h
@@ -67,15 +67,15 @@ struct _CamelOfflineStore {
 struct _CamelOfflineStoreClass {
 	CamelStoreClass parent_class;
 
-	gboolean (* set_network_state) (CamelOfflineStore *store, gint state, CamelException *ex);
+	gboolean (* set_network_state) (CamelOfflineStore *store, gint state, GError **error);
 };
 
 GType camel_offline_store_get_type (void);
 
-gboolean camel_offline_store_set_network_state (CamelOfflineStore *store, gint state, CamelException *ex);
-gint camel_offline_store_get_network_state (CamelOfflineStore *store, CamelException *ex);
+gboolean camel_offline_store_set_network_state (CamelOfflineStore *store, gint state, GError **error);
+gint camel_offline_store_get_network_state (CamelOfflineStore *store, GError **error);
 
-gboolean camel_offline_store_prepare_for_offline (CamelOfflineStore *store, CamelException *ex);
+gboolean camel_offline_store_prepare_for_offline (CamelOfflineStore *store, GError **error);
 
 G_END_DECLS
 
diff --git a/camel/camel-provider.c b/camel/camel-provider.c
index 1ee190f..8b1bd4f 100644
--- a/camel/camel-provider.c
+++ b/camel/camel-provider.c
@@ -38,7 +38,6 @@
 #include <glib/gstdio.h>
 #include <gmodule.h>
 
-#include "camel-exception.h"
 #include "camel-provider.h"
 #include "camel-string-utils.h"
 #include "camel-vee-store.h"
@@ -166,7 +165,7 @@ camel_provider_init (void)
 /**
  * camel_provider_load:
  * @path: the path to a shared library
- * @ex: a CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Loads the provider at @path, and calls its initialization function,
  * passing @session as an argument. The provider should then register
@@ -176,7 +175,7 @@ camel_provider_init (void)
  **/
 gboolean
 camel_provider_load (const gchar *path,
-                     CamelException *ex)
+                     GError **error)
 {
 	GModule *module;
 	CamelProvider *(*provider_module_init) (void);
@@ -184,8 +183,8 @@ camel_provider_load (const gchar *path,
 	g_once (&setup_once, provider_setup, NULL);
 
 	if (!g_module_supported ()) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Could not load %s: Module loading "
 			  "not supported on this system."), path);
 		return FALSE;
@@ -193,8 +192,8 @@ camel_provider_load (const gchar *path,
 
 	module = g_module_open (path, G_MODULE_BIND_LAZY);
 	if (module == NULL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Could not load %s: %s"),
 			path, g_module_error ());
 		return FALSE;
@@ -202,8 +201,8 @@ camel_provider_load (const gchar *path,
 
 	if (!g_module_symbol (module, "camel_provider_module_init",
 			      (gpointer *)&provider_module_init)) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Could not load %s: No initialization "
 			  "code in module."), path);
 		g_module_close (module);
@@ -344,16 +343,16 @@ camel_provider_list(gboolean load)
 /**
  * camel_provider_get:
  * @url_string: the URL for the service whose provider you want
- * @ex: a CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * This returns the CamelProvider that would be used to handle
  * @url_string, loading it in from disk if necessary.
  *
- * Returns: the provider, or %NULL, in which case @ex will be set.
+ * Returns: the provider, or %NULL, in which case @error will be set.
  **/
 CamelProvider *
 camel_provider_get (const gchar *url_string,
-                    CamelException *ex)
+                    GError **error)
 {
 	CamelProvider *provider = NULL;
 	gchar *protocol;
@@ -376,15 +375,16 @@ camel_provider_get (const gchar *url_string,
 		m = g_hash_table_lookup(module_table, protocol);
 		if (m && !m->loaded) {
 			m->loaded = 1;
-			if (!camel_provider_load (m->path, ex))
+			if (!camel_provider_load (m->path, error))
 				goto fail;
 		}
 		provider = g_hash_table_lookup(provider_table, protocol);
 	}
 
 	if (provider == NULL)
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_URL_INVALID,
 			_("No provider available for protocol '%s'"),
 			protocol);
 fail:
@@ -398,7 +398,7 @@ fail:
  * @provider: camel provider
  * @url: a #CamelURL
  * @auto_detected: output hash table of auto-detected values
- * @ex: exception
+ * @error: return location for a #GError, or %NULL
  *
  * After filling in the standard Username/Hostname/Port/Path settings
  * (which must be set in @url), if the provider supports it, you
@@ -418,12 +418,12 @@ gint
 camel_provider_auto_detect (CamelProvider *provider,
                             CamelURL *url,
                             GHashTable **auto_detected,
-                            CamelException *ex)
+                            GError **error)
 {
 	g_return_val_if_fail (provider != NULL, -1);
 
 	if (provider->auto_detect) {
-		return provider->auto_detect (url, auto_detected, ex);
+		return provider->auto_detect (url, auto_detected, error);
 	} else {
 		*auto_detected = NULL;
 		return 0;
diff --git a/camel/camel-provider.h b/camel/camel-provider.h
index 0eb335e..26a07aa 100644
--- a/camel/camel-provider.h
+++ b/camel/camel-provider.h
@@ -31,7 +31,6 @@
 #ifndef CAMEL_PROVIDER_H
 #define CAMEL_PROVIDER_H
 
-#include <camel/camel-exception.h>
 #include <camel/camel-object.h>
 #include <camel/camel-object-bag.h>
 #include <camel/camel-url.h>
@@ -147,7 +146,7 @@ typedef struct {
 #define CAMEL_PROVIDER_CONF_DEFAULT_HOSTNAME  { CAMEL_PROVIDER_CONF_LABEL, "hostname", NULL, N_("_Host:"), NULL }
 #define CAMEL_PROVIDER_CONF_DEFAULT_PATH      { CAMEL_PROVIDER_CONF_ENTRY, "path", NULL, N_("_Path:"), "" }
 
-typedef gint (*CamelProviderAutoDetectFunc) (CamelURL *url, GHashTable **auto_detected, CamelException *ex);
+typedef gint (*CamelProviderAutoDetectFunc) (CamelURL *url, GHashTable **auto_detected, GError **error);
 
 typedef struct {
 	/* Provider name used in CamelURLs. */
@@ -226,11 +225,11 @@ struct _CamelProviderModule {
 
 void		camel_provider_init		(void);
 gboolean	camel_provider_load		(const gchar *path,
-						 CamelException *ex);
+						 GError **error);
 void		camel_provider_register		(CamelProvider *provider);
 GList *		camel_provider_list		(gboolean load);
 CamelProvider *	camel_provider_get		(const gchar *url_string,
-						 CamelException *ex);
+						 GError **error);
 
 /* This is defined by each module, not by camel-provider.c. */
 void		camel_provider_module_init	(void);
@@ -238,7 +237,7 @@ void		camel_provider_module_init	(void);
 gint		camel_provider_auto_detect	(CamelProvider *provider,
 						 CamelURL *url,
 						 GHashTable **auto_detected,
-						 CamelException *ex);
+						 GError **error);
 
 G_END_DECLS
 
diff --git a/camel/camel-sasl-anonymous.c b/camel/camel-sasl-anonymous.c
index 80d4035..dbbb500 100644
--- a/camel/camel-sasl-anonymous.c
+++ b/camel/camel-sasl-anonymous.c
@@ -56,15 +56,16 @@ sasl_anonymous_finalize (GObject *object)
 static GByteArray *
 sasl_anonymous_challenge (CamelSasl *sasl,
                           GByteArray *token,
-                          CamelException *ex)
+                          GError **error)
 {
 	CamelSaslAnonymous *sasl_anon = CAMEL_SASL_ANONYMOUS (sasl);
 	CamelInternetAddress *cia;
 	GByteArray *ret = NULL;
 
 	if (token) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 			_("Authentication failed."));
 		return NULL;
 	}
@@ -73,8 +74,9 @@ sasl_anonymous_challenge (CamelSasl *sasl,
 	case CAMEL_SASL_ANON_TRACE_EMAIL:
 		cia = camel_internet_address_new ();
 		if (camel_internet_address_add (cia, NULL, sasl_anon->trace_info) != 1) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				_("Invalid email address trace information:\n%s"),
 				sasl_anon->trace_info);
 			g_object_unref (cia);
@@ -86,8 +88,9 @@ sasl_anonymous_challenge (CamelSasl *sasl,
 		break;
 	case CAMEL_SASL_ANON_TRACE_OPAQUE:
 		if (strchr (sasl_anon->trace_info, '@')) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				_("Invalid opaque trace information:\n%s"),
 				sasl_anon->trace_info);
 			return NULL;
@@ -99,8 +102,9 @@ sasl_anonymous_challenge (CamelSasl *sasl,
 		ret = g_byte_array_new ();
 		break;
 	default:
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 			_("Invalid trace information:\n%s"),
 			sasl_anon->trace_info);
 		return NULL;
diff --git a/camel/camel-sasl-cram-md5.c b/camel/camel-sasl-cram-md5.c
index e07d41d..ae4bb16 100644
--- a/camel/camel-sasl-cram-md5.c
+++ b/camel/camel-sasl-cram-md5.c
@@ -60,7 +60,7 @@ G_DEFINE_TYPE (CamelSaslCramMd5, camel_sasl_cram_md5, CAMEL_TYPE_SASL)
 static GByteArray *
 sasl_cram_md5_challenge (CamelSasl *sasl,
                          GByteArray *token,
-                         CamelException *ex)
+                         GError **error)
 {
 	CamelService *service;
 	GChecksum *checksum;
diff --git a/camel/camel-sasl-digest-md5.c b/camel/camel-sasl-digest-md5.c
index c765ac7..1ca0dd4 100644
--- a/camel/camel-sasl-digest-md5.c
+++ b/camel/camel-sasl-digest-md5.c
@@ -787,7 +787,7 @@ sasl_digest_md5_finalize (GObject *object)
 static GByteArray *
 sasl_digest_md5_challenge (CamelSasl *sasl,
                            GByteArray *token,
-                           CamelException *ex)
+                           GError **error)
 {
 	CamelSaslDigestMd5 *sasl_digest = CAMEL_SASL_DIGEST_MD5 (sasl);
 	struct _CamelSaslDigestMd5Private *priv = sasl_digest->priv;
@@ -812,8 +812,9 @@ sasl_digest_md5_challenge (CamelSasl *sasl,
 	switch (priv->state) {
 	case STATE_AUTH:
 		if (token->len > 2048) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				_("Server challenge too long (>2048 octets)"));
 			return NULL;
 		}
@@ -822,15 +823,17 @@ sasl_digest_md5_challenge (CamelSasl *sasl,
 		priv->challenge = parse_server_challenge (tokens, &abort);
 		g_free (tokens);
 		if (!priv->challenge || abort) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				_("Server challenge invalid\n"));
 			return NULL;
 		}
 
 		if (priv->challenge->qop == QOP_INVALID) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				_("Server challenge contained invalid "
 				  "\"Quality of Protection\" token"));
 			return NULL;
@@ -860,8 +863,9 @@ sasl_digest_md5_challenge (CamelSasl *sasl,
 
 		if (!tokens || !*tokens) {
 			g_free (tokens);
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				_("Server response did not contain "
 				  "authorization data"));
 			return NULL;
@@ -880,8 +884,9 @@ sasl_digest_md5_challenge (CamelSasl *sasl,
 		if (!rspauth->value) {
 			g_free (rspauth->name);
 			g_free (rspauth);
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				_("Server response contained incomplete "
 				  "authorization data"));
 			return NULL;
@@ -892,8 +897,9 @@ sasl_digest_md5_challenge (CamelSasl *sasl,
 			g_free (rspauth->name);
 			g_free (rspauth->value);
 			g_free (rspauth);
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				_("Server response does not match"));
 			camel_sasl_set_authenticated (sasl, TRUE);
 
diff --git a/camel/camel-sasl-gssapi.c b/camel/camel-sasl-gssapi.c
index 5f4de93..d556300 100644
--- a/camel/camel-sasl-gssapi.c
+++ b/camel/camel-sasl-gssapi.c
@@ -112,7 +112,7 @@ G_DEFINE_TYPE (CamelSaslGssapi, camel_sasl_gssapi, CAMEL_TYPE_SASL)
 static void
 gssapi_set_exception (OM_uint32 major,
                       OM_uint32 minor,
-                      CamelException *ex)
+                      GError **error)
 {
 	const gchar *str;
 
@@ -162,7 +162,10 @@ gssapi_set_exception (OM_uint32 major,
 		str = _("Bad authentication response from server.");
 	}
 
-	camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, str);
+	g_set_error (
+		error, CAMEL_SERVICE_ERROR,
+		CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
+		"%s", str);
 }
 
 static void
@@ -244,7 +247,7 @@ send_dbus_message (gchar *name)
 static GByteArray *
 sasl_gssapi_challenge (CamelSasl *sasl,
                        GByteArray *token,
-                       CamelException *ex)
+                       GError **error)
 {
 	CamelSaslGssapiPrivate *priv;
 	CamelService *service;
@@ -268,7 +271,7 @@ sasl_gssapi_challenge (CamelSasl *sasl,
 	case GSSAPI_STATE_INIT:
 		memset(&hints, 0, sizeof(hints));
 		hints.ai_flags = AI_CANONNAME;
-		ai = camel_getaddrinfo(service->url->host?service->url->host:"localhost", NULL, &hints, ex);
+		ai = camel_getaddrinfo(service->url->host?service->url->host:"localhost", NULL, &hints, error);
 		if (ai == NULL)
 			return NULL;
 
@@ -281,7 +284,7 @@ sasl_gssapi_challenge (CamelSasl *sasl,
 		g_free (str);
 
 		if (major != GSS_S_COMPLETE) {
-			gssapi_set_exception (major, minor, ex);
+			gssapi_set_exception (major, minor, error);
 			return NULL;
 		}
 
@@ -291,8 +294,9 @@ sasl_gssapi_challenge (CamelSasl *sasl,
 		break;
 	case GSSAPI_STATE_CONTINUE_NEEDED:
 		if (token == NULL) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				_("Bad authentication response from server."));
 			return NULL;
 		}
@@ -322,7 +326,7 @@ sasl_gssapi_challenge (CamelSasl *sasl,
 			    send_dbus_message (service->url->user))
 					goto challenge;
 
-			gssapi_set_exception (major, minor, ex);
+			gssapi_set_exception (major, minor, error);
 			return NULL;
 		}
 
@@ -334,8 +338,9 @@ sasl_gssapi_challenge (CamelSasl *sasl,
 		break;
 	case GSSAPI_STATE_COMPLETE:
 		if (token == NULL) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				_("Bad authentication response from server."));
 			return NULL;
 		}
@@ -345,13 +350,14 @@ sasl_gssapi_challenge (CamelSasl *sasl,
 
 		major = gss_unwrap (&minor, priv->ctx, &inbuf, &outbuf, &conf_state, &qop);
 		if (major != GSS_S_COMPLETE) {
-			gssapi_set_exception (major, minor, ex);
+			gssapi_set_exception (major, minor, error);
 			return NULL;
 		}
 
 		if (outbuf.length < 4) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				_("Bad authentication response from server."));
 #ifndef HAVE_HEIMDAL_KRB5
 			gss_release_buffer (&minor, &outbuf);
@@ -361,8 +367,9 @@ sasl_gssapi_challenge (CamelSasl *sasl,
 
 		/* check that our desired security layer is supported */
 		if ((((guchar *) outbuf.value)[0] & DESIRED_SECURITY_LAYER) != DESIRED_SECURITY_LAYER) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				_("Unsupported security layer."));
 #ifndef HAVE_HEIMDAL_KRB5
 			gss_release_buffer (&minor, &outbuf);
@@ -382,7 +389,7 @@ sasl_gssapi_challenge (CamelSasl *sasl,
 
 		major = gss_wrap (&minor, priv->ctx, FALSE, qop, &inbuf, &conf_state, &outbuf);
 		if (major != GSS_S_COMPLETE) {
-			gssapi_set_exception (major, minor, ex);
+			gssapi_set_exception (major, minor, error);
 			g_free (str);
 			return NULL;
 		}
diff --git a/camel/camel-sasl-login.c b/camel/camel-sasl-login.c
index 4d5cabf..de3aba4 100644
--- a/camel/camel-sasl-login.c
+++ b/camel/camel-sasl-login.c
@@ -59,7 +59,7 @@ G_DEFINE_TYPE (CamelSaslLogin, camel_sasl_login, CAMEL_TYPE_SASL)
 static GByteArray *
 sasl_login_challenge (CamelSasl *sasl,
                       GByteArray *token,
-                      CamelException *ex)
+                      GError **error)
 {
 	CamelSaslLoginPrivate *priv;
 	GByteArray *buf = NULL;
@@ -88,10 +88,10 @@ sasl_login_challenge (CamelSasl *sasl,
 		camel_sasl_set_authenticated (sasl, TRUE);
 		break;
 	default:
-		if (!camel_exception_is_set (ex))
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
-				_("Unknown authentication state."));
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
+			_("Unknown authentication state."));
 	}
 
 	priv->state++;
diff --git a/camel/camel-sasl-ntlm.c b/camel/camel-sasl-ntlm.c
index 7d81430..c2c87ac 100644
--- a/camel/camel-sasl-ntlm.c
+++ b/camel/camel-sasl-ntlm.c
@@ -661,7 +661,7 @@ deskey (DES_KS k, guchar *key, gint decrypt)
 static GByteArray *
 sasl_ntlm_challenge (CamelSasl *sasl,
                      GByteArray *token,
-                     CamelException *ex)
+                     GError **error)
 {
 	CamelService *service;
 	GByteArray *ret;
diff --git a/camel/camel-sasl-plain.c b/camel/camel-sasl-plain.c
index 6c83149..e27a6b9 100644
--- a/camel/camel-sasl-plain.c
+++ b/camel/camel-sasl-plain.c
@@ -54,7 +54,7 @@ G_DEFINE_TYPE (CamelSaslPlain, camel_sasl_plain, CAMEL_TYPE_SASL)
 static GByteArray *
 sasl_plain_challenge (CamelSasl *sasl,
                       GByteArray *token,
-                      CamelException *ex)
+                      GError **error)
 {
 	GByteArray *buf = NULL;
 	CamelService *service;
diff --git a/camel/camel-sasl-popb4smtp.c b/camel/camel-sasl-popb4smtp.c
index 7fc9bba..744fdae 100644
--- a/camel/camel-sasl-popb4smtp.c
+++ b/camel/camel-sasl-popb4smtp.c
@@ -66,7 +66,7 @@ G_DEFINE_TYPE (CamelSaslPOPB4SMTP, camel_sasl_popb4smtp, CAMEL_TYPE_SASL)
 static GByteArray *
 sasl_popb4smtp_challenge (CamelSasl *sasl,
                           GByteArray *token,
-                          CamelException *ex)
+                          GError **error)
 {
 	gchar *popuri;
 	CamelService *service;
@@ -80,18 +80,20 @@ sasl_popb4smtp_challenge (CamelSasl *sasl,
 
 	popuri = camel_session_get_password (
 		session, service, NULL, _("POP Source URI"),
-		"popb4smtp_uri", 0, ex);
+		"popb4smtp_uri", 0, error);
 
 	if (popuri == NULL) {
-		camel_exception_setv (
-			ex, 1,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 			_("POP Before SMTP auth using an unknown transport"));
 		return NULL;
 	}
 
 	if (g_ascii_strncasecmp(popuri, "pop:", 4) != 0) {
-		camel_exception_setv (
-			ex, 1,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 			_("POP Before SMTP auth using a non-pop source"));
 		return NULL;
 	}
@@ -116,7 +118,7 @@ sasl_popb4smtp_challenge (CamelSasl *sasl,
 	}
 
 	/* connect to pop session */
-	store = camel_session_get_store(session, popuri, ex);
+	store = camel_session_get_store(session, popuri, error);
 	if (store) {
 		camel_sasl_set_authenticated (sasl, TRUE);
 		g_object_unref (store);
diff --git a/camel/camel-sasl.c b/camel/camel-sasl.c
index f1ae5f3..08b6c3b 100644
--- a/camel/camel-sasl.c
+++ b/camel/camel-sasl.c
@@ -26,6 +26,7 @@
 
 #include <string.h>
 
+#include "camel-debug.h"
 #include "camel-mime-utils.h"
 #include "camel-sasl-cram-md5.h"
 #include "camel-sasl-digest-md5.h"
@@ -257,7 +258,7 @@ camel_sasl_init (CamelSasl *sasl)
  * camel_sasl_challenge:
  * @sasl: a #CamelSasl object
  * @token: a token, or %NULL
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * If @token is %NULL, generate the initial SASL message to send to
  * the server. (This will be %NULL if the client doesn't initiate the
@@ -270,23 +271,27 @@ camel_sasl_init (CamelSasl *sasl)
 GByteArray *
 camel_sasl_challenge (CamelSasl *sasl,
                       GByteArray *token,
-                      CamelException *ex)
+                      GError **error)
 {
 	CamelSaslClass *class;
+	GByteArray *response;
 
 	g_return_val_if_fail (CAMEL_IS_SASL (sasl), NULL);
 
 	class = CAMEL_SASL_GET_CLASS (sasl);
 	g_return_val_if_fail (class->challenge != NULL, NULL);
 
-	return class->challenge (sasl, token, ex);
+	response = class->challenge (sasl, token, error);
+	CAMEL_CHECK_GERROR (sasl, challenge, response != NULL, error);
+
+	return response;
 }
 
 /**
  * camel_sasl_challenge_base64:
  * @sasl: a #CamelSasl object
  * @token: a base64-encoded token
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * As with #camel_sasl_challenge, but the challenge @token and the
  * response are both base64-encoded.
@@ -296,7 +301,7 @@ camel_sasl_challenge (CamelSasl *sasl,
 gchar *
 camel_sasl_challenge_base64 (CamelSasl *sasl,
                              const gchar *token,
-                             CamelException *ex)
+                             GError **error)
 {
 	GByteArray *token_binary, *ret_binary;
 	gchar *ret;
@@ -314,7 +319,7 @@ camel_sasl_challenge_base64 (CamelSasl *sasl,
 	} else
 		token_binary = NULL;
 
-	ret_binary = camel_sasl_challenge (sasl, token_binary, ex);
+	ret_binary = camel_sasl_challenge (sasl, token_binary, error);
 	if (token_binary)
 		g_byte_array_free (token_binary, TRUE);
 	if (!ret_binary)
diff --git a/camel/camel-sasl.h b/camel/camel-sasl.h
index a978940..3bf3dc8 100644
--- a/camel/camel-sasl.h
+++ b/camel/camel-sasl.h
@@ -28,7 +28,6 @@
 #define CAMEL_SASL_H
 
 #include <camel/camel-object.h>
-#include <camel/camel-exception.h>
 #include <camel/camel-service.h>
 
 /* Standard GObject macros */
@@ -66,16 +65,16 @@ struct _CamelSaslClass {
 
 	GByteArray *	(*challenge)		(CamelSasl *sasl,
 						 GByteArray *token,
-						 CamelException *ex);
+						 GError **error);
 };
 
 GType		camel_sasl_get_type		(void);
 GByteArray *	camel_sasl_challenge		(CamelSasl *sasl,
 						 GByteArray *token,
-						 CamelException *ex);
+						 GError **error);
 gchar *		camel_sasl_challenge_base64	(CamelSasl *sasl,
 						 const gchar *token,
-						 CamelException *ex);
+						 GError **error);
 CamelSasl *	camel_sasl_new			(const gchar *service_name,
 						 const gchar *mechanism,
 						 CamelService *service);
diff --git a/camel/camel-search-private.c b/camel/camel-search-private.c
index ec1ec3e..2623f21 100644
--- a/camel/camel-search-private.c
+++ b/camel/camel-search-private.c
@@ -35,7 +35,6 @@
 
 #include <glib/gi18n-lib.h>
 
-#include "camel-exception.h"
 #include "camel-mime-message.h"
 #include "camel-multipart.h"
 #include "camel-search-private.h"
@@ -56,7 +55,7 @@ camel_search_build_match_regex (regex_t *pattern,
                                 camel_search_flags_t type,
                                 gint argc,
                                 struct _ESExpResult **argv,
-                                CamelException *ex)
+                                GError **error)
 {
 	GString *match = g_string_new("");
 	gint c, i, count=0, err;
@@ -108,8 +107,8 @@ camel_search_build_match_regex (regex_t *pattern,
 		gchar *buffer = g_malloc0 (len + 1);
 
 		regerror (err, pattern, buffer, len);
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Regular expression compilation failed: %s: %s"),
 			match->str, buffer);
 
@@ -480,8 +479,8 @@ camel_search_message_body_contains (CamelDataWrapper *object, regex_t *pattern)
 
 		byte_array = g_byte_array_new ();
 		stream = camel_stream_mem_new_with_byte_array (byte_array);
-		camel_data_wrapper_write_to_stream (containee, stream);
-		camel_stream_write (stream, "", 1);
+		camel_data_wrapper_write_to_stream (containee, stream, NULL);
+		camel_stream_write (stream, "", 1, NULL);
 		truth = regexec (pattern, (gchar *) byte_array->data, 0, NULL, 0) == 0;
 		g_object_unref (stream);
 	}
diff --git a/camel/camel-search-private.h b/camel/camel-search-private.h
index 17e9a6c..ae52f45 100644
--- a/camel/camel-search-private.h
+++ b/camel/camel-search-private.h
@@ -57,7 +57,7 @@ typedef enum {
 } camel_search_t;
 
 /* builds a regex that represents a string search */
-gint camel_search_build_match_regex(regex_t *pattern, camel_search_flags_t type, gint argc, struct _ESExpResult **argv, CamelException *ex);
+gint camel_search_build_match_regex(regex_t *pattern, camel_search_flags_t type, gint argc, struct _ESExpResult **argv, GError **error);
 gboolean camel_search_message_body_contains(CamelDataWrapper *object, regex_t *pattern);
 
 gboolean camel_search_header_match(const gchar *value, const gchar *match, camel_search_match_t how, camel_search_t type, const gchar *default_charset);
diff --git a/camel/camel-seekable-stream.c b/camel/camel-seekable-stream.c
index a76d5b4..3e56fee 100644
--- a/camel/camel-seekable-stream.c
+++ b/camel/camel-seekable-stream.c
@@ -25,12 +25,14 @@
 #include <config.h>
 #endif
 
+#include "camel-debug.h"
 #include "camel-seekable-stream.h"
 
 G_DEFINE_TYPE (CamelSeekableStream, camel_seekable_stream, CAMEL_TYPE_STREAM)
 
 static gint
-seekable_stream_reset (CamelStream *stream)
+seekable_stream_reset (CamelStream *stream,
+                       GError **error)
 {
 	CamelSeekableStream *seekable_stream;
 
@@ -38,7 +40,7 @@ seekable_stream_reset (CamelStream *stream)
 
 	return camel_seekable_stream_seek (
 		seekable_stream, seekable_stream->bound_start,
-		CAMEL_STREAM_SET);
+		CAMEL_STREAM_SET, error);
 }
 
 static off_t
@@ -50,7 +52,8 @@ seekable_stream_tell (CamelSeekableStream *stream)
 static gint
 seekable_stream_set_bounds (CamelSeekableStream *stream,
                             off_t start,
-                            off_t end)
+                            off_t end,
+                            GError **error)
 {
 	/* store the bounds */
 	stream->bound_start = start;
@@ -58,7 +61,7 @@ seekable_stream_set_bounds (CamelSeekableStream *stream,
 
 	if (start > stream->position)
 		return camel_seekable_stream_seek (
-			stream, start, CAMEL_STREAM_SET);
+			stream, start, CAMEL_STREAM_SET, error);
 
 	return 0;
 }
@@ -87,6 +90,7 @@ camel_seekable_stream_init (CamelSeekableStream *stream)
  * @stream: a #CamelStream object
  * @offset: offset value
  * @policy: what to do with the offset
+ * @error: return location for a #GError, or %NULL
  *
  * Seek to the specified position in @stream.
  *
@@ -107,16 +111,21 @@ camel_seekable_stream_init (CamelSeekableStream *stream)
 off_t
 camel_seekable_stream_seek (CamelSeekableStream *stream,
                             off_t offset,
-                            CamelStreamSeekPolicy policy)
+                            CamelStreamSeekPolicy policy,
+                            GError **error)
 {
 	CamelSeekableStreamClass *class;
+	off_t new_offset;
 
 	g_return_val_if_fail (CAMEL_IS_SEEKABLE_STREAM (stream), -1);
 
 	class = CAMEL_SEEKABLE_STREAM_GET_CLASS (stream);
 	g_return_val_if_fail (class->seek != NULL, -1);
 
-	return class->seek (stream, offset, policy);
+	new_offset = class->seek (stream, offset, policy, error);
+	CAMEL_CHECK_GERROR (stream, seek, new_offset >= 0, error);
+
+	return new_offset;
 }
 
 /**
@@ -145,6 +154,7 @@ camel_seekable_stream_tell (CamelSeekableStream *stream)
  * @stream: a #CamelSeekableStream object
  * @start: the first valid position
  * @end: the first invalid position, or #CAMEL_STREAM_UNBOUND
+ * @error: return location for a #GError, or %NULL
  *
  * Set the range of valid data this stream is allowed to cover.  If
  * there is to be no @end value, then @end should be set to
@@ -155,9 +165,11 @@ camel_seekable_stream_tell (CamelSeekableStream *stream)
 gint
 camel_seekable_stream_set_bounds (CamelSeekableStream *stream,
                                   off_t start,
-                                  off_t end)
+                                  off_t end,
+                                  GError **error)
 {
 	CamelSeekableStreamClass *class;
+	gint retval;
 
 	g_return_val_if_fail (CAMEL_IS_SEEKABLE_STREAM (stream), -1);
 	g_return_val_if_fail (end == CAMEL_STREAM_UNBOUND || end >= start, -1);
@@ -165,5 +177,8 @@ camel_seekable_stream_set_bounds (CamelSeekableStream *stream,
 	class = CAMEL_SEEKABLE_STREAM_GET_CLASS (stream);
 	g_return_val_if_fail (class->set_bounds != NULL, -1);
 
-	return class->set_bounds (stream, start, end);
+	retval = class->set_bounds (stream, start, end, error);
+	CAMEL_CHECK_GERROR (stream, set_bounds, retval == 0, error);
+
+	return retval;
 }
diff --git a/camel/camel-seekable-stream.h b/camel/camel-seekable-stream.h
index 928f50f..1cf2801 100644
--- a/camel/camel-seekable-stream.h
+++ b/camel/camel-seekable-stream.h
@@ -78,21 +78,25 @@ struct _CamelSeekableStreamClass {
 
 	off_t		(*seek)			(CamelSeekableStream *stream,
 						 off_t offset,
-						 CamelStreamSeekPolicy policy);
+						 CamelStreamSeekPolicy policy,
+						 GError **error);
 	off_t		(*tell)			(CamelSeekableStream *stream);
 	gint		(*set_bounds)		(CamelSeekableStream *stream,
 						 off_t start,
-						 off_t end);
+						 off_t end,
+						 GError **error);
 };
 
 GType		camel_seekable_stream_get_type	(void);
 off_t		camel_seekable_stream_seek	(CamelSeekableStream *stream,
 						 off_t offset,
-						 CamelStreamSeekPolicy policy);
+						 CamelStreamSeekPolicy policy,
+						 GError **error);
 off_t		camel_seekable_stream_tell	(CamelSeekableStream *stream);
 gint		camel_seekable_stream_set_bounds(CamelSeekableStream *stream,
 						 off_t start,
-						 off_t end);
+						 off_t end,
+						 GError **error);
 
 G_END_DECLS
 
diff --git a/camel/camel-seekable-substream.c b/camel/camel-seekable-substream.c
index c2b40bf..9a229f4 100644
--- a/camel/camel-seekable-substream.c
+++ b/camel/camel-seekable-substream.c
@@ -40,7 +40,7 @@ seekable_substream_parent_reset (CamelSeekableSubstream *seekable_substream,
 
 	return camel_seekable_stream_seek (
 		parent, (off_t) seekable_stream->position,
-		CAMEL_STREAM_SET) == seekable_stream->position;
+		CAMEL_STREAM_SET, NULL) == seekable_stream->position;
 }
 
 static void
@@ -62,7 +62,8 @@ seekable_substream_dispose (GObject *object)
 static gssize
 seekable_substream_read (CamelStream *stream,
                          gchar *buffer,
-                         gsize n)
+                         gsize n,
+                         GError **error)
 {
 	CamelSeekableStream *parent;
 	CamelSeekableStream *seekable_stream = CAMEL_SEEKABLE_STREAM (stream);
@@ -89,7 +90,7 @@ seekable_substream_read (CamelStream *stream,
 		return 0;
 	}
 
-	v = camel_stream_read (CAMEL_STREAM (parent), buffer, n);
+	v = camel_stream_read (CAMEL_STREAM (parent), buffer, n, error);
 
 	/* ignore <0 - it's an error, let the caller deal */
 	if (v > 0)
@@ -101,7 +102,8 @@ seekable_substream_read (CamelStream *stream,
 static gssize
 seekable_substream_write (CamelStream *stream,
                           const gchar *buffer,
-                          gsize n)
+                          gsize n,
+                          GError **error)
 {
 	CamelSeekableStream *parent;
 	CamelSeekableStream *seekable_stream = CAMEL_SEEKABLE_STREAM(stream);
@@ -128,7 +130,7 @@ seekable_substream_write (CamelStream *stream,
 		return 0;
 	}
 
-	v = camel_stream_write (CAMEL_STREAM (parent), buffer, n);
+	v = camel_stream_write (CAMEL_STREAM (parent), buffer, n, error);
 
 	/* ignore <0 - it's an error, let the caller deal */
 	if (v > 0)
@@ -139,15 +141,17 @@ seekable_substream_write (CamelStream *stream,
 }
 
 static gint
-seekable_substream_flush (CamelStream *stream)
+seekable_substream_flush (CamelStream *stream,
+                          GError **error)
 {
 	CamelSeekableSubstream *sus = (CamelSeekableSubstream *)stream;
 
-	return camel_stream_flush (CAMEL_STREAM (sus->parent_stream));
+	return camel_stream_flush (CAMEL_STREAM (sus->parent_stream), error);
 }
 
 static gint
-seekable_substream_close (CamelStream *stream)
+seekable_substream_close (CamelStream *stream,
+                          GError **error)
 {
 	/* we dont really want to close the substream ... */
 	return 0;
@@ -180,7 +184,8 @@ seekable_substream_eos (CamelStream *stream)
 static off_t
 seekable_substream_seek (CamelSeekableStream *seekable_stream,
                          off_t offset,
-                         CamelStreamSeekPolicy policy)
+                         CamelStreamSeekPolicy policy,
+                         GError **error)
 {
 	CamelStream *stream;
 	CamelSeekableSubstream *seekable_substream;
@@ -204,7 +209,7 @@ seekable_substream_seek (CamelSeekableStream *seekable_stream,
 		if (seekable_stream->bound_end == CAMEL_STREAM_UNBOUND) {
 			real_offset = camel_seekable_stream_seek (
 				seekable_substream->parent_stream,
-				offset, CAMEL_STREAM_END);
+				offset, CAMEL_STREAM_END, error);
 			if (real_offset != -1) {
 				if (real_offset<seekable_stream->bound_start)
 					real_offset = seekable_stream->bound_start;
@@ -287,7 +292,7 @@ camel_seekable_substream_new(CamelSeekableStream *parent_stream, off_t start, of
 	 * here, because if we fail to seek now, it will try again later. */
 	camel_seekable_stream_set_bounds (
 		CAMEL_SEEKABLE_STREAM (seekable_substream),
-		start, end);
+		start, end, NULL);
 
 	return CAMEL_STREAM (seekable_substream);
 }
diff --git a/camel/camel-service.c b/camel/camel-service.c
index b92502b..734f384 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -34,7 +34,7 @@
 
 #include <glib/gi18n-lib.h>
 
-#include "camel-exception.h"
+#include "camel-debug.h"
 #include "camel-operation.h"
 #include "camel-service.h"
 #include "camel-session.h"
@@ -58,17 +58,8 @@ service_finalize (GObject *object)
 {
 	CamelService *service = CAMEL_SERVICE (object);
 
-	if (service->status == CAMEL_SERVICE_CONNECTED) {
-		CamelException ex;
-
-		camel_exception_init (&ex);
-		CAMEL_SERVICE_GET_CLASS (service)->disconnect (service, TRUE, &ex);
-		if (camel_exception_is_set (&ex)) {
-			w(g_warning ("camel_service_finalize: silent disconnect failure: %s",
-				     camel_exception_get_description (&ex)));
-		}
-		camel_exception_clear (&ex);
-	}
+	if (service->status == CAMEL_SERVICE_CONNECTED)
+		CAMEL_SERVICE_GET_CLASS (service)->disconnect (service, TRUE, NULL);
 
 	if (service->url)
 		camel_url_free (service->url);
@@ -88,7 +79,7 @@ service_construct (CamelService *service,
                    CamelSession *session,
                    CamelProvider *provider,
                    CamelURL *url,
-                   CamelException *ex)
+                   GError **error)
 {
 	gchar *err, *url_string;
 
@@ -116,8 +107,9 @@ service_construct (CamelService *service,
 
 fail:
 	url_string = camel_url_to_string(url, CAMEL_URL_HIDE_PASSWORD);
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
+	g_set_error (
+		error, CAMEL_SERVICE_ERROR,
+		CAMEL_SERVICE_ERROR_URL_INVALID,
 		err, url_string);
 	g_free(url_string);
 
@@ -126,7 +118,7 @@ fail:
 
 static gboolean
 service_connect (CamelService *service,
-                 CamelException *ex)
+                 GError **error)
 {
 	/* Things like the CamelMboxStore can validly
 	 * not define a connect function. */
@@ -136,7 +128,7 @@ service_connect (CamelService *service,
 static gboolean
 service_disconnect (CamelService *service,
                     gboolean clean,
-                    CamelException *ex)
+                    GError **error)
 {
 	/* We let people get away with not having a disconnect
 	 * function -- CamelMboxStore, for example. */
@@ -151,7 +143,7 @@ service_cancel_connect (CamelService *service)
 
 static GList *
 service_query_auth_types (CamelService *service,
-                          CamelException *ex)
+                          GError **error)
 {
 	return NULL;
 }
@@ -238,13 +230,26 @@ camel_service_init (CamelService *service)
 	g_static_mutex_init (&service->priv->connect_op_lock);
 }
 
+GQuark
+camel_service_error_quark (void)
+{
+	static GQuark quark = 0;
+
+	if (G_UNLIKELY (quark == 0)) {
+		const gchar *string = "camel-service-error-quark";
+		quark = g_quark_from_static_string (string);
+	}
+
+	return quark;
+}
+
 /**
  * camel_service_construct:
  * @service: a #CamelService object
  * @session: the #CamelSession for @service
  * @provider: the #CamelProvider associated with @service
  * @url: the default URL for the service (may be %NULL)
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Constructs a #CamelService initialized with the given parameters.
  *
@@ -255,9 +260,10 @@ camel_service_construct (CamelService *service,
                          CamelSession *session,
                          CamelProvider *provider,
                          CamelURL *url,
-                         CamelException *ex)
+                         GError **error)
 {
 	CamelServiceClass *class;
+	gboolean success;
 
 	g_return_val_if_fail (CAMEL_IS_SERVICE (service), FALSE);
 	g_return_val_if_fail (CAMEL_IS_SESSION (session), FALSE);
@@ -265,13 +271,16 @@ camel_service_construct (CamelService *service,
 	class = CAMEL_SERVICE_GET_CLASS (service);
 	g_return_val_if_fail (class->construct != NULL, FALSE);
 
-	return class->construct (service, session, provider, url, ex);
+	success = class->construct (service, session, provider, url, error);
+	CAMEL_CHECK_GERROR (service, construct, success, error);
+
+	return success;
 }
 
 /**
  * camel_service_connect:
  * @service: a #CamelService object
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Connect to the service using the parameters it was initialized
  * with.
@@ -280,7 +289,7 @@ camel_service_construct (CamelService *service,
  **/
 gboolean
 camel_service_connect (CamelService *service,
-                       CamelException *ex)
+                       GError **error)
 {
 	CamelServiceClass *class;
 	gboolean ret = FALSE;
@@ -314,7 +323,8 @@ camel_service_connect (CamelService *service,
 	camel_service_unlock (service, CAMEL_SERVICE_CONNECT_OP_LOCK);
 
 	service->status = CAMEL_SERVICE_CONNECTING;
-	ret = class->connect (service, ex);
+	ret = class->connect (service, error);
+	CAMEL_CHECK_GERROR (service, connect, ret, error);
 	service->status = ret ? CAMEL_SERVICE_CONNECTED : CAMEL_SERVICE_DISCONNECTED;
 
 	camel_service_lock (service, CAMEL_SERVICE_CONNECT_OP_LOCK);
@@ -336,7 +346,7 @@ camel_service_connect (CamelService *service,
  * camel_service_disconnect:
  * @service: a #CamelService object
  * @clean: whether or not to try to disconnect cleanly
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Disconnect from the service. If @clean is %FALSE, it should not
  * try to do any synchronizing or other cleanup of the connection.
@@ -346,7 +356,7 @@ camel_service_connect (CamelService *service,
 gboolean
 camel_service_disconnect (CamelService *service,
                           gboolean clean,
-                          CamelException *ex)
+                          GError **error)
 {
 	CamelServiceClass *class;
 	gboolean res = TRUE;
@@ -371,7 +381,8 @@ camel_service_disconnect (CamelService *service,
 		camel_service_unlock (service, CAMEL_SERVICE_CONNECT_OP_LOCK);
 
 		service->status = CAMEL_SERVICE_DISCONNECTING;
-		res = class->disconnect (service, clean, ex);
+		res = class->disconnect (service, clean, error);
+		CAMEL_CHECK_GERROR (service, disconnect, res, error);
 		service->status = CAMEL_SERVICE_DISCONNECTED;
 
 		camel_service_lock (service, CAMEL_SERVICE_CONNECT_OP_LOCK);
@@ -520,7 +531,7 @@ camel_service_get_provider (CamelService *service)
 /**
  * camel_service_query_auth_types:
  * @service: a #CamelService object
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * This is used by the mail source wizard to get the list of
  * authentication types supported by the protocol, and information
@@ -531,7 +542,7 @@ camel_service_get_provider (CamelService *service)
  **/
 GList *
 camel_service_query_auth_types (CamelService *service,
-                                CamelException *ex)
+                                GError **error)
 {
 	CamelServiceClass *class;
 	GList *ret;
@@ -544,7 +555,7 @@ camel_service_query_auth_types (CamelService *service,
 	/* Note that we get the connect lock here, which means the
 	 * callee must not call the connect functions itself. */
 	camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-	ret = class->query_auth_types (service, ex);
+	ret = class->query_auth_types (service, error);
 	camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
 
 	return ret;
diff --git a/camel/camel-service.h b/camel/camel-service.h
index 7b4e948..cebd326 100644
--- a/camel/camel-service.h
+++ b/camel/camel-service.h
@@ -53,6 +53,14 @@
 	(G_TYPE_INSTANCE_GET_CLASS \
 	((obj), CAMEL_TYPE_SERVICE, CamelServiceClass))
 
+/**
+ * CAMEL_SERVICE_ERROR:
+ *
+ * Since: 3.0
+ **/
+#define CAMEL_SERVICE_ERROR \
+	(camel_service_error_quark ())
+
 G_BEGIN_DECLS
 
 struct _CamelSession;
@@ -61,6 +69,19 @@ typedef struct _CamelService CamelService;
 typedef struct _CamelServiceClass CamelServiceClass;
 typedef struct _CamelServicePrivate CamelServicePrivate;
 
+/**
+ * CamelServiceError:
+ *
+ * Since: 3.0
+ **/
+typedef enum {
+	CAMEL_SERVICE_ERROR_INVALID,
+	CAMEL_SERVICE_ERROR_URL_INVALID,
+	CAMEL_SERVICE_ERROR_UNAVAILABLE,
+	CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
+	CAMEL_SERVICE_ERROR_NOT_CONNECTED
+} CamelServiceError;
+
 typedef enum {
 	CAMEL_SERVICE_DISCONNECTED,
 	CAMEL_SERVICE_CONNECTING,
@@ -96,15 +117,15 @@ struct _CamelServiceClass {
 						 struct _CamelSession *session,
 						 CamelProvider *provider,
 						 CamelURL *url,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*connect)		(CamelService *service,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*disconnect)		(CamelService *service,
 						 gboolean clean,
-						 CamelException *ex);
+						 GError **error);
 	void		(*cancel_connect)	(CamelService *service);
 	GList *		(*query_auth_types)	(CamelService *service,
-						 CamelException *ex);
+						 GError **error);
 	gchar *		(*get_name)		(CamelService *service,
 						 gboolean brief);
 	gchar *		(*get_path)		(CamelService *service);
@@ -120,16 +141,17 @@ typedef struct {
 } CamelServiceAuthType;
 
 GType		camel_service_get_type		(void);
+GQuark		camel_service_error_quark	(void) G_GNUC_CONST;
 gboolean	camel_service_construct		(CamelService *service,
 						 struct _CamelSession *session,
 						 CamelProvider *provider,
 						 CamelURL *url,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_service_connect		(CamelService *service,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_service_disconnect	(CamelService *service,
 						 gboolean clean,
-						 CamelException *ex);
+						 GError **error);
 void		camel_service_cancel_connect	(CamelService *service);
 gchar *		camel_service_get_url		(CamelService *service);
 gchar *		camel_service_get_name		(CamelService *service,
@@ -139,7 +161,7 @@ struct _CamelSession *
 		camel_service_get_session	(CamelService *service);
 CamelProvider *	camel_service_get_provider	(CamelService *service);
 GList *		camel_service_query_auth_types	(CamelService *service,
-						 CamelException *ex);
+						 GError **error);
 void		camel_service_lock		(CamelService *service,
 						 CamelServiceLock lock);
 void		camel_service_unlock		(CamelService *service,
diff --git a/camel/camel-session.c b/camel/camel-session.c
index 51b6f1e..e51c72d 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -37,7 +37,7 @@
 #include <glib/gi18n-lib.h>
 #include <glib/gstdio.h>
 
-#include "camel-exception.h"
+#include "camel-debug.h"
 #include "camel-file-utils.h"
 #include "camel-session.h"
 #include "camel-store.h"
@@ -187,22 +187,23 @@ static CamelService *
 session_get_service (CamelSession *session,
                      const gchar *url_string,
                      CamelProviderType type,
-                     CamelException *ex)
+                     GError **error)
 {
 	CamelURL *url;
 	CamelProvider *provider;
 	CamelService *service;
 
-	url = camel_url_new (url_string, ex);
+	url = camel_url_new (url_string, error);
 	if (!url)
 		return NULL;
 
 	/* We need to look up the provider so we can then lookup
 	   the service in the provider's cache */
-	provider = camel_provider_get(url->protocol, ex);
+	provider = camel_provider_get(url->protocol, error);
 	if (provider && !provider->object_types[type]) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_URL_INVALID,
 			_("No provider available for protocol '%s'"),
 			url->protocol);
 		provider = NULL;
@@ -223,7 +224,7 @@ session_get_service (CamelSession *session,
 	service = camel_object_bag_reserve(provider->service_cache[type], url);
 	if (service == NULL) {
 		service = g_object_new (provider->object_types[type], NULL);
-		if (!camel_service_construct (service, session, provider, url, ex)) {
+		if (!camel_service_construct (service, session, provider, url, error)) {
 			g_object_unref (service);
 			service = NULL;
 			camel_object_bag_abort(provider->service_cache[type], url);
@@ -240,7 +241,7 @@ session_get_service (CamelSession *session,
 static gchar *
 session_get_storage_path (CamelSession *session,
                           CamelService *service,
-                          CamelException *ex)
+                          GError **error)
 {
 	gchar *path, *p;
 
@@ -256,8 +257,9 @@ session_get_storage_path (CamelSession *session,
 		return path;
 
 	if (g_mkdir_with_parents (path, S_IRWXU) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not create directory %s:\n%s"),
 			path, g_strerror (errno));
 		g_free (path);
@@ -278,7 +280,6 @@ session_thread_msg_new (CamelSession *session,
 	m->ops = ops;
 	m->session = g_object_ref (session);
 	m->op = camel_operation_new(cs_thread_status, m);
-	camel_exception_init(&m->ex);
 	camel_session_lock (session, CAMEL_SESSION_THREAD_LOCK);
 	m->id = session->priv->thread_id++;
 	g_hash_table_insert(session->priv->thread_active, GINT_TO_POINTER(m->id), m);
@@ -306,7 +307,7 @@ session_thread_msg_free (CamelSession *session,
 		msg->ops->free(session, msg);
 	if (msg->op)
 		camel_operation_unref(msg->op);
-	camel_exception_clear(&msg->ex);
+	g_clear_error (&msg->error);
 	g_object_unref (msg->session);
 	g_free(msg);
 }
@@ -463,7 +464,7 @@ camel_session_construct (CamelSession *session, const gchar *storage_path)
  * @type: the provider type (#CAMEL_PROVIDER_STORE or
  * #CAMEL_PROVIDER_TRANSPORT) to get, since some URLs may be able
  * to specify either type.
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * This resolves a #CamelURL into a #CamelService, including loading the
  * provider library for that service if it has not already been loaded.
@@ -479,7 +480,7 @@ CamelService *
 camel_session_get_service (CamelSession *session,
                            const gchar *url_string,
                            CamelProviderType type,
-                           CamelException *ex)
+                           GError **error)
 {
 	CamelSessionClass *class;
 	CamelService *service;
@@ -492,7 +493,8 @@ camel_session_get_service (CamelSession *session,
 
 	camel_session_lock (session, CAMEL_SESSION_SESSION_LOCK);
 
-	service = class->get_service (session, url_string, type, ex);
+	service = class->get_service (session, url_string, type, error);
+	CAMEL_CHECK_GERROR (session, get_service, service != NULL, error);
 
 	camel_session_unlock (session, CAMEL_SESSION_SESSION_LOCK);
 
@@ -504,7 +506,7 @@ camel_session_get_service (CamelSession *session,
  * @session: a #CamelSession object
  * @url_string: a #CamelURL describing the service to get
  * @type: the provider type
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * This works like #camel_session_get_service, but also ensures that
  * the returned service will have been successfully connected (via
@@ -516,16 +518,16 @@ CamelService *
 camel_session_get_service_connected (CamelSession *session,
                                      const gchar *url_string,
                                      CamelProviderType type,
-                                     CamelException *ex)
+                                     GError **error)
 {
 	CamelService *svc;
 
-	svc = camel_session_get_service (session, url_string, type, ex);
+	svc = camel_session_get_service (session, url_string, type, error);
 	if (svc == NULL)
 		return NULL;
 
 	if (svc->status != CAMEL_SERVICE_CONNECTED) {
-		if (camel_service_connect (svc, ex) == FALSE) {
+		if (!camel_service_connect (svc, error)) {
 			g_object_unref (svc);
 			return NULL;
 		}
@@ -538,7 +540,7 @@ camel_session_get_service_connected (CamelSession *session,
  * camel_session_get_storage_path:
  * @session: a #CamelSession object
  * @service: a #CamelService
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * This returns the path to a directory which the service can use for
  * its own purposes. Data stored there will remain between Evolution
@@ -552,9 +554,10 @@ camel_session_get_service_connected (CamelSession *session,
 gchar *
 camel_session_get_storage_path (CamelSession *session,
                                 CamelService *service,
-                                CamelException *ex)
+                                GError **error)
 {
 	CamelSessionClass *class;
+	gchar *storage_path;
 
 	g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
 	g_return_val_if_fail (CAMEL_IS_SERVICE (service), NULL);
@@ -562,7 +565,10 @@ camel_session_get_storage_path (CamelSession *session,
 	class = CAMEL_SESSION_GET_CLASS (session);
 	g_return_val_if_fail (class->get_storage_path != NULL, NULL);
 
-	return class->get_storage_path (session, service, ex);
+	storage_path = class->get_storage_path (session, service, error);
+	CAMEL_CHECK_GERROR (session, get_storage_path, storage_path != NULL, error);
+
+	return storage_path;
 }
 
 /**
@@ -572,10 +578,10 @@ camel_session_get_storage_path (CamelSession *session,
  * @domain: domain of password request.  May be null to use the default.
  * @prompt: prompt to provide to user
  * @item: an identifier, unique within this service, for the information
- * @flags: #CAMEL_SESSION_PASSWORD_REPROMPT, the prompt should force a reprompt
- * #CAMEL_SESSION_PASSWORD_SECRET, whether the password is secret
- * #CAMEL_SESSION_PASSWORD_STATIC, the password is remembered externally
- * @ex: a #CamelException
+ * @flags: %CAMEL_SESSION_PASSWORD_REPROMPT, the prompt should force a reprompt
+ * %CAMEL_SESSION_PASSWORD_SECRET, whether the password is secret
+ * %CAMEL_SESSION_PASSWORD_STATIC, the password is remembered externally
+ * @error: return location for a #GError, or %NULL
  *
  * This function is used by a #CamelService to ask the application and
  * the user for a password or other authentication data.
@@ -584,15 +590,15 @@ camel_session_get_storage_path (CamelSession *session,
  * caller is concerned with.
  *
  * @prompt is a question to ask the user (if the application doesn't
- * already have the answer cached). If #CAMEL_SESSION_PASSWORD_SECRET
+ * already have the answer cached). If %CAMEL_SESSION_PASSWORD_SECRET
  * is set, the user's input will not be echoed back.
  *
- * If #CAMEL_SESSION_PASSWORD_STATIC is set, it means the password returned
+ * If %CAMEL_SESSION_PASSWORD_STATIC is set, it means the password returned
  * will be stored statically by the caller automatically, for the current
  * session.
  *
- * The authenticator should set @ex to #CAMEL_EXCEPTION_USER_CANCEL if
- * the user did not provide the information. The caller must #g_free
+ * The authenticator should set @error to %G_IO_ERROR_CANCELLED if
+ * the user did not provide the information. The caller must g_free()
  * the information returned when it is done with it.
  *
  * Returns: the authentication information or %NULL
@@ -604,9 +610,10 @@ camel_session_get_password (CamelSession *session,
                             const gchar *prompt,
                             const gchar *item,
                             guint32 flags,
-                            CamelException *ex)
+                            GError **error)
 {
 	CamelSessionClass *class;
+	gchar *password;
 
 	g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
 	g_return_val_if_fail (prompt != NULL, NULL);
@@ -615,8 +622,11 @@ camel_session_get_password (CamelSession *session,
 	class = CAMEL_SESSION_GET_CLASS (session);
 	g_return_val_if_fail (class->get_password != NULL, NULL);
 
-	return class->get_password (
-		session, service, domain, prompt, item, flags, ex);
+	password = class->get_password (
+		session, service, domain, prompt, item, flags, error);
+	CAMEL_CHECK_GERROR (session, get_password, password != NULL, error);
+
+	return password;
 }
 
 /**
@@ -624,7 +634,7 @@ camel_session_get_password (CamelSession *session,
  * @session: a #CamelSession object
  * @service: the #CamelService rejecting the password
  * @item: an identifier, unique within this service, for the information
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * This function is used by a #CamelService to tell the application
  * that the authentication information it provided via
@@ -642,9 +652,10 @@ camel_session_forget_password (CamelSession *session,
                                CamelService *service,
                                const gchar *domain,
                                const gchar *item,
-                               CamelException *ex)
+                               GError **error)
 {
 	CamelSessionClass *class;
+	gboolean success;
 
 	g_return_val_if_fail (CAMEL_IS_SESSION (session), FALSE);
 	g_return_val_if_fail (item != NULL, FALSE);
@@ -652,7 +663,10 @@ camel_session_forget_password (CamelSession *session,
 	class = CAMEL_SESSION_GET_CLASS (session);
 	g_return_val_if_fail (class->forget_password, FALSE);
 
-	return class->forget_password (session, service, domain, item, ex);
+	success = class->forget_password (session, service, domain, item, error);
+	CAMEL_CHECK_GERROR (session, forget_password, success, error);
+
+	return success;
 }
 
 /**
@@ -788,16 +802,17 @@ camel_session_set_online (CamelSession *session,
  * camel_session_get_filter_driver:
  * @session: a #CamelSession object
  * @type: the type of filter (eg, "incoming")
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Returns: a filter driver, loaded with applicable rules
  **/
 CamelFilterDriver *
 camel_session_get_filter_driver (CamelSession *session,
                                  const gchar *type,
-                                 CamelException *ex)
+                                 GError **error)
 {
 	CamelSessionClass *class;
+	CamelFilterDriver *driver;
 
 	g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
 	g_return_val_if_fail (type != NULL, NULL);
@@ -805,7 +820,10 @@ camel_session_get_filter_driver (CamelSession *session,
 	class = CAMEL_SESSION_GET_CLASS (session);
 	g_return_val_if_fail (class->get_filter_driver != NULL, NULL);
 
-	return class->get_filter_driver (session, type, ex);
+	driver = class->get_filter_driver (session, type, error);
+	CAMEL_CHECK_GERROR (session, get_filter_driver, driver != NULL, error);
+
+	return driver;
 }
 
 /**
@@ -1031,24 +1049,28 @@ camel_session_get_junk_headers (CamelSession *session)
  *
  * Since: 2.26
  **/
-void
+gboolean
 camel_session_forward_to (CamelSession *session,
                           CamelFolder *folder,
                           CamelMimeMessage *message,
                           const gchar *address,
-                          CamelException *ex)
+                          GError **error)
 {
 	CamelSessionClass *class;
+	gboolean success;
 
-	g_return_if_fail (CAMEL_IS_SESSION (session));
-	g_return_if_fail (CAMEL_IS_FOLDER (folder));
-	g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message));
-	g_return_if_fail (address != NULL);
+	g_return_val_if_fail (CAMEL_IS_SESSION (session), FALSE);
+	g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
+	g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), FALSE);
+	g_return_val_if_fail (address != NULL, FALSE);
 
 	class = CAMEL_SESSION_GET_CLASS (session);
-	g_return_if_fail (class->forward_to != NULL);
+	g_return_val_if_fail (class->forward_to != NULL, FALSE);
+
+	success = class->forward_to (session, folder, message, address, error);
+	CAMEL_CHECK_GERROR (session, forward_to, success, error);
 
-	class->forward_to (session, folder, message, address, ex);
+	return success;
 }
 
 /**
diff --git a/camel/camel-session.h b/camel/camel-session.h
index c31502c..86dc8f7 100644
--- a/camel/camel-session.h
+++ b/camel/camel-session.h
@@ -102,22 +102,22 @@ struct _CamelSessionClass {
 	CamelService *	(*get_service)		(CamelSession *session,
 						 const gchar *url_string,
 						 CamelProviderType type,
-						 CamelException *ex);
+						 GError **error);
 	gchar *		(*get_storage_path)	(CamelSession *session,
 						 CamelService *service,
-						 CamelException *ex);
+						 GError **error);
 	gchar *		(*get_password)		(CamelSession *session,
 						 CamelService *service,
 						 const gchar *domain,
 						 const gchar *prompt,
 						 const gchar *item,
 						 guint32 flags,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*forget_password)	(CamelSession *session,
 						 CamelService *service,
 						 const gchar *domain,
 						 const gchar *item,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*alert_user)		(CamelSession *session,
 						 CamelSessionAlertType type,
 						 const gchar *prompt,
@@ -125,7 +125,7 @@ struct _CamelSessionClass {
 	CamelFilterDriver *
 			(*get_filter_driver)	(CamelSession *session,
 						 const gchar *type,
-						 CamelException *ex);
+						 GError **error);
 
 	/* mechanism for creating and maintaining multiple threads of control */
 	gpointer	(*thread_msg_new)	(CamelSession *session,
@@ -145,11 +145,11 @@ struct _CamelSessionClass {
 
 	gboolean	(*lookup_addressbook)	(CamelSession *session,
 						 const gchar *name);
-	void		(*forward_to)		(CamelSession *session,
+	gboolean	(*forward_to)		(CamelSession *session,
 						 CamelFolder *folder,
 						 CamelMimeMessage *message,
 						 const gchar *address,
-						 CamelException *ex);
+						 GError **error);
 };
 
 GType		camel_session_get_type		(void);
@@ -166,35 +166,35 @@ void            camel_session_get_socks_proxy   (CamelSession *session,
 CamelService *	camel_session_get_service	(CamelSession *session,
 						 const gchar *url_string,
 						 CamelProviderType type,
-						 CamelException *ex);
+						 GError **error);
 CamelService *	camel_session_get_service_connected
 						(CamelSession *session,
 						 const gchar *url_string,
 						 CamelProviderType type,
-						 CamelException *ex);
+						 GError **error);
 
-#define camel_session_get_store(session, url_string, ex) \
+#define camel_session_get_store(session, url_string, error) \
 	((CamelStore *) camel_session_get_service_connected \
-	(session, url_string, CAMEL_PROVIDER_STORE, ex))
-#define camel_session_get_transport(session, url_string, ex) \
+	(session, url_string, CAMEL_PROVIDER_STORE, error))
+#define camel_session_get_transport(session, url_string, error) \
 	((CamelTransport *) camel_session_get_service_connected \
-	(session, url_string, CAMEL_PROVIDER_TRANSPORT, ex))
+	(session, url_string, CAMEL_PROVIDER_TRANSPORT, error))
 
 gchar *		camel_session_get_storage_path	(CamelSession *session,
 						 CamelService *service,
-						 CamelException *ex);
+						 GError **error);
 gchar *		camel_session_get_password	(CamelSession *session,
 						 CamelService *service,
 						 const gchar *domain,
 						 const gchar *prompt,
 						 const gchar *item,
 						 guint32 flags,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_session_forget_password	(CamelSession *session,
 						 CamelService *service,
 						 const gchar *domain,
 						 const gchar *item,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_session_alert_user	(CamelSession *session,
 						 CamelSessionAlertType type,
 						 const gchar *prompt,
@@ -209,7 +209,7 @@ void		camel_session_set_online	(CamelSession *session,
 CamelFilterDriver *
 		camel_session_get_filter_driver	(CamelSession *session,
 						 const gchar *type,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_session_get_check_junk	(CamelSession *session);
 void		camel_session_set_check_junk	(CamelSession *session,
 						 gboolean check_junk);
@@ -224,7 +224,7 @@ struct _CamelSessionThreadMsg {
 
 	gint id;
 
-	CamelException ex;
+	GError *error;
 	CamelSessionThreadOps *ops;
 	CamelOperation *op;
 	CamelSession *session;
@@ -258,11 +258,11 @@ void		camel_session_set_junk_headers	(CamelSession *session,
 						 gint len);
 gboolean	camel_session_lookup_addressbook(CamelSession *session,
 						 const gchar *name);
-void		camel_session_forward_to	(CamelSession *session,
+gboolean	camel_session_forward_to	(CamelSession *session,
 						 CamelFolder *folder,
 						 CamelMimeMessage *message,
 						 const gchar *address,
-						 CamelException *ex);
+						 GError **error);
 void		camel_session_lock		(CamelSession *session,
 						 CamelSessionLock lock);
 void		camel_session_unlock		(CamelSession *session,
diff --git a/camel/camel-smime-context.c b/camel/camel-smime-context.c
index d5b2ef2..fdb35ff 100644
--- a/camel/camel-smime-context.c
+++ b/camel/camel-smime-context.c
@@ -48,7 +48,6 @@
 #include <glib/gi18n-lib.h>
 
 #include "camel-data-wrapper.h"
-#include "camel-exception.h"
 #include "camel-mime-filter-basic.h"
 #include "camel-mime-filter-canon.h"
 #include "camel-mime-part.h"
@@ -98,7 +97,7 @@ smime_cert_data_clone (gpointer cert_data)
 static void
 sm_write_stream (gpointer arg, const gchar *buf, gulong len)
 {
-	camel_stream_write ((CamelStream *)arg, buf, len);
+	camel_stream_write ((CamelStream *)arg, buf, len, NULL);
 }
 
 static PK11SymKey *
@@ -295,7 +294,7 @@ nss_error_to_string (glong errorcode)
 }
 
 static void
-set_nss_error (CamelException *ex,
+set_nss_error (GError **error,
                const gchar *def_error)
 {
 	glong err_code;
@@ -305,8 +304,10 @@ set_nss_error (CamelException *ex,
 	err_code = PORT_GetError ();
 
 	if (!err_code) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SYSTEM, def_error);
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
+			"%s", def_error);
 	} else {
 		const gchar *err_str;
 
@@ -314,8 +315,9 @@ set_nss_error (CamelException *ex,
 		if (!err_str)
 			err_str = "Uknown error.";
 
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 			"%s (%d) - %s", err_str, (gint) err_code, def_error);
 	}
 }
@@ -325,7 +327,7 @@ sm_signing_cmsmessage (CamelSMIMEContext *context,
                        const gchar *nick,
                        SECOidTag *hash,
                        gint detached,
-                       CamelException *ex)
+                       GError **error)
 {
 	CamelSMIMEContextPrivate *p = context->priv;
 	NSSCMSMessage *cmsg = NULL;
@@ -341,8 +343,8 @@ sm_signing_cmsmessage (CamelSMIMEContext *context,
 					     certUsageEmailSigner,
 					     PR_TRUE,
 					     NULL)) == NULL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot find certificate for '%s'"), nick);
 		return NULL;
 	}
@@ -371,50 +373,50 @@ sm_signing_cmsmessage (CamelSMIMEContext *context,
 
 	cmsg = NSS_CMSMessage_Create (NULL); /* create a message on its own pool */
 	if (cmsg == NULL) {
-		set_nss_error (ex, _("Cannot create CMS message"));
+		set_nss_error (error, _("Cannot create CMS message"));
 		goto fail;
 	}
 
 	if ((sigd = NSS_CMSSignedData_Create (cmsg)) == NULL) {
-		set_nss_error (ex, _("Cannot create CMS signed data"));
+		set_nss_error (error, _("Cannot create CMS signed data"));
 		goto fail;
 	}
 
 	cinfo = NSS_CMSMessage_GetContentInfo (cmsg);
 	if (NSS_CMSContentInfo_SetContent_SignedData (cmsg, cinfo, sigd) != SECSuccess) {
-		set_nss_error (ex, _("Cannot attach CMS signed data"));
+		set_nss_error (error, _("Cannot attach CMS signed data"));
 		goto fail;
 	}
 
 	/* if !detatched, the contentinfo will alloc a data item for us */
 	cinfo = NSS_CMSSignedData_GetContentInfo (sigd);
 	if (NSS_CMSContentInfo_SetContent_Data (cmsg, cinfo, NULL, detached) != SECSuccess) {
-		set_nss_error (ex, _("Cannot attach CMS data"));
+		set_nss_error (error, _("Cannot attach CMS data"));
 		goto fail;
 	}
 
 	signerinfo = NSS_CMSSignerInfo_Create (cmsg, cert, *hash);
 	if (signerinfo == NULL) {
-		set_nss_error (ex, _("Cannot create CMS Signer information"));
+		set_nss_error (error, _("Cannot create CMS Signer information"));
 		goto fail;
 	}
 
 	/* we want the cert chain included for this one */
 	if (NSS_CMSSignerInfo_IncludeCerts (signerinfo, NSSCMSCM_CertChain, certUsageEmailSigner) != SECSuccess) {
-		set_nss_error (ex, _("Cannot find certificate chain"));
+		set_nss_error (error, _("Cannot find certificate chain"));
 		goto fail;
 	}
 
 	/* SMIME RFC says signing time should always be added */
 	if (NSS_CMSSignerInfo_AddSigningTime (signerinfo, PR_Now ()) != SECSuccess) {
-		set_nss_error (ex, _("Cannot add CMS Signing time"));
+		set_nss_error (error, _("Cannot add CMS Signing time"));
 		goto fail;
 	}
 
 #if 0
 	/* this can but needn't be added.  not sure what general usage is */
 	if (NSS_CMSSignerInfo_AddSMIMECaps (signerinfo) != SECSuccess) {
-		fprintf(stderr, "ERROR: cannot add SMIMECaps attribute.\n");
+		fprintf (stderr, "ERROR: cannot add SMIMECaps attribute.\n");
 		goto loser;
 	}
 #endif
@@ -425,12 +427,12 @@ sm_signing_cmsmessage (CamelSMIMEContext *context,
 
 		if (p->encrypt_key) {
 			/* encrypt key has its own nick */
-			if ((ekpcert = CERT_FindUserCertByUsage(
+			if ((ekpcert = CERT_FindUserCertByUsage (
 				     p->certdb,
 				     p->encrypt_key,
 				     certUsageEmailRecipient, PR_TRUE, NULL)) == NULL) {
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_SYSTEM,
+				g_set_error (
+					error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 					_("Encryption certificate for '%s' does not exist"),
 					p->encrypt_key);
 				goto fail;
@@ -444,8 +446,8 @@ sm_signing_cmsmessage (CamelSMIMEContext *context,
 			if ((ekpcert = CERT_FindUserCertByUsage (
 				     p->certdb, (gchar *)nick,
 				     certUsageEmailRecipient, PR_TRUE, NULL)) == NULL) {
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_SYSTEM,
+				g_set_error (
+					error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 					_("Encryption certificate for '%s' does not exist"), nick);
 				goto fail;
 			}
@@ -453,23 +455,23 @@ sm_signing_cmsmessage (CamelSMIMEContext *context,
 		}
 
 		if (NSS_CMSSignerInfo_AddSMIMEEncKeyPrefs (signerinfo, enccert, p->certdb) != SECSuccess) {
-			set_nss_error (ex, _("Cannot add SMIMEEncKeyPrefs attribute"));
+			set_nss_error (error, _("Cannot add SMIMEEncKeyPrefs attribute"));
 			goto fail;
 		}
 
 		if (NSS_CMSSignerInfo_AddMSSMIMEEncKeyPrefs (signerinfo, enccert, p->certdb) != SECSuccess) {
-			set_nss_error (ex, _("Cannot add MS SMIMEEncKeyPrefs attribute"));
+			set_nss_error (error, _("Cannot add MS SMIMEEncKeyPrefs attribute"));
 			goto fail;
 		}
 
 		if (ekpcert != NULL && NSS_CMSSignedData_AddCertificate (sigd, ekpcert) != SECSuccess) {
-			set_nss_error (ex, _("Cannot add encryption certificate"));
+			set_nss_error (error, _("Cannot add encryption certificate"));
 			goto fail;
 		}
 	}
 
 	if (NSS_CMSSignedData_AddSignerInfo (sigd, signerinfo) != SECSuccess) {
-		set_nss_error (ex, _("Cannot add CMS Signer information"));
+		set_nss_error (error, _("Cannot add CMS Signer information"));
 		goto fail;
 	}
 
@@ -527,7 +529,7 @@ static CamelCipherValidity *
 sm_verify_cmsg (CamelCipherContext *context,
                 NSSCMSMessage *cmsg,
                 CamelStream *extstream,
-                CamelException *ex)
+                GError **error)
 {
 	CamelSMIMEContextPrivate *p = ((CamelSMIMEContext *)context)->priv;
 	NSSCMSSignedData *sigd = NULL;
@@ -561,17 +563,17 @@ sm_verify_cmsg (CamelCipherContext *context,
 		case SEC_OID_PKCS7_SIGNED_DATA:
 			sigd = (NSSCMSSignedData *)NSS_CMSContentInfo_GetContent (cinfo);
 			if (sigd == NULL) {
-				set_nss_error (ex, _("No signed data in signature"));
+				set_nss_error (error, _("No signed data in signature"));
 				goto fail;
 			}
 
 			if (extstream == NULL) {
-				set_nss_error (ex, _("Digests missing from enveloped data"));
+				set_nss_error (error, _("Digests missing from enveloped data"));
 				goto fail;
 			}
 
 			if ((poolp = PORT_NewArena (1024)) == NULL) {
-				set_nss_error (ex, g_strerror (ENOMEM));
+				set_nss_error (error, g_strerror (ENOMEM));
 				goto fail;
 			}
 
@@ -579,29 +581,29 @@ sm_verify_cmsg (CamelCipherContext *context,
 
 			digcx = NSS_CMSDigestContext_StartMultiple (digestalgs);
 			if (digcx == NULL) {
-				set_nss_error (ex, _("Cannot calculate digests"));
+				set_nss_error (error, _("Cannot calculate digests"));
 				goto fail;
 			}
 
 			buffer = g_byte_array_new ();
 			mem = camel_stream_mem_new_with_byte_array (buffer);
-			camel_stream_write_to_stream (extstream, mem);
+			camel_stream_write_to_stream (extstream, mem, NULL);
 			NSS_CMSDigestContext_Update (digcx, buffer->data, buffer->len);
 			g_object_unref (mem);
 
 			if (NSS_CMSDigestContext_FinishMultiple (digcx, poolp, &digests) != SECSuccess) {
-				set_nss_error (ex, _("Cannot calculate digests"));
+				set_nss_error (error, _("Cannot calculate digests"));
 				goto fail;
 			}
 
 			for (which_digest = 0; digests[which_digest] != NULL; which_digest++) {
 				SECOidData *digest_alg = SECOID_FindOID (&digestalgs[which_digest]->algorithm);
 				if (digest_alg == NULL) {
-					set_nss_error (ex, _("Cannot set message digests"));
+					set_nss_error (error, _("Cannot set message digests"));
 					goto fail;
 				}
 				if (NSS_CMSSignedData_SetDigestValue (sigd, digest_alg->offset, digests[which_digest]) != SECSuccess) {
-					set_nss_error (ex, _("Cannot set message digests"));
+					set_nss_error (error, _("Cannot set message digests"));
 					goto fail;
 				}
 			}
@@ -611,12 +613,12 @@ sm_verify_cmsg (CamelCipherContext *context,
 
 			/* import all certificates present */
 			if (NSS_CMSSignedData_ImportCerts (sigd, p->certdb, certUsageEmailSigner, PR_TRUE) != SECSuccess) {
-				set_nss_error (ex, _("Certificate import failed"));
+				set_nss_error (error, _("Certificate import failed"));
 				goto fail;
 			}
 
 			if (NSS_CMSSignedData_ImportCerts (sigd, p->certdb, certUsageEmailRecipient, PR_TRUE) != SECSuccess) {
-				set_nss_error (ex, _("Certificate import failed"));
+				set_nss_error (error, _("Certificate import failed"));
 				goto fail;
 			}
 
@@ -633,7 +635,7 @@ sm_verify_cmsg (CamelCipherContext *context,
 				}
 			} else {
 				if (!NSS_CMSSignedData_HasDigests (sigd)) {
-					set_nss_error (ex, _("Cannot find signature digests"));
+					set_nss_error (error, _("Cannot find signature digests"));
 					goto fail;
 				}
 
@@ -762,7 +764,7 @@ smime_context_sign (CamelCipherContext *context,
                     CamelCipherHash hash,
                     CamelMimePart *ipart,
                     CamelMimePart *opart,
-                    CamelException *ex)
+                    GError **error)
 {
 	CamelCipherContextClass *class;
 	gint res = -1;
@@ -800,7 +802,7 @@ smime_context_sign (CamelCipherContext *context,
 
 	cmsg = sm_signing_cmsmessage (
 		(CamelSMIMEContext *)context, userid, &sechash,
-		((CamelSMIMEContext *)context)->priv->sign_mode == CAMEL_SMIME_SIGN_CLEARSIGN, ex);
+		((CamelSMIMEContext *)context)->priv->sign_mode == CAMEL_SMIME_SIGN_CLEARSIGN, error);
 	if (cmsg == NULL)
 		return -1;
 
@@ -814,10 +816,9 @@ smime_context_sign (CamelCipherContext *context,
 		ipart, CAMEL_MIME_FILTER_CANON_STRIP |
 		CAMEL_MIME_FILTER_CANON_CRLF |
 		CAMEL_MIME_FILTER_CANON_FROM,
-		istream) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Could not generate signing data: %s"), g_strerror(errno));
+		istream, error) == -1) {
+		g_prefix_error (
+			error, _("Could not generate signing data: "));
 		goto fail;
 	}
 
@@ -828,26 +829,26 @@ smime_context_sign (CamelCipherContext *context,
 				   NULL, NULL,     /* decrypt key callback */
 				   NULL, NULL );   /* detached digests    */
 	if (!enc) {
-		set_nss_error (ex, _("Cannot create encoder context"));
+		set_nss_error (error, _("Cannot create encoder context"));
 		goto fail;
 	}
 
 	if (NSS_CMSEncoder_Update (enc, (gchar *) buffer->data, buffer->len) != SECSuccess) {
 		NSS_CMSEncoder_Cancel (enc);
-		set_nss_error (ex, _("Failed to add data to CMS encoder"));
+		set_nss_error (error, _("Failed to add data to CMS encoder"));
 		goto fail;
 	}
 
 	if (NSS_CMSEncoder_Finish (enc) != SECSuccess) {
-		set_nss_error (ex, _("Failed to encode data"));
+		set_nss_error (error, _("Failed to encode data"));
 		goto fail;
 	}
 
 	res = 0;
 
 	dw = camel_data_wrapper_new ();
-	camel_stream_reset (ostream);
-	camel_data_wrapper_construct_from_stream (dw, ostream);
+	camel_stream_reset (ostream, NULL);
+	camel_data_wrapper_construct_from_stream (dw, ostream, NULL);
 	dw->encoding = CAMEL_TRANSFER_ENCODING_BINARY;
 
 	if (((CamelSMIMEContext *)context)->priv->sign_mode == CAMEL_SMIME_SIGN_CLEARSIGN) {
@@ -876,7 +877,7 @@ smime_context_sign (CamelCipherContext *context,
 
 		mps->signature = sigpart;
 		mps->contentraw = istream;
-		camel_stream_reset (istream);
+		camel_stream_reset (istream, NULL);
 		g_object_ref (istream);
 
 		camel_medium_set_content ((CamelMedium *)opart, (CamelDataWrapper *)mps);
@@ -906,7 +907,7 @@ fail:
 static CamelCipherValidity *
 smime_context_verify (CamelCipherContext *context,
                       CamelMimePart *ipart,
-                      CamelException *ex)
+                      GError **error)
 {
 	CamelCipherContextClass *class;
 	NSSCMSDecoderContext *dec;
@@ -937,30 +938,33 @@ smime_context_verify (CamelCipherContext *context,
 		    || tmp == NULL
 		    || (g_ascii_strcasecmp (tmp, class->sign_protocol) != 0
 			&& g_ascii_strcasecmp (tmp, "application/pkcs7-signature") != 0)) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SYSTEM,
-				_("Cannot verify message signature: Incorrect message format"));
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+				_("Cannot verify message signature: "
+				  "Incorrect message format"));
 			goto fail;
 		}
 
 		constream = camel_multipart_signed_get_content_stream (
-			(CamelMultipartSigned *)mps, ex);
+			(CamelMultipartSigned *)mps, error);
 		if (constream == NULL)
 			goto fail;
 
 		sigpart = camel_multipart_get_part (mps, CAMEL_MULTIPART_SIGNED_SIGNATURE);
 		if (sigpart == NULL) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SYSTEM,
-				_("Cannot verify message signature: Incorrect message format"));
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+				_("Cannot verify message signature: "
+				  "Incorrect message format"));
 			goto fail;
 		}
 	} else if (camel_content_type_is (ct, "application", "x-pkcs7-mime")) {
 		sigpart = ipart;
 	} else {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Cannot verify message signature: Incorrect message format"));
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+			_("Cannot verify message signature: "
+			  "Incorrect message format"));
 		goto fail;
 	}
 
@@ -970,15 +974,15 @@ smime_context_verify (CamelCipherContext *context,
 				   NULL, NULL); /* decrypt key callback */
 
 	camel_data_wrapper_decode_to_stream (
-		camel_medium_get_content (CAMEL_MEDIUM (sigpart)), mem);
+		camel_medium_get_content (CAMEL_MEDIUM (sigpart)), mem, NULL);
 	(void)NSS_CMSDecoder_Update (dec, (gchar *) buffer->data, buffer->len);
 	cmsg = NSS_CMSDecoder_Finish (dec);
 	if (cmsg == NULL) {
-		set_nss_error (ex, _("Decoder failed"));
+		set_nss_error (error, _("Decoder failed"));
 		goto fail;
 	}
 
-	valid = sm_verify_cmsg (context, cmsg, constream, ex);
+	valid = sm_verify_cmsg (context, cmsg, constream, error);
 
 	NSS_CMSMessage_Destroy (cmsg);
 fail:
@@ -995,7 +999,7 @@ smime_context_encrypt (CamelCipherContext *context,
                        GPtrArray *recipients,
                        CamelMimePart *ipart,
                        CamelMimePart *opart,
-                       CamelException *ex)
+                       GError **error)
 {
 	CamelSMIMEContextPrivate *p = ((CamelSMIMEContext *)context)->priv;
 	/*NSSCMSRecipientInfo **recipient_infos;*/
@@ -1018,30 +1022,31 @@ smime_context_encrypt (CamelCipherContext *context,
 
 	poolp = PORT_NewArena (1024);
 	if (poolp == NULL) {
-		set_nss_error (ex, g_strerror (ENOMEM));
+		set_nss_error (error, g_strerror (ENOMEM));
 		return -1;
 	}
 
 	/* Lookup all recipients certs, for later working */
 	recipient_certs = (CERTCertificate **)PORT_ArenaZAlloc (poolp, sizeof (*recipient_certs[0])*(recipients->len + 1));
 	if (recipient_certs == NULL) {
-		set_nss_error (ex, g_strerror (ENOMEM));
+		set_nss_error (error, g_strerror (ENOMEM));
 		goto fail;
 	}
 
 	for (i=0;i<recipients->len;i++) {
 		recipient_certs[i] = CERT_FindCertByNicknameOrEmailAddr (p->certdb, recipients->pdata[i]);
 		if (recipient_certs[i] == NULL) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
-				_("Cannot find certificate for '%s'"), recipients->pdata[i]);
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+				_("Cannot find certificate for '%s'"),
+				(gchar *) recipients->pdata[i]);
 			goto fail;
 		}
 	}
 
 	/* Find a common algorithm, probably 3DES anyway ... */
 	if (NSS_SMIMEUtil_FindBulkAlgForRecipients (recipient_certs, &bulkalgtag, &bulkkeysize) != SECSuccess) {
-		set_nss_error (ex, _("Cannot find common bulk encryption algorithm"));
+		set_nss_error (error, _("Cannot find common bulk encryption algorithm"));
 		goto fail;
 	}
 
@@ -1049,7 +1054,7 @@ smime_context_encrypt (CamelCipherContext *context,
 	type = PK11_AlgtagToMechanism (bulkalgtag);
 	slot = PK11_GetBestSlot (type, context);
 	if (slot == NULL) {
-		set_nss_error (ex, _("Cannot allocate slot for encryption bulk key"));
+		set_nss_error (error, _("Cannot allocate slot for encryption bulk key"));
 		goto fail;
 	}
 
@@ -1060,25 +1065,25 @@ smime_context_encrypt (CamelCipherContext *context,
 	/* msg->envelopedData->data */
 	cmsg = NSS_CMSMessage_Create (NULL);
 	if (cmsg == NULL) {
-		set_nss_error (ex, _("Cannot create CMS Message"));
+		set_nss_error (error, _("Cannot create CMS Message"));
 		goto fail;
 	}
 
 	envd = NSS_CMSEnvelopedData_Create (cmsg, bulkalgtag, bulkkeysize);
 	if (envd == NULL) {
-		set_nss_error (ex, _("Cannot create CMS Enveloped data"));
+		set_nss_error (error, _("Cannot create CMS Enveloped data"));
 		goto fail;
 	}
 
 	cinfo = NSS_CMSMessage_GetContentInfo (cmsg);
 	if (NSS_CMSContentInfo_SetContent_EnvelopedData (cmsg, cinfo, envd) != SECSuccess) {
-		set_nss_error (ex, _("Cannot attach CMS Enveloped data"));
+		set_nss_error (error, _("Cannot attach CMS Enveloped data"));
 		goto fail;
 	}
 
 	cinfo = NSS_CMSEnvelopedData_GetContentInfo (envd);
 	if (NSS_CMSContentInfo_SetContent_Data (cmsg, cinfo, NULL, PR_FALSE) != SECSuccess) {
-		set_nss_error (ex, _("Cannot attach CMS data object"));
+		set_nss_error (error, _("Cannot attach CMS data object"));
 		goto fail;
 	}
 
@@ -1087,12 +1092,12 @@ smime_context_encrypt (CamelCipherContext *context,
 		NSSCMSRecipientInfo *ri = NSS_CMSRecipientInfo_Create (cmsg, recipient_certs[i]);
 
 		if (ri == NULL) {
-			set_nss_error (ex, _("Cannot create CMS Recipient information"));
+			set_nss_error (error, _("Cannot create CMS Recipient information"));
 			goto fail;
 		}
 
 		if (NSS_CMSEnvelopedData_AddRecipient (envd, ri) != SECSuccess) {
-			set_nss_error (ex, _("Cannot add CMS Recipient information"));
+			set_nss_error (error, _("Cannot add CMS Recipient information"));
 			goto fail;
 		}
 	}
@@ -1106,24 +1111,24 @@ smime_context_encrypt (CamelCipherContext *context,
 				   sm_decrypt_key, bulkkey,
 				   NULL, NULL);
 	if (enc == NULL) {
-		set_nss_error (ex, _("Cannot create encoder context"));
+		set_nss_error (error, _("Cannot create encoder context"));
 		goto fail;
 	}
 
 	/* FIXME: Stream the input */
 	buffer = g_byte_array_new ();
 	mem = camel_stream_mem_new_with_byte_array (buffer);
-	camel_cipher_canonical_to_stream (ipart, CAMEL_MIME_FILTER_CANON_CRLF, mem);
+	camel_cipher_canonical_to_stream (ipart, CAMEL_MIME_FILTER_CANON_CRLF, mem, NULL);
 	if (NSS_CMSEncoder_Update (enc, (gchar *) buffer->data, buffer->len) != SECSuccess) {
 		NSS_CMSEncoder_Cancel (enc);
 		g_object_unref (mem);
-		set_nss_error (ex, _("Failed to add data to encoder"));
+		set_nss_error (error, _("Failed to add data to encoder"));
 		goto fail;
 	}
 	g_object_unref (mem);
 
-	if (NSS_CMSEncoder_Finish(enc) != SECSuccess) {
-		set_nss_error (ex, _("Failed to encode data"));
+	if (NSS_CMSEncoder_Finish (enc) != SECSuccess) {
+		set_nss_error (error, _("Failed to encode data"));
 		goto fail;
 	}
 
@@ -1134,7 +1139,7 @@ smime_context_encrypt (CamelCipherContext *context,
 	PORT_FreeArena (poolp, PR_FALSE);
 
 	dw = camel_data_wrapper_new ();
-	camel_data_wrapper_construct_from_stream (dw, ostream);
+	camel_data_wrapper_construct_from_stream (dw, ostream, NULL);
 	g_object_unref (ostream);
 	dw->encoding = CAMEL_TRANSFER_ENCODING_BINARY;
 
@@ -1176,7 +1181,7 @@ static CamelCipherValidity *
 smime_context_decrypt (CamelCipherContext *context,
                        CamelMimePart *ipart,
                        CamelMimePart *opart,
-                       CamelException *ex)
+                       GError **error)
 {
 	NSSCMSDecoderContext *dec;
 	NSSCMSMessage *cmsg;
@@ -1194,8 +1199,9 @@ smime_context_decrypt (CamelCipherContext *context,
 	/* FIXME: stream this to the decoder incrementally */
 	buffer = g_byte_array_new ();
 	istream = camel_stream_mem_new_with_byte_array (buffer);
-	camel_data_wrapper_decode_to_stream (camel_medium_get_content ((CamelMedium *)ipart), istream);
-	camel_stream_reset (istream);
+	camel_data_wrapper_decode_to_stream (
+		camel_medium_get_content ((CamelMedium *)ipart), istream, NULL);
+	camel_stream_reset (istream, NULL);
 
 	dec = NSS_CMSDecoder_Start (NULL,
 				   sm_write_stream, ostream, /* content callback     */
@@ -1211,7 +1217,7 @@ smime_context_decrypt (CamelCipherContext *context,
 	g_object_unref (istream);
 
 	if (cmsg == NULL) {
-		set_nss_error (ex, _("Decoder failed"));
+		set_nss_error (error, _("Decoder failed"));
 		goto fail;
 	}
 
@@ -1224,12 +1230,12 @@ smime_context_decrypt (CamelCipherContext *context,
 	}
 #endif
 
-	camel_stream_reset (ostream);
-	camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)opart, ostream);
+	camel_stream_reset (ostream, NULL);
+	camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)opart, ostream, NULL);
 
 	if (NSS_CMSMessage_IsSigned (cmsg)) {
-		camel_stream_reset (ostream);
-		valid = sm_verify_cmsg (context, cmsg, ostream, ex);
+		camel_stream_reset (ostream, NULL);
+		valid = sm_verify_cmsg (context, cmsg, ostream, error);
 	} else {
 		valid = camel_cipher_validity_new ();
 		valid->encrypt.description = g_strdup (_("Encrypted content"));
@@ -1336,8 +1342,10 @@ camel_smime_context_describe_part (CamelSMIMEContext *context, CamelMimePart *pa
 		/* FIXME: stream this to the decoder incrementally */
 		buffer = g_byte_array_new ();
 		istream = camel_stream_mem_new_with_byte_array (buffer);
-		camel_data_wrapper_decode_to_stream (camel_medium_get_content ((CamelMedium *)part), istream);
-		camel_stream_reset (istream);
+		camel_data_wrapper_decode_to_stream (
+			camel_medium_get_content ((CamelMedium *)part),
+			istream, NULL);
+		camel_stream_reset (istream, NULL);
 
 		dec = NSS_CMSDecoder_Start (NULL,
 					   NULL, NULL,
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 7b3a821..4f12d5a 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -35,7 +35,6 @@
 
 #include "camel-db.h"
 #include "camel-debug.h"
-#include "camel-exception.h"
 #include "camel-folder.h"
 #include "camel-marshal.h"
 #include "camel-session.h"
@@ -72,10 +71,13 @@ G_DEFINE_ABSTRACT_TYPE (CamelStore, camel_store, CAMEL_TYPE_SERVICE)
  * Clears the exception 'ex' when it's the 'no such table' exception.
  **/
 static void
-ignore_no_such_table_exception (CamelException *ex)
+ignore_no_such_table_exception (GError **error)
 {
-	if (ex && camel_exception_is_set (ex) && g_ascii_strncasecmp (camel_exception_get_description (ex), "no such table", 13) == 0)
-		camel_exception_clear (ex);
+	if (error == NULL || *error == NULL)
+		return;
+
+	if (g_ascii_strncasecmp ((*error)->message, "no such table", 13) == 0)
+		g_clear_error (error);
 }
 
 static CamelFolder *
@@ -145,7 +147,7 @@ store_construct (CamelService *service,
                  CamelSession *session,
                  CamelProvider *provider,
                  CamelURL *url,
-                 CamelException *ex)
+                 GError **error)
 {
 	CamelServiceClass *service_class;
 	CamelStore *store = CAMEL_STORE(service);
@@ -153,13 +155,13 @@ store_construct (CamelService *service,
 
 	/* Chain up to parent's construct() method. */
 	service_class = CAMEL_SERVICE_CLASS (camel_store_parent_class);
-	if (!service_class->construct (service, session, provider, url, ex))
+	if (!service_class->construct (service, session, provider, url, error))
 		return FALSE;
 
 	store_db_path = g_build_filename (service->url->path, CAMEL_DB_FILE, NULL);
 
 	if (!service->url->path || strlen (store_db_path) < 2) {
-		store_path = camel_session_get_storage_path (session, service, ex);
+		store_path = camel_session_get_storage_path (session, service, error);
 
 		g_free (store_db_path);
 		store_db_path = g_build_filename (store_path, CAMEL_DB_FILE, NULL);
@@ -173,40 +175,36 @@ store_construct (CamelService *service,
 	g_free (store_path);
 
 	/* This is for reading from the store */
-	store->cdb_r = camel_db_open (store_db_path, ex);
+	store->cdb_r = camel_db_open (store_db_path, NULL);
 	if (camel_debug("sqlite"))
 		printf("store_db_path %s\n", store_db_path);
-	if (camel_exception_is_set (ex)) {
+	if (store->cdb_r == NULL) {
 		gchar *store_path;
 
 		if (camel_debug("sqlite"))
 			g_print ("Failure for store_db_path : [%s]\n", store_db_path);
 		g_free (store_db_path);
 
-		store_path =  camel_session_get_storage_path (session, service, ex);
+		store_path =  camel_session_get_storage_path (session, service, NULL);
 		store_db_path = g_build_filename (store_path, CAMEL_DB_FILE, NULL);
 		g_free (store_path);
-		camel_exception_clear(ex);
-		store->cdb_r = camel_db_open (store_db_path, ex);
-		if (camel_exception_is_set (ex)) {
+
+		store->cdb_r = camel_db_open (store_db_path, NULL);
+		if (store->cdb_r == NULL) {
 			g_print("Retry with %s failed\n", store_db_path);
 			g_free(store_db_path);
-			camel_exception_clear(ex);
 			return FALSE;
 		}
 	}
 	g_free (store_db_path);
 
-	if (camel_db_create_folders_table (store->cdb_r, ex)) {
+	if (camel_db_create_folders_table (store->cdb_r, error)) {
 		g_warning ("something went wrong terribly during db creation \n");
 		return FALSE;
 	}
 
-	if (camel_exception_is_set (ex))
-		return FALSE;
-
 	/* This is for writing to the store */
-	store->cdb_w = camel_db_clone (store->cdb_r, ex);
+	store->cdb_w = camel_db_clone (store->cdb_r, error);
 
 	if (camel_url_get_param(url, "filter"))
 		store->flags |= CAMEL_STORE_FILTER_INBOX;
@@ -216,25 +214,29 @@ store_construct (CamelService *service,
 
 static CamelFolder *
 store_get_inbox (CamelStore *store,
-                 CamelException *ex)
+                 GError **error)
 {
 	CamelStoreClass *class;
+	CamelFolder *folder;
 
 	/* Assume the inbox's name is "inbox" and open with default flags. */
 	class = CAMEL_STORE_GET_CLASS (store);
-	return class->get_folder (store, "inbox", 0, ex);
+	folder = class->get_folder (store, "inbox", 0, error);
+	CAMEL_CHECK_GERROR (store, get_folder, folder != NULL, error);
+
+	return folder;
 }
 
 static CamelFolder *
 store_get_trash (CamelStore *store,
-                 CamelException *ex)
+                 GError **error)
 {
 	return store_get_special (store, CAMEL_VTRASH_FOLDER_TRASH);
 }
 
 static CamelFolder *
 store_get_junk (CamelStore *store,
-                CamelException *ex)
+                GError **error)
 {
 	return store_get_special (store, CAMEL_VTRASH_FOLDER_JUNK);
 }
@@ -242,13 +244,13 @@ store_get_junk (CamelStore *store,
 static gboolean
 store_sync (CamelStore *store,
             gint expunge,
-            CamelException *ex)
+            GError **error)
 {
 	GPtrArray *folders;
 	CamelFolder *folder;
-	CamelException x;
 	gboolean success = TRUE;
 	gint i;
+	GError *local_error = NULL;
 
 	if (store->folders == NULL)
 		return TRUE;
@@ -256,19 +258,22 @@ store_sync (CamelStore *store,
 	/* We don't sync any vFolders, that is used to update certain
 	 * vfolder queries mainly, and we're really only interested in
 	 * storing/expunging the physical mails. */
-	camel_exception_init(&x);
 	folders = camel_object_bag_list(store->folders);
 	for (i=0;i<folders->len;i++) {
 		folder = folders->pdata[i];
 		if (!CAMEL_IS_VEE_FOLDER(folder)
-		    && !camel_exception_is_set(&x)) {
-			camel_folder_sync(folder, expunge, &x);
-			ignore_no_such_table_exception (&x);
+		    && local_error == NULL) {
+			camel_folder_sync(folder, expunge, &local_error);
+			ignore_no_such_table_exception (&local_error);
 		} else if (CAMEL_IS_VEE_FOLDER(folder))
 			camel_vee_folder_sync_headers(folder, NULL); /* Literally don't care of vfolder exceptions */
 		g_object_unref (folder);
 	}
-	camel_exception_xfer(ex, &x);
+
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		success = FALSE;
+	}
 
 	g_ptr_array_free (folders, TRUE);
 
@@ -277,7 +282,7 @@ store_sync (CamelStore *store,
 
 static gboolean
 store_noop (CamelStore *store,
-            CamelException *ex)
+            GError **error)
 {
 	return TRUE;
 }
@@ -285,7 +290,7 @@ store_noop (CamelStore *store,
 static gboolean
 store_can_refresh_folder (CamelStore *store,
                           CamelFolderInfo *info,
-                          CamelException *ex)
+                          GError **error)
 {
 	return ((info->flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_INBOX);
 }
@@ -388,12 +393,25 @@ camel_store_init (CamelStore *store)
 	g_static_rec_mutex_init (&store->priv->folder_lock);
 }
 
+GQuark
+camel_store_error_quark (void)
+{
+	static GQuark quark = 0;
+
+	if (G_UNLIKELY (quark == 0)) {
+		const gchar *string = "camel-store-error-quark";
+		quark = g_quark_from_static_string (string);
+	}
+
+	return quark;
+}
+
 /**
  * camel_store_get_folder:
  * @store: a #CamelStore object
  * @folder_name: name of the folder to get
  * @flags: folder flags (create, save body index, etc)
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Get a specific folder object from the store by name.
  *
@@ -403,7 +421,7 @@ CamelFolder *
 camel_store_get_folder (CamelStore *store,
                         const gchar *folder_name,
                         guint32 flags,
-                        CamelException *ex)
+                        GError **error)
 {
 	CamelStoreClass *class;
 	CamelFolder *folder = NULL;
@@ -421,8 +439,8 @@ camel_store_get_folder (CamelStore *store,
 		/* Try cache first. */
 		folder = camel_object_bag_reserve(store->folders, folder_name);
 		if (folder && (flags & CAMEL_STORE_FOLDER_EXCL)) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Cannot create folder '%s': folder exists"),
 				folder_name);
                         camel_object_bag_abort (store->folders, folder_name);
@@ -448,11 +466,15 @@ camel_store_get_folder (CamelStore *store,
 		}
 
 		if ((store->flags & CAMEL_STORE_VTRASH) && strcmp(folder_name, CAMEL_VTRASH_NAME) == 0) {
-			folder = class->get_trash(store, ex);
+			folder = class->get_trash(store, error);
+			CAMEL_CHECK_GERROR (store, get_trash, folder != NULL, error);
 		} else if ((store->flags & CAMEL_STORE_VJUNK) && strcmp(folder_name, CAMEL_VJUNK_NAME) == 0) {
-			folder = class->get_junk(store, ex);
+			folder = class->get_junk(store, error);
+			CAMEL_CHECK_GERROR (store, get_junk, folder != NULL, error);
 		} else {
-			folder = class->get_folder(store, folder_name, flags, ex);
+			folder = class->get_folder(store, folder_name, flags, error);
+			CAMEL_CHECK_GERROR (store, get_folder, folder != NULL, error);
+
 			if (folder) {
 				CamelVeeFolder *vfolder;
 
@@ -489,7 +511,7 @@ camel_store_get_folder (CamelStore *store,
  * @store: a #CamelStore object
  * @parent_name: name of the new folder's parent, or %NULL
  * @folder_name: name of the folder to create
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Creates a new folder as a child of an existing folder.
  * @parent_name can be %NULL to create a new top-level folder.
@@ -501,7 +523,7 @@ CamelFolderInfo *
 camel_store_create_folder (CamelStore *store,
                            const gchar *parent_name,
                            const gchar *folder_name,
-                           CamelException *ex)
+                           GError **error)
 {
 	CamelStoreClass *class;
 	CamelFolderInfo *fi;
@@ -515,15 +537,17 @@ camel_store_create_folder (CamelStore *store,
 	if ((parent_name == NULL || parent_name[0] == 0)
 	    && (((store->flags & CAMEL_STORE_VTRASH) && strcmp(folder_name, CAMEL_VTRASH_NAME) == 0)
 		|| ((store->flags & CAMEL_STORE_VJUNK) && strcmp(folder_name, CAMEL_VJUNK_NAME) == 0))) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_INVALID,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_INVALID,
 			_("Cannot create folder: %s: folder exists"),
 			folder_name);
 		return NULL;
 	}
 
 	camel_store_lock (store, CAMEL_STORE_FOLDER_LOCK);
-	fi = class->create_folder (store, parent_name, folder_name, ex);
+	fi = class->create_folder (store, parent_name, folder_name, error);
+	CAMEL_CHECK_GERROR (store, create_folder, fi != NULL, error);
 	camel_store_unlock (store, CAMEL_STORE_FOLDER_LOCK);
 
 	return fi;
@@ -562,7 +586,7 @@ cs_delete_cached_folder(CamelStore *store, const gchar *folder_name)
  * camel_store_delete_folder:
  * @store: a #CamelStore object
  * @folder_name: name of the folder to delete
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Deletes the named folder. The folder must be empty.
  *
@@ -571,11 +595,11 @@ cs_delete_cached_folder(CamelStore *store, const gchar *folder_name)
 gboolean
 camel_store_delete_folder (CamelStore *store,
                            const gchar *folder_name,
-                           CamelException *ex)
+                           GError **error)
 {
 	CamelStoreClass *class;
-	CamelException local;
 	gboolean success;
+	GError *local_error = NULL;
 
 	g_return_val_if_fail (CAMEL_IS_STORE (store), FALSE);
 	g_return_val_if_fail (folder_name != NULL, FALSE);
@@ -586,28 +610,28 @@ camel_store_delete_folder (CamelStore *store,
 	/* TODO: should probably be a parameter/bit on the storeinfo */
 	if (((store->flags & CAMEL_STORE_VTRASH) && strcmp(folder_name, CAMEL_VTRASH_NAME) == 0)
 	    || ((store->flags & CAMEL_STORE_VJUNK) && strcmp(folder_name, CAMEL_VJUNK_NAME) == 0)) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("Cannot delete folder: %s: Invalid operation"),
 			folder_name);
 		return FALSE;
 	}
 
-	camel_exception_init(&local);
-
 	camel_store_lock (store, CAMEL_STORE_FOLDER_LOCK);
 
-	success = class->delete_folder (store, folder_name, &local);
+	success = class->delete_folder (store, folder_name, &local_error);
+	CAMEL_CHECK_GERROR (store, delete_folder, success, &local_error);
 
 	/* ignore 'no such table' errors */
-	if (camel_exception_is_set (&local) && camel_exception_get_description (&local) &&
-	    g_ascii_strncasecmp (camel_exception_get_description (&local), "no such table", 13) == 0)
-		camel_exception_clear (&local);
+	if (local_error != NULL &&
+	    g_ascii_strncasecmp (local_error->message, "no such table", 13) == 0)
+		g_clear_error (&local_error);
 
-	if (!camel_exception_is_set(&local))
+	if (local_error == NULL)
 		cs_delete_cached_folder(store, folder_name);
 	else
-		camel_exception_xfer(ex, &local);
+		g_propagate_error (error, local_error);
 
 	camel_store_unlock (store, CAMEL_STORE_FOLDER_LOCK);
 
@@ -619,7 +643,7 @@ camel_store_delete_folder (CamelStore *store,
  * @store: a #CamelStore object
  * @old_namein: the current name of the folder
  * @new_name: the new name of the folder
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Rename a named folder to a new name.
  *
@@ -629,7 +653,7 @@ gboolean
 camel_store_rename_folder (CamelStore *store,
                            const gchar *old_namein,
                            const gchar *new_name,
-                           CamelException *ex)
+                           GError **error)
 {
 	CamelStoreClass *class;
 	CamelFolder *folder;
@@ -650,8 +674,9 @@ camel_store_rename_folder (CamelStore *store,
 
 	if (((store->flags & CAMEL_STORE_VTRASH) && strcmp(old_namein, CAMEL_VTRASH_NAME) == 0)
 	    || ((store->flags & CAMEL_STORE_VJUNK) && strcmp(old_namein, CAMEL_VJUNK_NAME) == 0)) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("Cannot rename folder: %s: Invalid operation"),
 			old_namein);
 		return FALSE;
@@ -689,7 +714,8 @@ camel_store_rename_folder (CamelStore *store,
 	}
 
 	/* Now try the real rename (will emit renamed signal) */
-	success = class->rename_folder (store, old_name, new_name, ex);
+	success = class->rename_folder (store, old_name, new_name, error);
+	CAMEL_CHECK_GERROR (store, rename_folder, success, error);
 
 	/* If it worked, update all open folders/unlock them */
 	if (folders) {
@@ -704,7 +730,7 @@ camel_store_rename_folder (CamelStore *store,
 				folder = folders->pdata[i];
 				full_name = camel_folder_get_full_name (folder);
 
-				new = g_strdup_printf("%s%s", new_name, full_name+strlen(old_name));
+				new = g_strdup_printf("%s%s", new_name, full_name + strlen(old_name));
 				camel_object_bag_rekey(store->folders, folder, new);
 				camel_folder_rename(folder, new);
 				g_free(new);
@@ -717,7 +743,9 @@ camel_store_rename_folder (CamelStore *store,
 			if (store->flags & CAMEL_STORE_SUBSCRIPTIONS)
 				flags |= CAMEL_STORE_FOLDER_INFO_SUBSCRIBED;
 
-			folder_info = class->get_folder_info(store, new_name, flags, ex);
+			folder_info = class->get_folder_info(store, new_name, flags, error);
+			CAMEL_CHECK_GERROR (store, get_folder_info, folder_info != NULL, error);
+
 			if (folder_info != NULL) {
 				camel_store_folder_renamed (store, old_name, folder_info);
 				class->free_folder_info (store, folder_info);
@@ -851,14 +879,14 @@ camel_store_folder_unsubscribed (CamelStore *store,
 /**
  * camel_store_get_inbox:
  * @store: a #CamelStore object
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Returns: the folder in the store into which new mail is delivered,
  * or %NULL if no such folder exists.
  **/
 CamelFolder *
 camel_store_get_inbox (CamelStore *store,
-                       CamelException *ex)
+                       GError **error)
 {
 	CamelStoreClass *class;
 	CamelFolder *folder;
@@ -870,7 +898,8 @@ camel_store_get_inbox (CamelStore *store,
 
 	camel_store_lock (store, CAMEL_STORE_FOLDER_LOCK);
 
-	folder = class->get_inbox (store, ex);
+	folder = class->get_inbox (store, error);
+	CAMEL_CHECK_GERROR (store, get_inbox, folder != NULL, error);
 
 	camel_store_unlock (store, CAMEL_STORE_FOLDER_LOCK);
 
@@ -880,60 +909,68 @@ camel_store_get_inbox (CamelStore *store,
 /**
  * camel_store_get_trash:
  * @store: a #CamelStore object
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Returns: the folder in the store into which trash is delivered, or
  * %NULL if no such folder exists.
  **/
 CamelFolder *
 camel_store_get_trash (CamelStore *store,
-                       CamelException *ex)
+                       GError **error)
 {
 	g_return_val_if_fail (CAMEL_IS_STORE (store), NULL);
 
 	if ((store->flags & CAMEL_STORE_VTRASH) == 0) {
 		CamelStoreClass *class;
+		CamelFolder *folder;
 
 		class = CAMEL_STORE_GET_CLASS (store);
 		g_return_val_if_fail (class->get_trash != NULL, NULL);
 
-		return class->get_trash (store, ex);
+		folder = class->get_trash (store, error);
+		CAMEL_CHECK_GERROR (store, get_trash, folder != NULL, error);
+
+		return folder;
 	}
 
-	return camel_store_get_folder (store, CAMEL_VTRASH_NAME, 0, ex);
+	return camel_store_get_folder (store, CAMEL_VTRASH_NAME, 0, error);
 }
 
 /**
  * camel_store_get_junk:
  * @store: a #CamelStore object
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Returns: the folder in the store into which junk is delivered, or
  * %NULL if no such folder exists.
  **/
 CamelFolder *
 camel_store_get_junk (CamelStore *store,
-                      CamelException *ex)
+                      GError **error)
 {
 	g_return_val_if_fail (CAMEL_IS_STORE (store), NULL);
 
 	if ((store->flags & CAMEL_STORE_VJUNK) == 0) {
 		CamelStoreClass *class;
+		CamelFolder *folder;
 
 		class = CAMEL_STORE_GET_CLASS (store);
 		g_return_val_if_fail (class->get_junk != NULL, NULL);
 
-		return class->get_junk (store, ex);
+		folder = class->get_junk (store, error);
+		CAMEL_CHECK_GERROR (store, get_junk, folder != NULL, error);
+
+		return folder;
 	}
 
-	return camel_store_get_folder (store, CAMEL_VJUNK_NAME, 0, ex);
+	return camel_store_get_folder (store, CAMEL_VJUNK_NAME, 0, error);
 }
 
 /**
  * camel_store_sync:
  * @store: a #CamelStore object
  * @expunge: %TRUE if an expunge should be done after sync or %FALSE otherwise
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Syncs any changes that have been made to the store object and its
  * folders with the real store.
@@ -943,16 +980,20 @@ camel_store_get_junk (CamelStore *store,
 gboolean
 camel_store_sync (CamelStore *store,
                   gint expunge,
-                  CamelException *ex)
+                  GError **error)
 {
 	CamelStoreClass *class;
+	gboolean success;
 
 	g_return_val_if_fail (CAMEL_IS_STORE (store), FALSE);
 
 	class = CAMEL_STORE_GET_CLASS (store);
 	g_return_val_if_fail (class->sync != NULL, FALSE);
 
-	return class->sync (store, expunge, ex);
+	success = class->sync (store, expunge, error);
+	CAMEL_CHECK_GERROR (store, sync, success, error);
+
+	return success;
 }
 
 static void
@@ -1040,7 +1081,7 @@ dump_fi (CamelFolderInfo *fi, gint depth)
  * @store: a #CamelStore object
  * @top: the name of the folder to start from
  * @flags: various CAMEL_STORE_FOLDER_INFO_* flags to control behavior
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * This fetches information about the folder structure of @store,
  * starting with @top, and returns a tree of CamelFolderInfo
@@ -1068,7 +1109,7 @@ CamelFolderInfo *
 camel_store_get_folder_info (CamelStore *store,
                              const gchar *top,
                              guint32 flags,
-                             CamelException *ex)
+                             GError **error)
 {
 	CamelStoreClass *class;
 	CamelFolderInfo *info;
@@ -1078,7 +1119,8 @@ camel_store_get_folder_info (CamelStore *store,
 	class = CAMEL_STORE_GET_CLASS (store);
 	g_return_val_if_fail (class->get_folder_info != NULL, NULL);
 
-	info = class->get_folder_info (store, top, flags, ex);
+	info = class->get_folder_info (store, top, flags, error);
+	CAMEL_CHECK_GERROR (store, get_folder_info, info != NULL, error);
 
 	if (info && (top == NULL || *top == '\0') && (flags & CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL) == 0) {
 		if (info->uri && (store->flags & CAMEL_STORE_VTRASH))
@@ -1418,7 +1460,7 @@ camel_store_folder_is_subscribed (CamelStore *store,
  * camel_store_subscribe_folder:
  * @store: a #CamelStore object
  * @folder_name: full path of the folder
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Subscribe to the folder described by @folder_name.
  *
@@ -1427,7 +1469,7 @@ camel_store_folder_is_subscribed (CamelStore *store,
 gboolean
 camel_store_subscribe_folder (CamelStore *store,
                               const gchar *folder_name,
-                              CamelException *ex)
+                              GError **error)
 {
 	CamelStoreClass *class;
 	gboolean success;
@@ -1441,7 +1483,8 @@ camel_store_subscribe_folder (CamelStore *store,
 
 	camel_store_lock (store, CAMEL_STORE_FOLDER_LOCK);
 
-	success = class->subscribe_folder (store, folder_name, ex);
+	success = class->subscribe_folder (store, folder_name, error);
+	CAMEL_CHECK_GERROR (store, subscribe_folder, success, error);
 
 	camel_store_unlock (store, CAMEL_STORE_FOLDER_LOCK);
 
@@ -1452,7 +1495,7 @@ camel_store_subscribe_folder (CamelStore *store,
  * camel_store_unsubscribe_folder:
  * @store: a #CamelStore object
  * @folder_name: full path of the folder
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Unsubscribe from the folder described by @folder_name.
  *
@@ -1461,7 +1504,7 @@ camel_store_subscribe_folder (CamelStore *store,
 gboolean
 camel_store_unsubscribe_folder (CamelStore *store,
                                 const gchar *folder_name,
-                                CamelException *ex)
+                                GError **error)
 {
 	CamelStoreClass *class;
 	gboolean success;
@@ -1475,7 +1518,8 @@ camel_store_unsubscribe_folder (CamelStore *store,
 
 	camel_store_lock (store, CAMEL_STORE_FOLDER_LOCK);
 
-	success = class->unsubscribe_folder (store, folder_name, ex);
+	success = class->unsubscribe_folder (store, folder_name, error);
+	CAMEL_CHECK_GERROR (store, unsubscribe_folder, success, error);
 
 	if (success)
 		cs_delete_cached_folder (store, folder_name);
@@ -1488,7 +1532,7 @@ camel_store_unsubscribe_folder (CamelStore *store,
 /**
  * camel_store_noop:
  * @store: a #CamelStore object
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Pings @store so that its connection doesn't timeout.
  *
@@ -1496,16 +1540,20 @@ camel_store_unsubscribe_folder (CamelStore *store,
  **/
 gboolean
 camel_store_noop (CamelStore *store,
-                  CamelException *ex)
+                  GError **error)
 {
 	CamelStoreClass *class;
+	gboolean success;
 
 	g_return_val_if_fail (CAMEL_IS_STORE (store), FALSE);
 
 	class = CAMEL_STORE_GET_CLASS (store);
 	g_return_val_if_fail (class->noop != NULL, FALSE);
 
-	return class->noop (store, ex);
+	success = class->noop (store, error);
+	CAMEL_CHECK_GERROR (store, noop, success, error);
+
+	return success;
 }
 
 /**
@@ -1574,7 +1622,7 @@ camel_store_folder_uri_equal (CamelStore *store,
  * camel_store_can_refresh_folder
  * @store: a #CamelStore
  * @info: a #CamelFolderInfo
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Returns if this folder (param info) should be checked for new mail or not.
  * It should not look into sub infos (info->child) or next infos, it should
@@ -1588,7 +1636,7 @@ camel_store_folder_uri_equal (CamelStore *store,
 gboolean
 camel_store_can_refresh_folder (CamelStore *store,
                                 CamelFolderInfo *info,
-                                CamelException *ex)
+                                GError **error)
 {
 	CamelStoreClass *class;
 
@@ -1598,7 +1646,7 @@ camel_store_can_refresh_folder (CamelStore *store,
 	class = CAMEL_STORE_GET_CLASS (store);
 	g_return_val_if_fail (class->can_refresh_folder != NULL, FALSE);
 
-	return class->can_refresh_folder (store, info, ex);
+	return class->can_refresh_folder (store, info, error);
 }
 
 /**
diff --git a/camel/camel-store.h b/camel/camel-store.h
index 2d14c7d..db6a2fd 100644
--- a/camel/camel-store.h
+++ b/camel/camel-store.h
@@ -56,9 +56,27 @@
 	(G_TYPE_INSTANCE_GET_CLASS \
 	((obj), CAMEL_TYPE_STORE, CamelStoreClass))
 
+/**
+ * CAMEL_STORE_ERROR:
+ *
+ * Since: 3.0
+ **/
+#define CAMEL_STORE_ERROR \
+	(camel_store_error_quark ())
+
 G_BEGIN_DECLS
 
 /**
+ * CamelStoreError:
+ *
+ * Since: 3.0
+ **/
+typedef enum {
+	CAMEL_STORE_ERROR_INVALID,
+	CAMEL_STORE_ERROR_NO_FOLDER
+} CamelStoreError;
+
+/**
  * CamelStoreLock:
  *
  * Since: 3.0
@@ -206,48 +224,48 @@ struct _CamelStoreClass {
 	CamelFolder *	(*get_folder)		(CamelStore *store,
 						 const gchar *folder_name,
 						 guint32 flags,
-						 CamelException *ex);
+						 GError **error);
 	CamelFolder *	(*get_inbox)		(CamelStore *store,
-						 CamelException *ex);
+						 GError **error);
 	CamelFolder *	(*get_trash)		(CamelStore *store,
-						 CamelException *ex);
+						 GError **error);
 	CamelFolder *	(*get_junk)		(CamelStore *store,
-						 CamelException *ex);
+						 GError **error);
 	CamelFolderInfo *
 			(*create_folder)	(CamelStore *store,
 						 const gchar *parent_name,
 						 const gchar *folder_name,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*delete_folder)	(CamelStore *store,
 						 const gchar *folder_name,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*rename_folder)	(CamelStore *store,
 						 const gchar *old_name,
 						 const gchar *new_name,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*sync)			(CamelStore *store,
 						 gint expunge,
-						 CamelException *ex);
+						 GError **error);
 	CamelFolderInfo *
 			(*get_folder_info)	(CamelStore *store,
 						 const gchar *top,
 						 guint32 flags,
-						 CamelException *ex);
+						 GError **error);
 	void		(*free_folder_info)	(CamelStore *store,
 						 CamelFolderInfo *fi);
 	gboolean	(*folder_is_subscribed)	(CamelStore *store,
 						 const gchar *folder_name);
 	gboolean	(*subscribe_folder)	(CamelStore *store,
 						 const gchar *folder_name,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*unsubscribe_folder)	(CamelStore *store,
 						 const gchar *folder_name,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*noop)			(CamelStore *store,
-						 CamelException *ex);
+						 GError **error);
 	gboolean	(*can_refresh_folder)	(CamelStore *store,
 						 CamelFolderInfo *info,
-						 CamelException *ex);
+						 GError **error);
 
 	/* Signals */
 	void		(*folder_created)	(CamelStore *store,
@@ -266,28 +284,29 @@ struct _CamelStoreClass {
 };
 
 GType		camel_store_get_type		(void);
+GQuark		camel_store_error_quark		(void) G_GNUC_CONST;
 CamelFolder *	camel_store_get_folder		(CamelStore *store,
 						 const gchar *folder_name,
 						 guint32 flags,
-						 CamelException *ex);
+						 GError **error);
 CamelFolder *	camel_store_get_inbox		(CamelStore *store,
-						 CamelException *ex);
+						 GError **error);
 CamelFolder *	camel_store_get_trash		(CamelStore *store,
-						 CamelException *ex);
+						 GError **error);
 CamelFolder *	camel_store_get_junk		(CamelStore *store,
-						 CamelException *ex);
+						 GError **error);
 CamelFolderInfo *
 		camel_store_create_folder	(CamelStore *store,
 						 const gchar *parent_name,
 						 const gchar *folder_name,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_store_delete_folder	(CamelStore *store,
 						 const gchar *folder_name,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_store_rename_folder	(CamelStore *store,
 						 const gchar *old_namein,
 						 const gchar *new_name,
-						 CamelException *ex);
+						 GError **error);
 void		camel_store_folder_created	(CamelStore *store,
 						 CamelFolderInfo *info);
 void		camel_store_folder_deleted	(CamelStore *store,
@@ -301,12 +320,12 @@ void		camel_store_folder_unsubscribed	(CamelStore *store,
 						 CamelFolderInfo *info);
 gboolean	camel_store_sync		(CamelStore *store,
 						 gint expunge,
-						 CamelException *ex);
+						 GError **error);
 CamelFolderInfo *
 		camel_store_get_folder_info	(CamelStore *store,
 						 const gchar *top,
 						 guint32 flags,
-						 CamelException *ex);
+						 GError **error);
 void		camel_store_free_folder_info	(CamelStore *store,
 						 CamelFolderInfo *fi);
 void		camel_store_free_folder_info_full
@@ -332,18 +351,18 @@ gboolean	camel_store_folder_is_subscribed(CamelStore *store,
 						 const gchar *folder_name);
 gboolean	camel_store_subscribe_folder	(CamelStore *store,
 						 const gchar *folder_name,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_store_unsubscribe_folder	(CamelStore *store,
 						 const gchar *folder_name,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_store_noop		(CamelStore *store,
-						 CamelException *ex);
+						 GError **error);
 gint		camel_store_folder_uri_equal	(CamelStore *store,
 						 const gchar *uri0,
 						 const gchar *uri1);
 gboolean	camel_store_can_refresh_folder	(CamelStore *store,
 						 CamelFolderInfo *info,
-						 CamelException *ex);
+						 GError **error);
 void		camel_store_lock		(CamelStore *store,
 						 CamelStoreLock lock);
 void		camel_store_unlock		(CamelStore *store,
diff --git a/camel/camel-stream-buffer.c b/camel/camel-stream-buffer.c
index 0357bd4..e63513e 100644
--- a/camel/camel-stream-buffer.c
+++ b/camel/camel-stream-buffer.c
@@ -63,12 +63,13 @@ enum {
 static gssize
 stream_write_all (CamelStream *stream,
                   const gchar *buffer,
-                  gsize n)
+                  gsize n,
+                  GError **error)
 {
 	gsize left = n, w;
 
 	while (left > 0) {
-		w = camel_stream_write (stream, buffer, left);
+		w = camel_stream_write (stream, buffer, left, error);
 		if (w == -1)
 			return -1;
 		left -= w;
@@ -140,7 +141,8 @@ stream_buffer_finalize (GObject *object)
 static gssize
 stream_buffer_read (CamelStream *stream,
                     gchar *buffer,
-                    gsize n)
+                    gsize n,
+                    GError **error)
 {
 	CamelStreamBufferPrivate *priv;
 	gssize bytes_read = 1;
@@ -165,7 +167,7 @@ stream_buffer_read (CamelStream *stream,
 			/* if we are reading a lot, then read directly to the destination buffer */
 			if (n >= priv->size/3) {
 				bytes_read = camel_stream_read (
-					priv->stream, bptr, n);
+					priv->stream, bptr, n, error);
 				if (bytes_read>0) {
 					n -= bytes_read;
 					bptr += bytes_read;
@@ -173,7 +175,7 @@ stream_buffer_read (CamelStream *stream,
 			} else {
 				bytes_read = camel_stream_read (
 					priv->stream, (gchar *)
-					priv->buf, priv->size);
+					priv->buf, priv->size, error);
 				if (bytes_read>0) {
 					gsize bytes_used = bytes_read > n ? n : bytes_read;
 					priv->ptr = priv->buf;
@@ -198,7 +200,8 @@ stream_buffer_read (CamelStream *stream,
 static gssize
 stream_buffer_write (CamelStream *stream,
                      const gchar *buffer,
-                     gsize n)
+                     gsize n,
+                     GError **error)
 {
 	CamelStreamBufferPrivate *priv;
 	gssize total = n;
@@ -223,7 +226,7 @@ stream_buffer_write (CamelStream *stream,
 	if (left == todo) {
 		if (stream_write_all (
 			priv->stream, (gchar *) priv->buf,
-			priv->size) == -1)
+			priv->size, error) == -1)
 			return -1;
 
 		priv->ptr = priv->buf;
@@ -233,7 +236,7 @@ stream_buffer_write (CamelStream *stream,
 	if (n > 0) {
 		if (n >= priv->size/3) {
 			if (stream_write_all (
-				priv->stream, buffer, n) == -1)
+				priv->stream, buffer, n, error) == -1)
 				return -1;
 		} else {
 			memcpy(priv->ptr, buffer, n);
@@ -245,7 +248,8 @@ stream_buffer_write (CamelStream *stream,
 }
 
 static gint
-stream_buffer_flush (CamelStream *stream)
+stream_buffer_flush (CamelStream *stream,
+                     GError **error)
 {
 	CamelStreamBufferPrivate *priv;
 
@@ -255,7 +259,7 @@ stream_buffer_flush (CamelStream *stream)
 		gsize len = priv->ptr - priv->buf;
 
 		if (camel_stream_write (
-			priv->stream, (gchar *) priv->buf, len) == -1)
+			priv->stream, (gchar *) priv->buf, len, error) == -1)
 			return -1;
 
 		priv->ptr = priv->buf;
@@ -263,20 +267,21 @@ stream_buffer_flush (CamelStream *stream)
 		/* nothing to do for read mode 'flush' */
 	}
 
-	return camel_stream_flush (priv->stream);
+	return camel_stream_flush (priv->stream, error);
 }
 
 static gint
-stream_buffer_close (CamelStream *stream)
+stream_buffer_close (CamelStream *stream,
+                     GError **error)
 {
 	CamelStreamBufferPrivate *priv;
 
 	priv = CAMEL_STREAM_BUFFER_GET_PRIVATE (stream);
 
-	if (stream_buffer_flush (stream) == -1)
+	if (stream_buffer_flush (stream, error) == -1)
 		return -1;
 
-	return camel_stream_close (priv->stream);
+	return camel_stream_close (priv->stream, error);
 }
 
 static gboolean
@@ -452,6 +457,7 @@ camel_stream_buffer_new_with_vbuf (CamelStream *stream,
  * @sbf: a #CamelStreamBuffer object
  * @buf: Memory to write the string to.
  * @max: Maxmimum number of characters to store.
+ * @error: return location for a #GError, or %NULL
  *
  * Read a line of characters up to the next newline character or
  * @max-1 characters.
@@ -465,7 +471,8 @@ camel_stream_buffer_new_with_vbuf (CamelStream *stream,
 gint
 camel_stream_buffer_gets (CamelStreamBuffer *sbf,
                           gchar *buf,
-                          guint max)
+                          guint max,
+                          GError **error)
 {
 	register gchar *outptr, *inptr, *inend, c, *outend;
 	gint bytes_read;
@@ -490,7 +497,7 @@ camel_stream_buffer_gets (CamelStreamBuffer *sbf,
 
 		bytes_read = camel_stream_read (
 			sbf->priv->stream, (gchar *)
-			sbf->priv->buf, sbf->priv->size);
+			sbf->priv->buf, sbf->priv->size, error);
 		if (bytes_read == -1) {
 			if (buf == outptr)
 				return -1;
@@ -512,16 +519,18 @@ camel_stream_buffer_gets (CamelStreamBuffer *sbf,
 /**
  * camel_stream_buffer_read_line:
  * @sbf: a #CamelStreamBuffer object
+ * @error: return location for a @GError, or %NULL
  *
  * This function reads a complete newline-terminated line from the stream
  * and returns it in allocated memory. The trailing newline (and carriage
  * return if any) are not included in the returned string.
  *
  * Returns: the line read, which the caller must free when done with,
- * or %NULL on eof. If an error occurs, @ex will be set.
+ * or %NULL on eof. If an error occurs, @error will be set.
  **/
 gchar *
-camel_stream_buffer_read_line (CamelStreamBuffer *sbf)
+camel_stream_buffer_read_line (CamelStreamBuffer *sbf,
+                               GError **error)
 {
 	guchar *p;
 	gint nread;
@@ -531,7 +540,7 @@ camel_stream_buffer_read_line (CamelStreamBuffer *sbf)
 	while (1) {
 		nread = camel_stream_buffer_gets (
 			sbf, (gchar *) p, sbf->priv->linesize -
-			(p - sbf->priv->linebuf));
+			(p - sbf->priv->linebuf), error);
 		if (nread <=0) {
 			if (p > sbf->priv->linebuf)
 				break;
diff --git a/camel/camel-stream-buffer.h b/camel/camel-stream-buffer.h
index ad591a9..c1d82d6 100644
--- a/camel/camel-stream-buffer.h
+++ b/camel/camel-stream-buffer.h
@@ -94,8 +94,10 @@ CamelStream *	camel_stream_buffer_new_with_vbuf
 						 guint32 size);
 gint		camel_stream_buffer_gets	(CamelStreamBuffer *sbf,
 						 gchar *buf,
-						 guint max);
-gchar *		camel_stream_buffer_read_line	(CamelStreamBuffer *sbf);
+						 guint max,
+						 GError **error);
+gchar *		camel_stream_buffer_read_line	(CamelStreamBuffer *sbf,
+						 GError **error);
 
 G_END_DECLS
 
diff --git a/camel/camel-stream-filter.c b/camel/camel-stream-filter.c
index d501e92..7d2eadf 100644
--- a/camel/camel-stream-filter.c
+++ b/camel/camel-stream-filter.c
@@ -23,6 +23,7 @@
 #include <config.h>
 #endif
 
+#include <errno.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -90,7 +91,8 @@ stream_filter_finalize (GObject *object)
 static gssize
 stream_filter_read (CamelStream *stream,
                     gchar *buffer,
-                    gsize n)
+                    gsize n,
+                    GError **error)
 {
 	CamelStreamFilterPrivate *priv;
 	gssize size;
@@ -106,7 +108,7 @@ stream_filter_read (CamelStream *stream,
 		gsize presize = READ_PAD;
 
 		size = camel_stream_read (
-			priv->source, priv->buffer, READ_SIZE);
+			priv->source, priv->buffer, READ_SIZE, error);
 		if (size <= 0) {
 			/* this is somewhat untested */
 			if (camel_stream_eos(priv->source)) {
@@ -165,7 +167,8 @@ stream_filter_read (CamelStream *stream,
 static gssize
 stream_filter_write (CamelStream *stream,
                      const gchar *buf,
-                     gsize n)
+                     gsize n,
+                     GError **error)
 {
 	CamelStreamFilterPrivate *priv;
 	struct _filter *f;
@@ -204,7 +207,7 @@ stream_filter_write (CamelStream *stream,
 			f = f->next;
 		}
 
-		if (camel_stream_write (priv->source, buffer, len) != len)
+		if (camel_stream_write (priv->source, buffer, len, error) != len)
 			return -1;
 	}
 
@@ -214,7 +217,8 @@ stream_filter_write (CamelStream *stream,
 }
 
 static gint
-stream_filter_flush (CamelStream *stream)
+stream_filter_flush (CamelStream *stream,
+                     GError **error)
 {
 	CamelStreamFilterPrivate *priv;
 	struct _filter *f;
@@ -246,23 +250,26 @@ stream_filter_flush (CamelStream *stream)
 		f = f->next;
 	}
 
-	if (len > 0 && camel_stream_write (priv->source, buffer, len) == -1)
+	if (len > 0 && camel_stream_write (priv->source, buffer, len, error) == -1)
 		return -1;
 
-	return camel_stream_flush (priv->source);
+	return camel_stream_flush (priv->source, error);
 }
 
 static gint
-stream_filter_close (CamelStream *stream)
+stream_filter_close (CamelStream *stream,
+                     GError **error)
 {
 	CamelStreamFilterPrivate *priv;
 
 	priv = CAMEL_STREAM_FILTER_GET_PRIVATE (stream);
 
-	if (!priv->last_was_read)
-		stream_filter_flush (stream);
+	if (!priv->last_was_read) {
+		if (stream_filter_flush (stream, error) == -1)
+			return -1;
+	}
 
-	return camel_stream_close (priv->source);
+	return camel_stream_close (priv->source, error);
 }
 
 static gboolean
@@ -282,7 +289,8 @@ stream_filter_eos (CamelStream *stream)
 }
 
 static gint
-stream_filter_reset (CamelStream *stream)
+stream_filter_reset (CamelStream *stream,
+                     GError **error)
 {
 	CamelStreamFilterPrivate *priv;
 	struct _filter *f;
@@ -299,7 +307,7 @@ stream_filter_reset (CamelStream *stream)
 		f = f->next;
 	}
 
-	return camel_stream_reset (priv->source);
+	return camel_stream_reset (priv->source, error);
 }
 
 static void
diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c
index ab46e4d..8813b12 100644
--- a/camel/camel-stream-fs.c
+++ b/camel/camel-stream-fs.c
@@ -66,7 +66,8 @@ stream_fs_finalize (GObject *object)
 static gssize
 stream_fs_read (CamelStream *stream,
                 gchar *buffer,
-                gsize n)
+                gsize n,
+                GError **error)
 {
 	CamelStreamFsPrivate *priv;
 	CamelSeekableStream *seekable;
@@ -78,7 +79,7 @@ stream_fs_read (CamelStream *stream,
 	if (seekable->bound_end != CAMEL_STREAM_UNBOUND)
 		n = MIN (seekable->bound_end - seekable->position, n);
 
-	if ((nread = camel_read (priv->fd, buffer, n)) > 0)
+	if ((nread = camel_read (priv->fd, buffer, n, error)) > 0)
 		seekable->position += nread;
 	else if (nread == 0)
 		stream->eos = TRUE;
@@ -89,7 +90,8 @@ stream_fs_read (CamelStream *stream,
 static gssize
 stream_fs_write (CamelStream *stream,
                  const gchar *buffer,
-                 gsize n)
+                 gsize n,
+                 GError **error)
 {
 	CamelStreamFsPrivate *priv;
 	CamelSeekableStream *seekable;
@@ -101,31 +103,46 @@ stream_fs_write (CamelStream *stream,
 	if (seekable->bound_end != CAMEL_STREAM_UNBOUND)
 		n = MIN (seekable->bound_end - seekable->position, n);
 
-	if ((nwritten = camel_write (priv->fd, buffer, n)) > 0)
+	if ((nwritten = camel_write (priv->fd, buffer, n, error)) > 0)
 		seekable->position += nwritten;
 
 	return nwritten;
 }
 
 static gint
-stream_fs_flush (CamelStream *stream)
+stream_fs_flush (CamelStream *stream,
+                 GError **error)
 {
 	CamelStreamFsPrivate *priv;
 
 	priv = CAMEL_STREAM_FS_GET_PRIVATE (stream);
 
-	return fsync (priv->fd);
+	if (fsync (priv->fd) == -1) {
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			"%s", g_strerror (errno));
+		return -1;
+	}
+
+	return 0;
 }
 
 static gint
-stream_fs_close (CamelStream *stream)
+stream_fs_close (CamelStream *stream,
+                 GError **error)
 {
 	CamelStreamFsPrivate *priv;
 
 	priv = CAMEL_STREAM_FS_GET_PRIVATE (stream);
 
-	if (close (priv->fd) == -1)
+	if (close (priv->fd) == -1) {
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			"%s", g_strerror (errno));
 		return -1;
+	}
 
 	priv->fd = -1;
 
@@ -135,7 +152,8 @@ stream_fs_close (CamelStream *stream)
 static off_t
 stream_fs_seek (CamelSeekableStream *stream,
                 off_t offset,
-                CamelStreamSeekPolicy policy)
+                CamelStreamSeekPolicy policy,
+                GError **error)
 {
 	CamelStreamFsPrivate *priv;
 	off_t real = 0;
@@ -156,7 +174,11 @@ stream_fs_seek (CamelSeekableStream *stream,
 				if (real<stream->bound_start)
 					real = stream->bound_start;
 				stream->position = real;
-			}
+			} else
+				g_set_error (
+					error, G_IO_ERROR,
+					g_io_error_from_errno (errno),
+					"%s", g_strerror (errno));
 			return real;
 		}
 		real = stream->bound_end + offset;
@@ -168,8 +190,13 @@ stream_fs_seek (CamelSeekableStream *stream,
 	real = MAX (real, stream->bound_start);
 
 	real = lseek(priv->fd, real, SEEK_SET);
-	if (real == -1)
+	if (real == -1) {
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			"%s", g_strerror (errno));
 		return -1;
+	}
 
 	if (real != stream->position && ((CamelStream *)stream)->eos)
 		((CamelStream *)stream)->eos = FALSE;
@@ -256,13 +283,14 @@ camel_stream_fs_new_with_fd (gint fd)
 CamelStream *
 camel_stream_fs_new_with_fd_and_bounds (gint fd,
                                         off_t start,
-                                        off_t end)
+                                        off_t end,
+                                        GError **error)
 {
 	CamelStream *stream;
 
 	stream = camel_stream_fs_new_with_fd (fd);
 	camel_seekable_stream_set_bounds (
-		CAMEL_SEEKABLE_STREAM (stream), start, end);
+		CAMEL_SEEKABLE_STREAM (stream), start, end, error);
 
 	return stream;
 }
@@ -272,6 +300,7 @@ camel_stream_fs_new_with_fd_and_bounds (gint fd,
  * @name: a local filename
  * @flags: flags as in open(2)
  * @mode: a file mode
+ * @error: return location for a #GError, or %NULL
  *
  * Creates a new #CamelStreamFs corresponding to the named file, flags,
  * and mode.
@@ -281,13 +310,19 @@ camel_stream_fs_new_with_fd_and_bounds (gint fd,
 CamelStream *
 camel_stream_fs_new_with_name (const gchar *name,
                                gint flags,
-                               mode_t mode)
+                               mode_t mode,
+                               GError **error)
 {
 	gint fd;
 
 	fd = g_open (name, flags|O_BINARY, mode);
-	if (fd == -1)
+	if (fd == -1) {
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			"%s", g_strerror (errno));
 		return NULL;
+	}
 
 	return camel_stream_fs_new_with_fd (fd);
 }
@@ -299,6 +334,7 @@ camel_stream_fs_new_with_name (const gchar *name,
  * @mode: a file mode
  * @start: the first valid position in the file
  * @end: the first invalid position in the file, or #CAMEL_STREAM_UNBOUND
+ * @error: return location for a #GError, or %NULL
  *
  * Creates a new CamelStream corresponding to the given arguments.
  *
@@ -309,17 +345,24 @@ camel_stream_fs_new_with_name_and_bounds (const gchar *name,
                                           gint flags,
                                           mode_t mode,
                                           off_t start,
-                                          off_t end)
+                                          off_t end,
+                                          GError **error)
 {
 	CamelStream *stream;
+	gint retval;
 
-	stream = camel_stream_fs_new_with_name (name, flags, mode);
+	stream = camel_stream_fs_new_with_name (name, flags, mode, error);
 	if (stream == NULL)
 		return NULL;
 
-	camel_seekable_stream_set_bounds (
+	retval = camel_seekable_stream_set_bounds (
 		CAMEL_SEEKABLE_STREAM (stream),
-		start, end);
+		start, end, error);
+
+	if (retval == -1) {
+		g_object_unref (stream);
+		stream = NULL;
+	}
 
 	return stream;
 }
diff --git a/camel/camel-stream-fs.h b/camel/camel-stream-fs.h
index d8a7dda..3250713 100644
--- a/camel/camel-stream-fs.h
+++ b/camel/camel-stream-fs.h
@@ -73,18 +73,21 @@ struct _CamelStreamFsClass {
 GType		camel_stream_fs_get_type	(void);
 CamelStream *	camel_stream_fs_new_with_name	(const gchar *name,
 						 gint flags,
-						 mode_t mode);
+						 mode_t mode,
+						 GError **error);
 CamelStream *	camel_stream_fs_new_with_name_and_bounds
 						(const gchar *name,
 						 gint flags,
 						 mode_t mode,
 						 off_t start,
-						 off_t end);
+						 off_t end,
+						 GError **error);
 CamelStream *	camel_stream_fs_new_with_fd	(gint fd);
 CamelStream *	camel_stream_fs_new_with_fd_and_bounds
 						(gint fd,
 						 off_t start,
-						 off_t end);
+						 off_t end,
+						 GError **error);
 gint		camel_stream_fs_get_fd		(CamelStreamFs *stream);
 
 G_END_DECLS
diff --git a/camel/camel-stream-mem.c b/camel/camel-stream-mem.c
index 0372098..37c4524 100644
--- a/camel/camel-stream-mem.c
+++ b/camel/camel-stream-mem.c
@@ -88,7 +88,8 @@ stream_mem_finalize (GObject *object)
 static gssize
 stream_mem_read (CamelStream *stream,
                  gchar *buffer,
-                 gsize n)
+                 gsize n,
+                 GError **error)
 {
 	CamelStreamMemPrivate *priv;
 	CamelSeekableStream *seekable = CAMEL_SEEKABLE_STREAM (stream);
@@ -112,7 +113,8 @@ stream_mem_read (CamelStream *stream,
 static gssize
 stream_mem_write (CamelStream *stream,
                   const gchar *buffer,
-                  gsize n)
+                  gsize n,
+                  GError **error)
 {
 	CamelStreamMemPrivate *priv;
 	CamelSeekableStream *seekable = CAMEL_SEEKABLE_STREAM (stream);
@@ -149,7 +151,8 @@ stream_mem_eos (CamelStream *stream)
 static off_t
 stream_mem_seek (CamelSeekableStream *stream,
                  off_t offset,
-                 CamelStreamSeekPolicy policy)
+                 CamelStreamSeekPolicy policy,
+                 GError **error)
 {
 	CamelStreamMemPrivate *priv;
 	off_t position;
diff --git a/camel/camel-stream-null.c b/camel/camel-stream-null.c
index 8c3bcb3..d94f921 100644
--- a/camel/camel-stream-null.c
+++ b/camel/camel-stream-null.c
@@ -33,7 +33,8 @@ G_DEFINE_TYPE (CamelStreamNull, camel_stream_null, CAMEL_TYPE_STREAM)
 static gssize
 stream_null_write (CamelStream *stream,
                    const gchar *buffer,
-                   gsize n)
+                   gsize n,
+                   GError **error)
 {
 	CAMEL_STREAM_NULL (stream)->written += n;
 
@@ -47,7 +48,8 @@ stream_null_eos (CamelStream *stream)
 }
 
 static gint
-stream_null_reset (CamelStream *stream)
+stream_null_reset (CamelStream *stream,
+                   GError **error)
 {
 	CAMEL_STREAM_NULL (stream)->written = 0;
 
diff --git a/camel/camel-stream-process.c b/camel/camel-stream-process.c
index 0a11498..f550440 100644
--- a/camel/camel-stream-process.c
+++ b/camel/camel-stream-process.c
@@ -51,7 +51,7 @@ stream_process_finalize (GObject *object)
 {
 	/* Ensure we clean up after ourselves -- kill
 	   the child process and reap it. */
-	camel_stream_close (CAMEL_STREAM (object));
+	camel_stream_close (CAMEL_STREAM (object), NULL);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (camel_stream_process_parent_class)->finalize (object);
@@ -60,25 +60,28 @@ stream_process_finalize (GObject *object)
 static gssize
 stream_process_read (CamelStream *stream,
                      gchar *buffer,
-                     gsize n)
+                     gsize n,
+                     GError **error)
 {
 	CamelStreamProcess *stream_process = CAMEL_STREAM_PROCESS (stream);
 
-	return camel_read (stream_process->sockfd, buffer, n);
+	return camel_read (stream_process->sockfd, buffer, n, error);
 }
 
 static gssize
 stream_process_write (CamelStream *stream,
                       const gchar *buffer,
-                      gsize n)
+                      gsize n,
+                      GError **error)
 {
 	CamelStreamProcess *stream_process = CAMEL_STREAM_PROCESS (stream);
 
-	return camel_write (stream_process->sockfd, buffer, n);
+	return camel_write (stream_process->sockfd, buffer, n, error);
 }
 
 static gint
-stream_process_close (CamelStream *object)
+stream_process_close (CamelStream *object,
+                      GError **error)
 {
 	CamelStreamProcess *stream = CAMEL_STREAM_PROCESS (object);
 
@@ -127,7 +130,8 @@ stream_process_close (CamelStream *object)
 }
 
 static gint
-stream_process_flush (CamelStream *stream)
+stream_process_flush (CamelStream *stream,
+                      GError **error)
 {
 	return 0;
 }
@@ -224,7 +228,7 @@ camel_stream_process_connect (CamelStreamProcess *stream,
 	g_return_val_if_fail (command != NULL, -1);
 
 	if (stream->sockfd != -1 || stream->childpid)
-		camel_stream_close (CAMEL_STREAM (stream));
+		camel_stream_close (CAMEL_STREAM (stream), NULL);
 
 	if (socketpair (AF_UNIX, SOCK_STREAM, 0, sockfds))
 		return -1;
diff --git a/camel/camel-stream-vfs.c b/camel/camel-stream-vfs.c
index 13d6194..eb46c13 100644
--- a/camel/camel-stream-vfs.c
+++ b/camel/camel-stream-vfs.c
@@ -53,23 +53,22 @@ stream_vfs_dispose (GObject *object)
 static gssize
 stream_vfs_read (CamelStream *stream,
                  gchar *buffer,
-                 gsize n)
+                 gsize n,
+                 GError **error)
 {
 	CamelStreamVFS *stream_vfs = CAMEL_STREAM_VFS (stream);
 	gssize nread;
-	GError *error = NULL;
+	GError *local_error = NULL;
 
 	nread = g_input_stream_read (
 		G_INPUT_STREAM (stream_vfs->stream),
-		buffer, n, NULL, &error);
+		buffer, n, NULL, &local_error);
 
-	if (nread == 0 || error != NULL)
+	if (nread == 0 || local_error != NULL)
 		stream->eos = TRUE;
 
-	if (error) {
-		g_warning ("%s", error->message);
-		g_error_free (error);
-	}
+	if (local_error != NULL)
+		g_propagate_error (error, local_error);
 
 	return nread;
 }
@@ -77,61 +76,46 @@ stream_vfs_read (CamelStream *stream,
 static gssize
 stream_vfs_write (CamelStream *stream,
                   const gchar *buffer,
-                  gsize n)
+                  gsize n,
+                  GError **error)
 {
 	CamelStreamVFS *stream_vfs = CAMEL_STREAM_VFS (stream);
 	gboolean success;
 	gsize bytes_written;
-	GError *error = NULL;
 
 	success = g_output_stream_write_all (
 		G_OUTPUT_STREAM (stream_vfs->stream),
-		buffer, n, &bytes_written, NULL, &error);
-
-	if (error) {
-		g_warning ("%s", error->message);
-		g_error_free (error);
-	}
+		buffer, n, &bytes_written, NULL, error);
 
 	return success ? bytes_written : -1;
 }
 
 static gint
-stream_vfs_flush (CamelStream *stream)
+stream_vfs_flush (CamelStream *stream,
+                  GError **error)
 {
 	CamelStreamVFS *stream_vfs = CAMEL_STREAM_VFS (stream);
 	gboolean success;
-	GError *error = NULL;
 
 	success = g_output_stream_flush (
-		G_OUTPUT_STREAM (stream_vfs->stream), NULL, &error);
-
-	if (error) {
-		g_warning ("%s", error->message);
-		g_error_free (error);
-	}
+		G_OUTPUT_STREAM (stream_vfs->stream), NULL, error);
 
 	return success ? 0 : -1;
 }
 
 static gint
-stream_vfs_close (CamelStream *stream)
+stream_vfs_close (CamelStream *stream,
+                  GError **error)
 {
 	CamelStreamVFS *stream_vfs = CAMEL_STREAM_VFS (stream);
 	gboolean success;
-	GError *error = NULL;
 
 	if (G_IS_OUTPUT_STREAM (stream_vfs->stream))
 		success = g_output_stream_close (
-			G_OUTPUT_STREAM (stream_vfs->stream), NULL, &error);
+			G_OUTPUT_STREAM (stream_vfs->stream), NULL, error);
 	else
 		success = g_input_stream_close (
-			G_INPUT_STREAM (stream_vfs->stream), NULL, &error);
-
-	if (error) {
-		g_warning ("%s", error->message);
-		g_error_free (error);
-	}
+			G_INPUT_STREAM (stream_vfs->stream), NULL, error);
 
 	if (success) {
 		g_object_unref (stream_vfs->stream);
diff --git a/camel/camel-stream.c b/camel/camel-stream.c
index 27f1ee2..38848b4 100644
--- a/camel/camel-stream.c
+++ b/camel/camel-stream.c
@@ -26,8 +26,10 @@
 #include <config.h>
 #endif
 
+#include <errno.h>
 #include <string.h>
 
+#include "camel-debug.h"
 #include "camel-stream.h"
 
 G_DEFINE_ABSTRACT_TYPE (CamelStream, camel_stream, CAMEL_TYPE_OBJECT)
@@ -35,7 +37,8 @@ G_DEFINE_ABSTRACT_TYPE (CamelStream, camel_stream, CAMEL_TYPE_OBJECT)
 static gssize
 stream_read (CamelStream *stream,
              gchar *buffer,
-             gsize n)
+             gsize n,
+             GError **error)
 {
 	return 0;
 }
@@ -43,19 +46,22 @@ stream_read (CamelStream *stream,
 static gssize
 stream_write (CamelStream *stream,
               const gchar *buffer,
-              gsize n)
+              gsize n,
+              GError **error)
 {
 	return n;
 }
 
 static gint
-stream_close (CamelStream *stream)
+stream_close (CamelStream *stream,
+              GError **error)
 {
 	return 0;
 }
 
 static gint
-stream_flush (CamelStream *stream)
+stream_flush (CamelStream *stream,
+              GError **error)
 {
 	return 0;
 }
@@ -67,7 +73,8 @@ stream_eos (CamelStream *stream)
 }
 
 static gint
-stream_reset (CamelStream *stream)
+stream_reset (CamelStream *stream,
+              GError **error)
 {
 	return 0;
 }
@@ -93,6 +100,7 @@ camel_stream_init (CamelStream *stream)
  * @stream: a #CamelStream object.
  * @buffer: output buffer
  * @n: max number of bytes to read.
+ * @error: return location for a #GError, or %NULL
  *
  * Attempts to read up to @len bytes from @stream into @buf.
  *
@@ -102,9 +110,11 @@ camel_stream_init (CamelStream *stream)
 gssize
 camel_stream_read (CamelStream *stream,
                    gchar *buffer,
-                   gsize n)
+                   gsize n,
+                   GError **error)
 {
 	CamelStreamClass *class;
+	gssize n_bytes;
 
 	g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
 	g_return_val_if_fail (n == 0 || buffer, -1);
@@ -112,7 +122,10 @@ camel_stream_read (CamelStream *stream,
 	class = CAMEL_STREAM_GET_CLASS (stream);
 	g_return_val_if_fail (class->read != NULL, -1);
 
-	return class->read (stream, buffer, n);
+	n_bytes = class->read (stream, buffer, n, error);
+	CAMEL_CHECK_GERROR (stream, read, n_bytes >= 0, error);
+
+	return n_bytes;
 }
 
 /**
@@ -120,6 +133,7 @@ camel_stream_read (CamelStream *stream,
  * @stream: a #CamelStream object
  * @buffer: buffer to write.
  * @n: number of bytes to write
+ * @error: return location for a #GError, or %NULL
  *
  * Attempts to write up to @n bytes of @buffer into @stream.
  *
@@ -129,9 +143,11 @@ camel_stream_read (CamelStream *stream,
 gssize
 camel_stream_write (CamelStream *stream,
                     const gchar *buffer,
-                    gsize n)
+                    gsize n,
+                    GError **error)
 {
 	CamelStreamClass *class;
+	gssize n_bytes;
 
 	g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
 	g_return_val_if_fail (n == 0 || buffer, -1);
@@ -139,50 +155,65 @@ camel_stream_write (CamelStream *stream,
 	class = CAMEL_STREAM_GET_CLASS (stream);
 	g_return_val_if_fail (class->write != NULL, -1);
 
-	return class->write (stream, buffer, n);
+	n_bytes = class->write (stream, buffer, n, error);
+	CAMEL_CHECK_GERROR (stream, write, n_bytes >= 0, error);
+
+	return n_bytes;
 }
 
 /**
  * camel_stream_flush:
  * @stream: a #CamelStream object
+ * @error: return location for a #GError, or %NULL
  *
  * Flushes any buffered data to the stream's backing store.  Only
  * meaningful for writable streams.
  *
- * Returns: %0 on success or %-1 on fail along with setting errno.
+ * Returns: %0 on success or %-1 on fail along with setting @error
  **/
 gint
-camel_stream_flush (CamelStream *stream)
+camel_stream_flush (CamelStream *stream,
+                    GError **error)
 {
 	CamelStreamClass *class;
+	gint retval;
 
 	g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
 
 	class = CAMEL_STREAM_GET_CLASS (stream);
 	g_return_val_if_fail (class->flush != NULL, -1);
 
-	return class->flush (stream);
+	retval = class->flush (stream, error);
+	CAMEL_CHECK_GERROR (stream, flush, retval == 0, error);
+
+	return retval;
 }
 
 /**
  * camel_stream_close:
  * @stream: a #CamelStream object
+ * @error: return location for a #GError, or %NULL
  *
  * Closes the stream.
  *
  * Returns: %0 on success or %-1 on error.
  **/
 gint
-camel_stream_close (CamelStream *stream)
+camel_stream_close (CamelStream *stream,
+                    GError **error)
 {
 	CamelStreamClass *class;
+	gint retval;
 
 	g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
 
 	class = CAMEL_STREAM_GET_CLASS (stream);
 	g_return_val_if_fail (class->close != NULL, -1);
 
-	return class->close (stream);
+	retval = class->close (stream, error);
+	CAMEL_CHECK_GERROR (stream, close, retval == 0, error);
+
+	return retval;
 }
 
 /**
@@ -209,24 +240,30 @@ camel_stream_eos (CamelStream *stream)
 /**
  * camel_stream_reset:
  * @stream: a #CamelStream object
+ * @error: return location for a #GError, or %NULL
  *
  * Resets the stream. That is, put it in a state where it can be read
  * from the beginning again. Not all streams in Camel are seekable,
  * but they must all be resettable.
  *
- * Returns: %0 on success or %-1 on error along with setting errno.
+ * Returns: %0 on success or %-1 on error along with setting @error.
  **/
 gint
-camel_stream_reset (CamelStream *stream)
+camel_stream_reset (CamelStream *stream,
+                    GError **error)
 {
 	CamelStreamClass *class;
+	gint retval;
 
 	g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
 
 	class = CAMEL_STREAM_GET_CLASS (stream);
 	g_return_val_if_fail (class->reset != NULL, -1);
 
-	return class->reset (stream);
+	retval = class->reset (stream, error);
+	CAMEL_CHECK_GERROR (stream, reset, retval == 0, error);
+
+	return retval;
 }
 
 /***************** Utility functions ********************/
@@ -235,6 +272,7 @@ camel_stream_reset (CamelStream *stream)
  * camel_stream_write_string:
  * @stream: a #CamelStream object
  * @string: a string
+ * @error: return location for a #GError, or %NULL
  *
  * Writes the string to the stream.
  *
@@ -242,9 +280,13 @@ camel_stream_reset (CamelStream *stream)
  **/
 gssize
 camel_stream_write_string (CamelStream *stream,
-                           const gchar *string)
+                           const gchar *string,
+                           GError **error)
 {
-	return camel_stream_write (stream, string, strlen (string));
+	g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
+	g_return_val_if_fail (string != NULL, -1);
+
+	return camel_stream_write (stream, string, strlen (string), error);
 }
 
 /**
@@ -274,7 +316,7 @@ camel_stream_printf (CamelStream *stream,
 	if (string == NULL)
 		return -1;
 
-	ret = camel_stream_write (stream, string, strlen (string));
+	ret = camel_stream_write (stream, string, strlen (string), NULL);
 	g_free (string);
 
 	return ret;
@@ -284,6 +326,7 @@ camel_stream_printf (CamelStream *stream,
  * camel_stream_write_to_stream:
  * @stream: source #CamelStream object
  * @output_stream: destination #CamelStream object
+ * @error: return location for a #GError, or %NULL
  *
  * Write all of a stream (until eos) into another stream, in a
  * blocking fashion.
@@ -293,7 +336,8 @@ camel_stream_printf (CamelStream *stream,
  **/
 gssize
 camel_stream_write_to_stream (CamelStream *stream,
-                              CamelStream *output_stream)
+                              CamelStream *output_stream,
+                              GError **error)
 {
 	gchar tmp_buf[4096];
 	gssize total = 0;
@@ -305,7 +349,7 @@ camel_stream_write_to_stream (CamelStream *stream,
 
 	while (!camel_stream_eos (stream)) {
 		nb_read = camel_stream_read (
-			stream, tmp_buf, sizeof (tmp_buf));
+			stream, tmp_buf, sizeof (tmp_buf), error);
 		if (nb_read < 0)
 			return -1;
 		else if (nb_read > 0) {
@@ -314,7 +358,7 @@ camel_stream_write_to_stream (CamelStream *stream,
 			while (nb_written < nb_read) {
 				gssize len = camel_stream_write (
 					output_stream, tmp_buf + nb_written,
-					nb_read - nb_written);
+					nb_read - nb_written, error);
 				if (len < 0)
 					return -1;
 				nb_written += len;
diff --git a/camel/camel-stream.h b/camel/camel-stream.h
index 2867e0c..3dac147 100644
--- a/camel/camel-stream.h
+++ b/camel/camel-stream.h
@@ -68,31 +68,42 @@ struct _CamelStreamClass {
 
 	gssize		(*read)			(CamelStream *stream,
 						 gchar *buffer,
-						 gsize n);
+						 gsize n,
+						 GError **error);
 	gssize		(*write)		(CamelStream *stream,
 						 const gchar *buffer,
-						 gsize n);
-	gint		(*close)		(CamelStream *stream);
-	gint		(*flush)		(CamelStream *stream);
+						 gsize n,
+						 GError **error);
+	gint		(*close)		(CamelStream *stream,
+						 GError **error);
+	gint		(*flush)		(CamelStream *stream,
+						 GError **error);
 	gboolean	(*eos)			(CamelStream *stream);
-	gint		(*reset)		(CamelStream *stream);
+	gint		(*reset)		(CamelStream *stream,
+						 GError **error);
 };
 
 GType		camel_stream_get_type		(void);
 gssize		camel_stream_read		(CamelStream *stream,
 						 gchar *buffer,
-						 gsize n);
+						 gsize n,
+						 GError **error);
 gssize		camel_stream_write		(CamelStream *stream,
 						 const gchar *buffer,
-						 gsize n);
-gint		camel_stream_flush		(CamelStream *stream);
-gint		camel_stream_close		(CamelStream *stream);
+						 gsize n,
+						 GError **error);
+gint		camel_stream_flush		(CamelStream *stream,
+						 GError **error);
+gint		camel_stream_close		(CamelStream *stream,
+						 GError **error);
 gboolean	camel_stream_eos		(CamelStream *stream);
-gint		camel_stream_reset		(CamelStream *stream);
+gint		camel_stream_reset		(CamelStream *stream,
+						 GError **error);
 
 /* utility macros and funcs */
 gssize		camel_stream_write_string	(CamelStream *stream,
-						 const gchar *string);
+						 const gchar *string,
+						 GError **error);
 gssize		camel_stream_printf		(CamelStream *stream,
 						 const gchar *fmt,
 						 ...) G_GNUC_PRINTF (2, 3);
@@ -103,7 +114,8 @@ gssize		camel_stream_vprintf		(CamelStream *stream,
 /* Write a whole stream to another stream, until eof or error on
  * either stream.  */
 gssize		camel_stream_write_to_stream	(CamelStream *stream,
-						 CamelStream *output_stream);
+						 CamelStream *output_stream,
+						 GError **error);
 
 G_END_DECLS
 
diff --git a/camel/camel-tcp-stream-raw.c b/camel/camel-tcp-stream-raw.c
index a41156f..ff07048 100644
--- a/camel/camel-tcp-stream-raw.c
+++ b/camel/camel-tcp-stream-raw.c
@@ -340,34 +340,43 @@ tcp_stream_raw_finalize (GObject *object)
 static gssize
 tcp_stream_raw_read (CamelStream *stream,
                      gchar *buffer,
-                     gsize n)
+                     gsize n,
+                     GError **error)
 {
 	CamelTcpStreamRaw *raw = CAMEL_TCP_STREAM_RAW (stream);
 
-	return camel_read_socket (raw->sockfd, buffer, n);
+	return camel_read_socket (raw->sockfd, buffer, n, error);
 }
 
 static gssize
 tcp_stream_raw_write (CamelStream *stream,
                       const gchar *buffer,
-                      gsize n)
+                      gsize n,
+                      GError **error)
 {
 	CamelTcpStreamRaw *raw = CAMEL_TCP_STREAM_RAW (stream);
 
-	return camel_write_socket (raw->sockfd, buffer, n);
+	return camel_write_socket (raw->sockfd, buffer, n, error);
 }
 
 static gint
-tcp_stream_raw_flush (CamelStream *stream)
+tcp_stream_raw_flush (CamelStream *stream,
+                      GError **error)
 {
 	return 0;
 }
 
 static gint
-tcp_stream_raw_close (CamelStream *stream)
+tcp_stream_raw_close (CamelStream *stream,
+                      GError **error)
 {
-	if (SOCKET_CLOSE (((CamelTcpStreamRaw *)stream)->sockfd) == -1)
+	if (SOCKET_CLOSE (((CamelTcpStreamRaw *)stream)->sockfd) == -1) {
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			"%s", g_strerror (errno));
 		return -1;
+	}
 
 	((CamelTcpStreamRaw *)stream)->sockfd = -1;
 	return 0;
@@ -395,12 +404,12 @@ connect_to_socks4_proxy (const gchar *proxy_host, gint proxy_port, struct addrin
 	memset (&hints, 0, sizeof (hints));
 	hints.ai_socktype = SOCK_STREAM;
 
-	ai = camel_getaddrinfo (proxy_host, serv, &hints, NULL); /* NULL-CamelException */
+	ai = camel_getaddrinfo (proxy_host, serv, &hints, NULL); /* NULL-GError */
 	if (!ai) {
 #ifdef G_OS_WIN32
 		errno = WSAEHOSTUNREACH;
 #else
-		errno = EHOSTUNREACH; /* FIXME: this is not an accurate error; we should translate the CamelException to an errno */
+		errno = EHOSTUNREACH; /* FIXME: this is not an accurate error; we should translate the GError to an errno */
 #endif
 		return -1;
 	}
@@ -424,10 +433,10 @@ connect_to_socks4_proxy (const gchar *proxy_host, gint proxy_port, struct addrin
 	memcpy (request + 4, &sin->sin_addr.s_addr, 4);	/* address in network byte order */
 	request[8] = 0x00;				/* terminator */
 
-	if (camel_write_socket (fd, request, sizeof (request)) != sizeof (request))
+	if (camel_write_socket (fd, request, sizeof (request), NULL) != sizeof (request))
 		goto error;
 
-	if (camel_read_socket (fd, reply, sizeof (reply)) != sizeof (reply))
+	if (camel_read_socket (fd, reply, sizeof (reply), NULL) != sizeof (reply))
 		goto error;
 
 	if (!(reply[0] == 0		/* first byte of reply is 0 */
@@ -457,7 +466,8 @@ out:
 
 static gint
 tcp_stream_raw_connect (CamelTcpStream *stream,
-                        struct addrinfo *host)
+                        struct addrinfo *host,
+                        GError **error)
 {
 	CamelTcpStreamRaw *raw = CAMEL_TCP_STREAM_RAW (stream);
 	const gchar *proxy_host;
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c
index 366c289..cf386f7 100644
--- a/camel/camel-tcp-stream-ssl.c
+++ b/camel/camel-tcp-stream-ssl.c
@@ -182,7 +182,9 @@ tcp_stream_ssl_finalize (GObject *object)
 }
 
 static gssize
-read_from_prfd (PRFileDesc *fd, gchar *buffer, gsize n)
+read_from_prfd (PRFileDesc *fd,
+                gchar *buffer,
+                gsize n)
 {
 	PRFileDesc *cancel_fd;
 	gssize nread;
@@ -266,7 +268,8 @@ read_from_prfd (PRFileDesc *fd, gchar *buffer, gsize n)
 static gssize
 tcp_stream_ssl_read (CamelStream *stream,
                      gchar *buffer,
-                     gsize n)
+                     gsize n,
+                     GError **error)
 {
 	CamelTcpStreamSSL *ssl = CAMEL_TCP_STREAM_SSL (stream);
 	gssize result;
@@ -275,6 +278,12 @@ tcp_stream_ssl_read (CamelStream *stream,
 
 	result = read_from_prfd (ssl->priv->sockfd, buffer, n);
 
+	if (result == -1)
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			"%s", g_strerror (errno));
+
 	d (g_print ("SSL stream %p: read %" G_GSSIZE_FORMAT " bytes, errno = %d\n", ssl, result, result == -1 ? errno : 0));
 
 	return result;
@@ -377,7 +386,8 @@ write_to_prfd (PRFileDesc *fd, const gchar *buffer, gsize n)
 static gssize
 tcp_stream_ssl_write (CamelStream *stream,
                       const gchar *buffer,
-                      gsize n)
+                      gsize n,
+                      GError **error)
 {
 	CamelTcpStreamSSL *ssl = CAMEL_TCP_STREAM_SSL (stream);
 	gssize result;
@@ -386,29 +396,43 @@ tcp_stream_ssl_write (CamelStream *stream,
 
 	result = write_to_prfd (ssl->priv->sockfd, buffer, n);
 
+	if (result == -1)
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			"%s", g_strerror (errno));
+
 	d (g_print ("SSL stream %p: wrote %" G_GSSIZE_FORMAT " bytes, errno = %d\n", ssl, result, result == -1 ? errno : 0));
 
 	return result;
 }
 
 static gint
-tcp_stream_ssl_flush (CamelStream *stream)
+tcp_stream_ssl_flush (CamelStream *stream,
+                      GError **error)
 {
 	/*return PR_Sync (((CamelTcpStreamSSL *)stream)->priv->sockfd);*/
 	return 0;
 }
 
 static gint
-tcp_stream_ssl_close (CamelStream *stream)
+tcp_stream_ssl_close (CamelStream *stream,
+                      GError **error)
 {
 	d (g_print ("SSL stream %p: closing\n", stream));
 
 	if (((CamelTcpStreamSSL *)stream)->priv->sockfd == NULL) {
 		errno = EINVAL;
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			"%s", g_strerror (errno));
 		return -1;
 	}
 
 	PR_Shutdown (((CamelTcpStreamSSL *)stream)->priv->sockfd, PR_SHUTDOWN_BOTH);
+
+	/* FIXME Need to set the GError if this fails. */
 	if (PR_Close (((CamelTcpStreamSSL *)stream)->priv->sockfd) == PR_FAILURE)
 		return -1;
 
@@ -685,15 +709,15 @@ camel_certdb_nss_cert_set(CamelCertDB *certdb, CamelCert *ccert, CERTCertificate
 	g_free (dir);
 
 	stream = camel_stream_fs_new_with_name (
-		path, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+		path, O_WRONLY | O_CREAT | O_TRUNC, 0600, NULL);
 	if (stream != NULL) {
 		if (camel_stream_write (
 			stream, (const gchar *) ccert->rawcert->data,
-			ccert->rawcert->len) == -1) {
+			ccert->rawcert->len, NULL) == -1) {
 			g_warning ("Could not save cert: %s: %s", path, g_strerror (errno));
 			g_unlink (path);
 		}
-		camel_stream_close (stream);
+		camel_stream_close (stream, NULL);
 		g_object_unref (stream);
 	} else {
 		g_warning ("Could not save cert: %s: %s", path, g_strerror (errno));
@@ -1146,12 +1170,12 @@ connect_to_socks4_proxy (CamelTcpStreamSSL *ssl, const gchar *proxy_host, gint p
 	memset (&hints, 0, sizeof (hints));
 	hints.ai_socktype = SOCK_STREAM;
 
-	ai = camel_getaddrinfo (proxy_host, serv, &hints, NULL);  /* NULL-CamelException */
+	ai = camel_getaddrinfo (proxy_host, serv, &hints, NULL);  /* NULL-GError */
 	if (!ai) {
 #ifdef G_OS_WIN32
 		errno = WSAEHOSTUNREACH;
 #else
-		errno = EHOSTUNREACH; /* FIXME: this is not an accurate error; we should translate the CamelException to an errno */
+		errno = EHOSTUNREACH; /* FIXME: this is not an accurate error; we should translate the GError to an errno */
 #endif
 		d (g_print ("  camel_getaddrinfo() for the proxy failed\n}\n"));
 		return NULL;
@@ -1243,7 +1267,8 @@ out:
 
 static gint
 tcp_stream_ssl_connect (CamelTcpStream *stream,
-                        struct addrinfo *host)
+                        struct addrinfo *host,
+                        GError **error)
 {
 	CamelTcpStreamSSL *ssl = CAMEL_TCP_STREAM_SSL (stream);
 	const gchar *proxy_host;
diff --git a/camel/camel-tcp-stream.c b/camel/camel-tcp-stream.c
index 1bf39ea..cb0b866 100644
--- a/camel/camel-tcp-stream.c
+++ b/camel/camel-tcp-stream.c
@@ -26,6 +26,7 @@
 
 #include <string.h>
 
+#include "camel-debug.h"
 #include "camel-tcp-stream.h"
 
 #ifdef G_OS_WIN32
@@ -83,6 +84,7 @@ camel_tcp_stream_init (CamelTcpStream *tcp_stream)
  * @stream: a #CamelTcpStream object
  * @host: a linked list of addrinfo structures to try to connect, in
  * the order of most likely to least likely to work.
+ * @error: return location for a #GError, or %NULL
  *
  * Create a socket and connect based upon the data provided.
  *
@@ -90,16 +92,21 @@ camel_tcp_stream_init (CamelTcpStream *tcp_stream)
  **/
 gint
 camel_tcp_stream_connect (CamelTcpStream *stream,
-                          struct addrinfo *host)
+                          struct addrinfo *host,
+                          GError **error)
 {
 	CamelTcpStreamClass *class;
+	gint retval;
 
 	g_return_val_if_fail (CAMEL_IS_TCP_STREAM (stream), -1);
 
 	class = CAMEL_TCP_STREAM_GET_CLASS (stream);
 	g_return_val_if_fail (class->connect != NULL, -1);
 
-	return class->connect (stream, host);
+	retval = class->connect (stream, host, error);
+	CAMEL_CHECK_GERROR (stream, connect, retval == 0, error);
+
+	return retval;
 }
 
 /**
diff --git a/camel/camel-tcp-stream.h b/camel/camel-tcp-stream.h
index 91c263a..5c97ea3 100644
--- a/camel/camel-tcp-stream.h
+++ b/camel/camel-tcp-stream.h
@@ -123,7 +123,8 @@ struct _CamelTcpStreamClass {
 	CamelStreamClass parent_class;
 
 	gint		(*connect)		(CamelTcpStream *stream,
-						 struct addrinfo *host);
+						 struct addrinfo *host,
+						 GError **error);
 	gint		(*getsockopt)		(CamelTcpStream *stream,
 						 CamelSockOptData *data);
 	gint		(*setsockopt)		(CamelTcpStream *stream,
@@ -138,7 +139,8 @@ struct _CamelTcpStreamClass {
 
 GType		camel_tcp_stream_get_type	(void);
 gint		camel_tcp_stream_connect	(CamelTcpStream *stream,
-						 struct addrinfo *host);
+						 struct addrinfo *host,
+						 GError **error);
 gint		camel_tcp_stream_getsockopt	(CamelTcpStream *stream,
 						 CamelSockOptData *data);
 gint		camel_tcp_stream_setsockopt	(CamelTcpStream *stream,
@@ -189,8 +191,13 @@ gint		camel_tcp_stream_setsockopt	(CamelTcpStream *stream,
  * support SOCKS4a/SOCKS5 proxies should be well-contained within Camel,
  * with no extra changes required in Evolution.
  */
-void camel_tcp_stream_set_socks_proxy (CamelTcpStream *stream, const gchar *socks_host, gint socks_port);
-void camel_tcp_stream_peek_socks_proxy (CamelTcpStream *stream, const gchar **socks_host_ret, gint *socks_port_ret);
+void		camel_tcp_stream_set_socks_proxy(CamelTcpStream *stream,
+						 const gchar *socks_host,
+						 gint socks_port);
+void		camel_tcp_stream_peek_socks_proxy
+						(CamelTcpStream *stream,
+						 const gchar **socks_host_ret,
+						 gint *socks_port_ret);
 
 struct sockaddr *
 		camel_tcp_stream_get_local_address
diff --git a/camel/camel-text-index.h b/camel/camel-text-index.h
index d1d5c41..2e7b5e5 100644
--- a/camel/camel-text-index.h
+++ b/camel/camel-text-index.h
@@ -26,7 +26,6 @@
 #ifndef CAMEL_TEXT_INDEX_H
 #define CAMEL_TEXT_INDEX_H
 
-#include <camel/camel-exception.h>
 #include <camel/camel-object.h>
 #include "camel-index.h"
 
diff --git a/camel/camel-transport.c b/camel/camel-transport.c
index 9d8925b..0ac9480 100644
--- a/camel/camel-transport.c
+++ b/camel/camel-transport.c
@@ -28,6 +28,7 @@
 #endif
 
 #include "camel-address.h"
+#include "camel-debug.h"
 #include "camel-mime-message.h"
 #include "camel-transport.h"
 
@@ -79,7 +80,7 @@ camel_transport_init (CamelTransport *transport)
  * @message: a #CamelMimeMessage to send
  * @from: a #CamelAddress to send from
  * @recipients: a #CamelAddress containing all recipients
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Sends the message to the given recipients, regardless of the contents
  * of @message. If the message contains a "Bcc" header, the transport
@@ -92,10 +93,10 @@ camel_transport_send_to (CamelTransport *transport,
                          CamelMimeMessage *message,
                          CamelAddress *from,
                          CamelAddress *recipients,
-                         CamelException *ex)
+                         GError **error)
 {
 	CamelTransportClass *class;
-	gboolean sent;
+	gboolean success;
 
 	g_return_val_if_fail (CAMEL_IS_TRANSPORT (transport), FALSE);
 	g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), FALSE);
@@ -106,10 +107,13 @@ camel_transport_send_to (CamelTransport *transport,
 	g_return_val_if_fail (class->send_to != NULL, FALSE);
 
 	camel_transport_lock (transport, CAMEL_TRANSPORT_SEND_LOCK);
-	sent = class->send_to (transport, message, from, recipients, ex);
+
+	success = class->send_to (transport, message, from, recipients, error);
+	CAMEL_CHECK_GERROR (transport, send_to, success, error);
+
 	camel_transport_unlock (transport, CAMEL_TRANSPORT_SEND_LOCK);
 
-	return sent;
+	return success;
 }
 
 /**
diff --git a/camel/camel-transport.h b/camel/camel-transport.h
index 310ac91..c9c1ae9 100644
--- a/camel/camel-transport.h
+++ b/camel/camel-transport.h
@@ -80,7 +80,7 @@ struct _CamelTransportClass {
 						 CamelMimeMessage *message,
 						 CamelAddress *from,
 						 CamelAddress *recipients,
-						 CamelException *ex);
+						 GError **error);
 };
 
 GType		camel_transport_get_type	(void);
@@ -88,7 +88,7 @@ gboolean	camel_transport_send_to		(CamelTransport *transport,
 						 CamelMimeMessage *message,
 						 CamelAddress *from,
 						 CamelAddress *recipients,
-						 CamelException *ex);
+						 GError **error);
 void		camel_transport_lock		(CamelTransport *transport,
 						 CamelTransportLock lock);
 void		camel_transport_unlock		(CamelTransport *transport,
diff --git a/camel/camel-uid-cache.c b/camel/camel-uid-cache.c
index 6baddb6..17ea6c9 100644
--- a/camel/camel-uid-cache.c
+++ b/camel/camel-uid-cache.c
@@ -79,7 +79,7 @@ camel_uid_cache_new (const gchar *filename)
 
 	buf = g_malloc (st.st_size + 1);
 
-	if (st.st_size > 0 && camel_read (fd, buf, st.st_size) == -1) {
+	if (st.st_size > 0 && camel_read (fd, buf, st.st_size, NULL) == -1) {
 		close (fd);
 		g_free (buf);
 		return NULL;
@@ -124,8 +124,8 @@ maybe_write_uid (gpointer key, gpointer value, gpointer data)
 		return;
 
 	if (state && state->level == cache->level && state->save) {
-		if (camel_write (cache->fd, key, strlen (key)) == -1 ||
-		    camel_write (cache->fd, "\n", 1) == -1) {
+		if (camel_write (cache->fd, key, strlen (key), NULL) == -1 ||
+		    camel_write (cache->fd, "\n", 1, NULL) == -1) {
 			cache->fd = -1;
 		} else {
 			cache->size += strlen (key) + 1;
diff --git a/camel/camel-url.c b/camel/camel-url.c
index 72b60ad..f0c0c31 100644
--- a/camel/camel-url.c
+++ b/camel/camel-url.c
@@ -34,7 +34,6 @@
 
 #include <glib/gi18n-lib.h>
 
-#include "camel-exception.h"
 #include "camel-mime-utils.h"
 #include "camel-object.h"
 #include "camel-service.h"
@@ -291,7 +290,7 @@ copy_param (GQuark key_id, gpointer data, gpointer user_data)
 /**
  * camel_url_new:
  * @url_string: a URL string
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Parses an absolute URL.
  *
@@ -299,7 +298,7 @@ copy_param (GQuark key_id, gpointer data, gpointer user_data)
  **/
 CamelURL *
 camel_url_new (const gchar *url_string,
-               CamelException *ex)
+               GError **error)
 {
 	CamelURL *url;
 
@@ -310,8 +309,8 @@ camel_url_new (const gchar *url_string,
 
 	if (!url->protocol) {
 		camel_url_free (url);
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Could not parse URL '%s'"), url_string);
 		return NULL;
 	}
diff --git a/camel/camel-url.h b/camel/camel-url.h
index a0abff9..bbd571e 100644
--- a/camel/camel-url.h
+++ b/camel/camel-url.h
@@ -32,8 +32,6 @@
 
 #include <glib.h>
 
-#include <camel/camel-exception.h>
-
 G_BEGIN_DECLS
 
 /* if this changes, remember to change camel_url_copy */
@@ -57,7 +55,7 @@ typedef struct _CamelURL {
 #define CAMEL_URL_HIDE_ALL (CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS | CAMEL_URL_HIDE_AUTH)
 
 CamelURL *camel_url_new_with_base (CamelURL *base, const gchar *url_string);
-CamelURL *camel_url_new (const gchar *url_string, CamelException *ex);
+CamelURL *camel_url_new (const gchar *url_string, GError **error);
 gchar *camel_url_to_string (CamelURL *url, guint32 flags);
 void camel_url_free (CamelURL *url);
 
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index f0a8d22..0ff7431 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -30,7 +30,6 @@
 
 #include "camel-db.h"
 #include "camel-debug.h"
-#include "camel-exception.h"
 #include "camel-folder-search.h"
 #include "camel-mime-message.h"
 #include "camel-session.h"
@@ -148,12 +147,9 @@ folder_changed_add_uid (CamelFolder *sub, const gchar *uid, const gchar hash[8],
 	vuid = camel_pstring_strdup (camel_message_info_uid (vinfo));
 	camel_message_info_free ((CamelMessageInfo *) vinfo);
 	if (use_db) {
-		CamelException ex = CAMEL_EXCEPTION_INITIALISER;
-
 		full_name = camel_folder_get_full_name (folder);
 		camel_db_add_to_vfolder_transaction (
-			parent_store->cdb_w, full_name, vuid, &ex);
-		camel_exception_clear (&ex);
+			parent_store->cdb_w, full_name, vuid, NULL);
 	}
 	camel_folder_change_info_add_uid (vf->changes,  vuid);
 	if ((vf->flags & CAMEL_STORE_FOLDER_PRIVATE) == 0 && !CAMEL_IS_VEE_FOLDER (sub) && folder_unmatched != NULL) {
@@ -165,20 +161,17 @@ folder_changed_add_uid (CamelFolder *sub, const gchar *uid, const gchar hash[8],
 		}
 		vinfo = (CamelVeeMessageInfo *)camel_folder_get_message_info ((CamelFolder *)folder_unmatched, vuid);
 		if (vinfo) {
-			CamelException ex = CAMEL_EXCEPTION_INITIALISER;
-
 			full_name = camel_folder_get_full_name (
 				CAMEL_FOLDER (folder_unmatched));
 			camel_folder_change_info_remove_uid (
 				folder_unmatched->changes, vuid);
 			camel_db_delete_uid_from_vfolder_transaction (
-				parent_store->cdb_w, full_name, vuid, &ex);
+				parent_store->cdb_w, full_name, vuid, NULL);
 			camel_folder_summary_remove_uid_fast (
 				CAMEL_FOLDER (folder_unmatched)->summary, vuid);
 			camel_folder_free_message_info (
 				CAMEL_FOLDER (folder_unmatched),
 				(CamelMessageInfo *) vinfo);
-			camel_exception_clear (&ex);
 		}
 	}
 
@@ -206,13 +199,9 @@ folder_changed_remove_uid (CamelFolder *sub, const gchar *uid, const gchar hash[
 
 	camel_folder_change_info_remove_uid (vf->changes, vuid);
 	if (use_db) {
-		/* FIXME[disk-summary] Handle exception */
-		CamelException ex = CAMEL_EXCEPTION_INITIALISER;
-
 		full_name = camel_folder_get_full_name (folder);
 		camel_db_delete_uid_from_vfolder_transaction (
-			parent_store->cdb_w, full_name, vuid, &ex);
-		camel_exception_clear (&ex);
+			parent_store->cdb_w, full_name, vuid, NULL);
 	}
 	camel_folder_summary_remove_uid_fast (folder->summary, vuid);
 
@@ -240,20 +229,17 @@ folder_changed_remove_uid (CamelFolder *sub, const gchar *uid, const gchar hash[
 
 			vinfo = (CamelVeeMessageInfo *)camel_folder_get_message_info ((CamelFolder *)folder_unmatched, vuid);
 			if (vinfo) {
-				CamelException ex = CAMEL_EXCEPTION_INITIALISER;
-
 				full_name = camel_folder_get_full_name (
 					CAMEL_FOLDER (folder_unmatched));
 				camel_folder_change_info_remove_uid (
 					folder_unmatched->changes, vuid);
 				camel_db_delete_uid_from_vfolder_transaction (
-					parent_store->cdb_w, full_name, vuid, &ex);
+					parent_store->cdb_w, full_name, vuid, NULL);
 				camel_folder_summary_remove_uid_fast (
 					CAMEL_FOLDER (folder_unmatched)->summary, vuid);
 				camel_folder_free_message_info (
 					CAMEL_FOLDER (folder_unmatched),
 					(CamelMessageInfo *) vinfo);
-				camel_exception_clear (&ex);
 			}
 		}
 	}
@@ -340,10 +326,8 @@ folder_changed_change (CamelSession *session, CamelSessionThreadMsg *msg)
 
 	/* Find newly added that match */
 	if (changes->uid_added->len > 0) {
-		CamelException ex = CAMEL_EXCEPTION_INITIALISER;
 		dd (printf (" Searching for added matches '%s'\n", vf->expression));
-		matches_added = camel_folder_search_by_uids (sub, vf->expression, changes->uid_added, &ex);
-		camel_exception_clear (&ex);
+		matches_added = camel_folder_search_by_uids (sub, vf->expression, changes->uid_added, NULL);
 	}
 
 	/* TODO:
@@ -353,7 +337,6 @@ folder_changed_change (CamelSession *session, CamelSessionThreadMsg *msg)
 	/* Search for changed items that newly match, but only if we dont have them */
 	changed = changes->uid_changed;
 	if (changed->len > 0) {
-		CamelException ex = CAMEL_EXCEPTION_INITIALISER;
 		dd (printf (" Searching for changed matches '%s'\n", vf->expression));
 
 		if ((vf->flags & CAMEL_STORE_VEE_FOLDER_AUTO) == 0) {
@@ -379,11 +362,9 @@ folder_changed_change (CamelSession *session, CamelSessionThreadMsg *msg)
 		}
 
 		if (changed->len)
-			matches_changed = camel_folder_search_by_uids (sub, vf->expression, changed, &ex);
-		camel_exception_clear (&ex);
+			matches_changed = camel_folder_search_by_uids (sub, vf->expression, changed, NULL);
 		if (always_changed && always_changed->len)
-			present = camel_folder_search_by_uids (sub, vf->expression, always_changed, &ex);
-		camel_exception_clear (&ex);
+			present = camel_folder_search_by_uids (sub, vf->expression, always_changed, NULL);
 	}
 
 	camel_vee_folder_lock (vf, CAMEL_VEE_FOLDER_SUMMARY_LOCK);
@@ -396,8 +377,6 @@ folder_changed_change (CamelSession *session, CamelSessionThreadMsg *msg)
 		camel_db_begin_transaction (parent_store->cdb_w, NULL);
 	}
 
-	dd (printf (" changed %u added %u removed %u\n", changes->uid_changed->len, changes->uid_added->len, changes->uid_removed->len));
-
 	/* Always remove removed uid's, in any case */
 	for (i=0;i<changes->uid_removed->len;i++) {
 		dd (printf ("  removing uid '%s'\n", (gchar *)changes->uid_removed->pdata[i]));
@@ -669,7 +648,7 @@ static CamelSessionThreadOps folder_changed_ops = {
 static gint
 vee_folder_rebuild_folder (CamelVeeFolder *vee_folder,
                            CamelFolder *source,
-                           CamelException *ex);
+                           GError **error);
 
 static void
 unmatched_check_uid (gchar *uidin, gpointer value, struct _update_data *u)
@@ -687,7 +666,6 @@ unmatched_check_uid (gchar *uidin, gpointer value, struct _update_data *u)
 	} else {
 		CamelVeeMessageInfo *mi = (CamelVeeMessageInfo *)camel_folder_summary_uid (((CamelFolder *)u->folder_unmatched)->summary, uid);
 		if (mi) {
-			CamelException ex = CAMEL_EXCEPTION_INITIALISER;
 			CamelStore *parent_store;
 			const gchar *full_name;
 
@@ -697,13 +675,12 @@ unmatched_check_uid (gchar *uidin, gpointer value, struct _update_data *u)
 				CAMEL_FOLDER (u->folder_unmatched));
 
 			camel_db_delete_uid_from_vfolder_transaction (
-				parent_store->cdb_w, full_name, uid, &ex);
+				parent_store->cdb_w, full_name, uid, NULL);
 			camel_folder_summary_remove_uid_fast (
 				((CamelFolder *)u->folder_unmatched)->summary, uid);
 			camel_folder_change_info_remove_uid (
 				u->folder_unmatched->changes, uid);
 			camel_message_info_free ((CamelMessageInfo *)mi);
-			camel_exception_clear (&ex);
 		}
 	}
 }
@@ -722,7 +699,6 @@ folder_added_uid (gchar *uidin, gpointer value, struct _update_data *u)
 		/* FIXME[disk-summary] Make all these as transactions, just
 		 * testing atm */
 		if (u->rebuilt && !u->correlating) {
-			CamelException ex = CAMEL_EXCEPTION_INITIALISER;
 			CamelStore *parent_store;
 			const gchar *full_name;
 
@@ -732,8 +708,7 @@ folder_added_uid (gchar *uidin, gpointer value, struct _update_data *u)
 				CAMEL_FOLDER (u->vee_folder));
 			camel_db_add_to_vfolder_transaction (
 				parent_store->cdb_w, full_name,
-				camel_message_info_uid (mi), &ex);
-			camel_exception_clear (&ex);
+				camel_message_info_uid (mi), NULL);
 		}
 		if (!CAMEL_IS_VEE_FOLDER (u->source) && u->unmatched_uids != NULL) {
 			if (g_hash_table_lookup_extended (u->unmatched_uids, camel_message_info_uid (mi), (gpointer *)&oldkey, &oldval)) {
@@ -751,7 +726,7 @@ folder_added_uid (gchar *uidin, gpointer value, struct _update_data *u)
 static gint
 count_result (CamelFolderSummary *summary,
               const gchar *query,
-              CamelException *ex)
+              GError **error)
 {
 	CamelFolder *folder = summary->folder;
 	CamelVeeFolder *vf = (CamelVeeFolder *)folder;
@@ -763,7 +738,7 @@ count_result (CamelFolderSummary *summary,
 	node = p->folders;
 	while (node) {
 		CamelFolder *f = node->data;
-		count += camel_folder_count_by_expression (f, expr, ex);
+		count += camel_folder_count_by_expression (f, expr, error);
 		node = node->next;
 	}
 
@@ -773,7 +748,7 @@ count_result (CamelFolderSummary *summary,
 
 static	CamelFIRecord *
 summary_header_to_db (CamelFolderSummary *s,
-                      CamelException *ex)
+                      GError **error)
 {
 	CamelFIRecord * record = g_new0 (CamelFIRecord, 1);
 	CamelStore *parent_store;
@@ -818,11 +793,11 @@ summary_header_to_db (CamelFolderSummary *s,
 		record->jnd_count = s->junk_not_deleted_count;
 	} else {
 		/* Either first time, or by force we search the count */
-		s->junk_count = count_result (s, "(match-all (system-flag  \"junk\"))", ex);
-		s->deleted_count = count_result (s, "(match-all (system-flag  \"deleted\"))", ex);
-		s->unread_count = count_result (s, "(match-all (not (system-flag  \"Seen\")))", ex);
-		s->visible_count = count_result (s, "(match-all (and (not (system-flag \"deleted\")) (not (system-flag \"junk\"))))", ex);
-		s->junk_not_deleted_count = count_result (s, "(match-all (and (not (system-flag \"deleted\")) (system-flag \"junk\")))", ex);
+		s->junk_count = count_result (s, "(match-all (system-flag  \"junk\"))", NULL);
+		s->deleted_count = count_result (s, "(match-all (system-flag  \"deleted\"))", NULL);
+		s->unread_count = count_result (s, "(match-all (not (system-flag  \"Seen\")))", NULL);
+		s->visible_count = count_result (s, "(match-all (and (not (system-flag \"deleted\")) (not (system-flag \"junk\"))))", NULL);
+		s->junk_not_deleted_count = count_result (s, "(match-all (and (not (system-flag \"deleted\")) (system-flag \"junk\")))", NULL);
 
 		record->junk_count = s->junk_count;
 		record->deleted_count = s->deleted_count;
@@ -956,14 +931,12 @@ vee_folder_dispose (GObject *object)
 		if (!vf->deleted) {
 			CamelFolder *folder;
 			CamelStore *parent_store;
-			CamelException ex = CAMEL_EXCEPTION_INITIALISER;
 
 			folder = CAMEL_FOLDER (vf);
 			parent_store = camel_folder_get_parent_store (folder);
 			record = summary_header_to_db (folder->summary, NULL);
-			camel_db_write_folder_info_record (parent_store->cdb_w, record, &ex);
+			camel_db_write_folder_info_record (parent_store->cdb_w, record, NULL);
 			g_free (record);
-			camel_exception_clear (&ex);
 		}
 
 		/* This may invoke sub-classes with partially destroyed state, they must deal with this */
@@ -1011,7 +984,7 @@ vee_folder_finalize (GObject *object)
 
 static gboolean
 vee_folder_refresh_info (CamelFolder *folder,
-                         CamelException *ex)
+                         GError **error)
 {
 	CamelVeeFolder *vf = (CamelVeeFolder *)folder;
 	CamelVeeFolderPrivate *p = CAMEL_VEE_FOLDER_GET_PRIVATE (vf);
@@ -1027,7 +1000,7 @@ vee_folder_refresh_info (CamelFolder *folder,
 	while (node) {
 		CamelFolder *f = node->data;
 
-		if (camel_vee_folder_rebuild_folder (vf, f, ex) == -1) {
+		if (camel_vee_folder_rebuild_folder (vf, f, error) == -1) {
 			success = FALSE;
 			break;
 		}
@@ -1043,11 +1016,12 @@ vee_folder_refresh_info (CamelFolder *folder,
 static gboolean
 vee_folder_sync (CamelFolder *folder,
                  gboolean expunge,
-                 CamelException *ex)
+                 GError **error)
 {
 	CamelVeeFolder *vf = (CamelVeeFolder *)folder;
 	CamelVeeFolderPrivate *p = CAMEL_VEE_FOLDER_GET_PRIVATE (vf);
 	GList *node;
+	GError *local_error = NULL;
 
 	if (((CamelVeeSummary *)folder->summary)->fake_visible_count)
 		folder->summary->visible_count = ((CamelVeeSummary *)folder->summary)->fake_visible_count;
@@ -1059,15 +1033,17 @@ vee_folder_sync (CamelFolder *folder,
 	while (node) {
 		CamelFolder *f = node->data;
 
-		if (!camel_folder_sync (f, expunge, ex)) {
-			if (strncmp (camel_exception_get_description (ex), "no such table", 13)) {
+		if (!camel_folder_sync (f, expunge, &local_error)) {
+			if (strncmp (local_error->message, "no such table", 13) != 0) {
 				const gchar *desc;
 
 				desc = camel_folder_get_description (f);
-				camel_exception_setv (ex, ex->id, _("Error storing '%s': %s"), desc, ex->desc);
-				g_warning ("%s", camel_exception_get_description (ex));
+				g_warning ("%s", local_error->message);
+				g_propagate_prefixed_error (
+					error, local_error,
+					_("Error storing '%s': "), desc);
 			} else
-				camel_exception_clear (ex);
+				g_clear_error (&local_error);
 		}
 
 		/* auto update vfolders shouldn't need a rebuild */
@@ -1085,7 +1061,7 @@ vee_folder_sync (CamelFolder *folder,
 		GSList *del = NULL;
 		gint i, count;
 
-		camel_folder_summary_prepare_fetch_all (folder->summary, ex);
+		camel_folder_summary_prepare_fetch_all (folder->summary, NULL);
 		count = camel_folder_summary_count (folder->summary);
 		for (i=0; i < count; i++) {
 			CamelVeeMessageInfo *mi = (CamelVeeMessageInfo *)camel_folder_summary_index (folder->summary, i);
@@ -1101,7 +1077,7 @@ vee_folder_sync (CamelFolder *folder,
 
 		full_name = camel_folder_get_full_name (folder);
 		parent_store = camel_folder_get_parent_store (folder);
-		camel_db_delete_vuids (parent_store->cdb_w, full_name, "", del, ex);
+		camel_db_delete_vuids (parent_store->cdb_w, full_name, "", del, NULL);
 		g_slist_foreach (del, (GFunc) camel_pstring_free, NULL);
 		g_slist_free (del);
 	}
@@ -1114,29 +1090,30 @@ vee_folder_sync (CamelFolder *folder,
 
 static gboolean
 vee_folder_expunge (CamelFolder *folder,
-                    CamelException *ex)
+                    GError **error)
 {
 	/* Force it to rebuild the counts, when some folders were expunged. */
 	((CamelVeeSummary *) folder->summary)->force_counts = TRUE;
 
-	return CAMEL_FOLDER_GET_CLASS (folder)->sync (folder, TRUE, ex);
+	return CAMEL_FOLDER_GET_CLASS (folder)->sync (folder, TRUE, error);
 }
 
 static CamelMimeMessage *
 vee_folder_get_message (CamelFolder *folder,
                         const gchar *uid,
-                        CamelException *ex)
+                        GError **error)
 {
 	CamelVeeMessageInfo *mi;
 	CamelMimeMessage *msg = NULL;
 
 	mi = (CamelVeeMessageInfo *)camel_folder_summary_uid (folder->summary, uid);
 	if (mi) {
-		msg = camel_folder_get_message (mi->summary->folder, camel_message_info_uid (mi)+8, ex);
+		msg = camel_folder_get_message (mi->summary->folder, camel_message_info_uid (mi)+8, error);
 		camel_message_info_free ((CamelMessageInfo *)mi);
 	} else {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+		g_set_error (
+			error, CAMEL_FOLDER_ERROR,
+			CAMEL_FOLDER_ERROR_INVALID_UID,
 			_("No such message %s in %s"), uid,
 			camel_folder_get_name (folder));
 	}
@@ -1149,10 +1126,10 @@ vee_folder_append_message (CamelFolder *folder,
                            CamelMimeMessage *message,
                            const CamelMessageInfo *info,
                            gchar **appended_uid,
-                            CamelException *ex)
+                           GError **error)
 {
-	camel_exception_set (
-		ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 		_("Cannot copy or move messages into a Virtual Folder"));
 
 	return FALSE;
@@ -1164,10 +1141,10 @@ vee_folder_transfer_messages_to (CamelFolder *folder,
                                  CamelFolder *dest,
                                  GPtrArray **transferred_uids,
                                  gboolean delete_originals,
-                                 CamelException *ex)
+                                 GError **error)
 {
-	camel_exception_set (
-		ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 		_("Cannot copy or move messages into a Virtual Folder"));
 
 	return FALSE;
@@ -1176,7 +1153,7 @@ vee_folder_transfer_messages_to (CamelFolder *folder,
 static GPtrArray *
 vee_folder_search_by_expression (CamelFolder *folder,
                                  const gchar *expression,
-                                 CamelException *ex)
+                                 GError **error)
 {
 	GList *node;
 	GPtrArray *matches, *result = g_ptr_array_new ();
@@ -1200,10 +1177,7 @@ vee_folder_search_by_expression (CamelFolder *folder,
 		/* make sure we only search each folder once - for unmatched folder to work right */
 		if (g_hash_table_lookup (searched, f) == NULL) {
 			camel_vee_folder_hash_folder (f, hash);
-			matches = camel_folder_search_by_expression (f, expr, ex);
-			if (camel_exception_is_set (ex) && strncmp (camel_exception_get_description (ex), "no such table", 13)) {
-				camel_exception_clear (ex);
-			}
+			matches = camel_folder_search_by_expression (f, expr, NULL);
 			if (matches) {
 				for (i = 0; i < matches->len; i++) {
 					gchar *uid = matches->pdata[i], *vuid;
@@ -1232,7 +1206,7 @@ static GPtrArray *
 vee_folder_search_by_uids (CamelFolder *folder,
                            const gchar *expression,
                            GPtrArray *uids,
-                           CamelException *ex)
+                           GError **error)
 {
 	GList *node;
 	GPtrArray *matches, *result = g_ptr_array_new ();
@@ -1264,7 +1238,7 @@ vee_folder_search_by_uids (CamelFolder *folder,
 					g_ptr_array_add (folder_uids, uid+8);
 			}
 			if (folder_uids->len > 0) {
-				matches = camel_folder_search_by_uids (f, expr, folder_uids, ex);
+				matches = camel_folder_search_by_uids (f, expr, folder_uids, error);
 				if (matches) {
 					for (i = 0; i < matches->len; i++) {
 						gchar *uid = matches->pdata[i], *vuid;
@@ -1276,8 +1250,6 @@ vee_folder_search_by_uids (CamelFolder *folder,
 						g_free (vuid);
 					}
 					camel_folder_search_free (f, matches);
-				} else {
-					g_warning ("Search failed: %s", camel_exception_get_description (ex));
 				}
 			}
 			g_hash_table_insert (searched, f, f);
@@ -1297,7 +1269,7 @@ vee_folder_search_by_uids (CamelFolder *folder,
 static guint32
 vee_folder_count_by_expression (CamelFolder *folder,
                                 const gchar *expression,
-                                CamelException *ex)
+                                GError **error)
 {
 	GList *node;
 	gchar *expr;
@@ -1318,7 +1290,7 @@ vee_folder_count_by_expression (CamelFolder *folder,
 
 		/* make sure we only search each folder once - for unmatched folder to work right */
 		if (g_hash_table_lookup (searched, f) == NULL) {
-			count += camel_folder_count_by_expression (f, expr, ex);
+			count += camel_folder_count_by_expression (f, expr, NULL);
 			g_hash_table_insert (searched, f, f);
 		}
 		node = g_list_next (node);
@@ -1406,7 +1378,6 @@ vee_folder_set_expression (CamelVeeFolder *vee_folder,
 {
 	CamelVeeFolderPrivate *p = CAMEL_VEE_FOLDER_GET_PRIVATE (vee_folder);
 	GList *node;
-	CamelException ex = CAMEL_EXCEPTION_INITIALISER;
 
 	camel_vee_folder_lock (vee_folder, CAMEL_VEE_FOLDER_SUBFOLDER_LOCK);
 
@@ -1430,8 +1401,7 @@ vee_folder_set_expression (CamelVeeFolder *vee_folder,
 		summary = folder->summary;
 
 		camel_folder_summary_clear (summary);
-		camel_db_recreate_vfolder (parent_store->cdb_w, full_name, &ex);
-		camel_exception_clear (&ex);
+		camel_db_recreate_vfolder (parent_store->cdb_w, full_name, NULL);
 		summary->junk_count = 0;
 		summary->deleted_count = 0;
 		summary->unread_count = 0;
@@ -1447,16 +1417,12 @@ vee_folder_set_expression (CamelVeeFolder *vee_folder,
 	while (node) {
 		CamelFolder *f = node->data;
 
-		if (camel_vee_folder_rebuild_folder (vee_folder, f, &ex) == -1)
+		if (camel_vee_folder_rebuild_folder (vee_folder, f, NULL) == -1)
 			break;
 
-		camel_exception_clear (&ex);
-
 		node = node->next;
 	}
 
-	camel_exception_clear (&ex);
-
 	camel_vee_folder_lock (vee_folder, CAMEL_VEE_FOLDER_CHANGED_LOCK);
 	g_list_free (p->folders_changed);
 	p->folders_changed = NULL;
@@ -1469,11 +1435,7 @@ static void
 vee_folder_add_folder (CamelVeeFolder *vee_folder,
                        CamelFolder *sub)
 {
-	CamelException ex = CAMEL_EXCEPTION_INITIALISER;
-
-	vee_folder_rebuild_folder (vee_folder, sub, &ex);
-
-	camel_exception_clear (&ex);
+	vee_folder_rebuild_folder (vee_folder, sub, NULL);
 }
 
 static void
@@ -1645,7 +1607,7 @@ vee_folder_remove_folder (CamelVeeFolder *vee_folder,
 static gint
 vee_folder_rebuild_folder (CamelVeeFolder *vee_folder,
                            CamelFolder *source,
-                           CamelException *ex)
+                           GError **error)
 {
 	GPtrArray *match, *all;
 	GHashTable *allhash, *matchhash, *fullhash;
@@ -1689,7 +1651,7 @@ vee_folder_rebuild_folder (CamelVeeFolder *vee_folder,
 			/* We take this to mean the results have not been cached.
 			 * XXX: It will also trigger if the result set is empty. */
 			match == NULL) {
-			match = camel_folder_search_by_expression (source, vee_folder->expression, ex);
+			match = camel_folder_search_by_expression (source, vee_folder->expression, error);
 			if (match == NULL) /* Search failed */
 				return 0;
 			rebuilded = TRUE;
@@ -1742,7 +1704,7 @@ vee_folder_rebuild_folder (CamelVeeFolder *vee_folder,
 	   current source) */
 	start = -1;
 	last = -1;
-	camel_folder_summary_prepare_fetch_all (folder->summary, ex);
+	camel_folder_summary_prepare_fetch_all (folder->summary, NULL);
 	count = camel_folder_summary_count (folder->summary);
 	for (i=0;i<count;i++) {
 		CamelVeeMessageInfo *mi = (CamelVeeMessageInfo *)camel_folder_summary_index (folder->summary, i);
@@ -1845,7 +1807,6 @@ vee_folder_rebuild_folder (CamelVeeFolder *vee_folder,
 	/* Del the unwanted things from the summary, we don't hold any locks now. */
 	if (del_list) {
 		if (!correlating) {
-			CamelException ex = CAMEL_EXCEPTION_INITIALISER;
 			CamelStore *parent_store;
 			const gchar *full_name;
 
@@ -1853,8 +1814,7 @@ vee_folder_rebuild_folder (CamelVeeFolder *vee_folder,
 			parent_store = camel_folder_get_parent_store (folder);
 			camel_db_delete_vuids (
 				parent_store->cdb_w,
-				full_name, shash, del_list, &ex);
-			camel_exception_clear (&ex);
+				full_name, shash, del_list, NULL);
 		}
 		((CamelVeeSummary *)folder->summary)->force_counts = TRUE;
 		g_slist_foreach (del_list, (GFunc) camel_pstring_free, NULL);
@@ -2215,16 +2175,16 @@ camel_vee_folder_remove_folder (CamelVeeFolder *vf, CamelFolder *sub)
  * camel_vee_folder_rebuild_folder:
  * @vf: Virtual Folder object
  * @sub: source CamelFolder to add to @vf
- * @ex: Exception.
+ * @error: return location for a #GError, or %NULL
  *
  * Rebuild the folder @sub, if it should be.
  **/
 gint
 camel_vee_folder_rebuild_folder (CamelVeeFolder *vf,
                                  CamelFolder *sub,
-                                 CamelException *ex)
+                                 GError **error)
 {
-	return CAMEL_VEE_FOLDER_GET_CLASS (vf)->rebuild_folder (vf, sub, ex);
+	return CAMEL_VEE_FOLDER_GET_CLASS (vf)->rebuild_folder (vf, sub, error);
 }
 
 static void
@@ -2388,7 +2348,7 @@ camel_vee_folder_unmask_event_folder_changed (CamelVeeFolder *vf,
  **/
 void
 camel_vee_folder_sync_headers (CamelFolder *vf,
-                               CamelException *ex)
+                               GError **error)
 {
 	CamelFIRecord * record;
 	CamelStore *parent_store;
@@ -2396,9 +2356,9 @@ camel_vee_folder_sync_headers (CamelFolder *vf,
 
 	/* Save the counts to DB */
 	start = time (NULL);
-	record = summary_header_to_db (vf->summary, ex);
+	record = summary_header_to_db (vf->summary, error);
 	parent_store = camel_folder_get_parent_store (vf);
-	camel_db_write_folder_info_record (parent_store->cdb_w, record, ex);
+	camel_db_write_folder_info_record (parent_store->cdb_w, record, error);
 	end = time (NULL);
 
 	g_free (record);
diff --git a/camel/camel-vee-folder.h b/camel/camel-vee-folder.h
index a0fe0d0..e58fab2 100644
--- a/camel/camel-vee-folder.h
+++ b/camel/camel-vee-folder.h
@@ -93,7 +93,7 @@ struct _CamelVeeFolderClass {
 
 	void (*add_folder)(CamelVeeFolder *, CamelFolder *);
 	void (*remove_folder)(CamelVeeFolder *, CamelFolder *);
-	gint (*rebuild_folder)(CamelVeeFolder *, CamelFolder *, CamelException *);
+	gint (*rebuild_folder)(CamelVeeFolder *, CamelFolder *, GError **error);
 
 	void (*set_expression)(CamelVeeFolder *, const gchar *);
 
@@ -114,14 +114,14 @@ CamelFolder *camel_vee_folder_get_location(CamelVeeFolder *vf, const struct _Cam
 void         camel_vee_folder_add_folder        (CamelVeeFolder *vf, CamelFolder *sub);
 void         camel_vee_folder_remove_folder     (CamelVeeFolder *vf, CamelFolder *sub);
 void	     camel_vee_folder_set_folders	(CamelVeeFolder *vf, GList *folders);
-gint          camel_vee_folder_rebuild_folder(CamelVeeFolder *vf, CamelFolder *sub, CamelException *ex);
+gint          camel_vee_folder_rebuild_folder(CamelVeeFolder *vf, CamelFolder *sub, GError **error);
 void	     camel_vee_folder_set_expression	(CamelVeeFolder *vf, const gchar *expr);
 
 void	     camel_vee_folder_mask_event_folder_changed (CamelVeeFolder *vf, CamelFolder *sub);
 void	     camel_vee_folder_unmask_event_folder_changed (CamelVeeFolder *vf, CamelFolder *sub);
 
 void	     camel_vee_folder_hash_folder	(CamelFolder *folder, gchar buffer[8]);
-void	     camel_vee_folder_sync_headers (CamelFolder *vf, CamelException *ex);
+void	     camel_vee_folder_sync_headers (CamelFolder *vf, GError **error);
 
 gint camel_vee_folder_get_unread_vfolder (CamelVeeFolder *folder);
 void camel_vee_folder_set_unread_vfolder (CamelVeeFolder *folder, gint unread_vfolder);
diff --git a/camel/camel-vee-store.c b/camel/camel-vee-store.c
index 9ddc6b5..027b679 100644
--- a/camel/camel-vee-store.c
+++ b/camel/camel-vee-store.c
@@ -28,7 +28,6 @@
 #include <glib/gstdio.h>
 
 #include "camel-db.h"
-#include "camel-exception.h"
 #include "camel-session.h"
 #include "camel-vee-folder.h"
 #include "camel-vee-store.h"
@@ -119,7 +118,7 @@ vee_store_construct (CamelService *service,
                      CamelSession *session,
                      CamelProvider *provider,
                      CamelURL *url,
-                     CamelException *ex)
+                     GError **error)
 {
 	CamelServiceClass *service_class;
 	CamelStore *store;
@@ -130,7 +129,7 @@ vee_store_construct (CamelService *service,
 
 	/* Chain up to parent's construct() method. */
 	service_class = CAMEL_SERVICE_CLASS (camel_vee_store_parent_class);
-	if (!service_class->construct (service, session, provider, url, ex))
+	if (!service_class->construct (service, session, provider, url, error))
 		return FALSE;
 
 	/* Set up unmatched folder */
@@ -158,7 +157,7 @@ static CamelFolder *
 vee_store_get_folder (CamelStore *store,
                       const gchar *folder_name,
                       guint32 flags,
-                      CamelException *ex)
+                      GError **error)
 {
 	CamelVeeFolder *vf;
 	CamelFolder *folder;
@@ -200,7 +199,7 @@ static gboolean
 vee_store_rename_folder (CamelStore *store,
                          const gchar *old,
                          const gchar *new,
-                         CamelException *ex)
+                         GError **error)
 {
 	CamelFolder *folder, *oldfolder;
 	gchar *p, *name;
@@ -208,8 +207,9 @@ vee_store_rename_folder (CamelStore *store,
 	d (printf ("vee rename folder '%s' '%s'\n", old, new));
 
 	if (strcmp (old, CAMEL_UNMATCHED_NAME) == 0) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("Cannot rename folder: %s: Invalid operation"), old);
 		return FALSE;
 	}
@@ -217,8 +217,9 @@ vee_store_rename_folder (CamelStore *store,
 	/* See if it exists, for vfolders, all folders are in the folders hash */
 	oldfolder = camel_object_bag_get (store->folders, old);
 	if (oldfolder == NULL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("Cannot rename folder: %s: No such folder"), old);
 		return FALSE;
 	}
@@ -251,13 +252,14 @@ vee_store_rename_folder (CamelStore *store,
 static gboolean
 vee_store_delete_folder (CamelStore *store,
                          const gchar *folder_name,
-                         CamelException *ex)
+                         GError **error)
 {
 	CamelFolder *folder;
 
 	if (strcmp (folder_name, CAMEL_UNMATCHED_NAME) == 0) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("Cannot delete folder: %s: Invalid operation"),
 			folder_name);
 		return FALSE;
@@ -281,8 +283,9 @@ vee_store_delete_folder (CamelStore *store,
 
 		g_object_unref (folder);
 	} else {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("Cannot delete folder: %s: No such folder"),
 			folder_name);
 		return FALSE;
@@ -295,7 +298,7 @@ static CamelFolderInfo *
 vee_store_get_folder_info (CamelStore *store,
                            const gchar *top,
                            guint32 flags,
-                           CamelException *ex)
+                           GError **error)
 {
 	CamelFolderInfo *info, *res = NULL, *tail;
 	GPtrArray *folders;
@@ -430,14 +433,14 @@ vee_store_get_folder_info (CamelStore *store,
 
 static CamelFolder *
 vee_store_get_trash (CamelStore *store,
-                     CamelException *ex)
+                     GError **error)
 {
 	return NULL;
 }
 
 static CamelFolder *
 vee_store_get_junk (CamelStore *store,
-                    CamelException *ex)
+                    GError **error)
 {
 	return NULL;
 }
diff --git a/camel/camel-vtrash-folder.c b/camel/camel-vtrash-folder.c
index 3659977..ca5bec8 100644
--- a/camel/camel-vtrash-folder.c
+++ b/camel/camel-vtrash-folder.c
@@ -30,7 +30,6 @@
 #include <glib/gi18n-lib.h>
 
 #include "camel-db.h"
-#include "camel-exception.h"
 #include "camel-mime-message.h"
 #include "camel-store.h"
 #include "camel-vee-store.h"
@@ -64,13 +63,12 @@ G_DEFINE_TYPE (CamelVTrashFolder, camel_vtrash_folder, CAMEL_TYPE_VEE_FOLDER)
 static void
 transfer_messages (CamelFolder *folder,
                    struct _transfer_data *md,
-                   CamelException *ex)
+                   GError **error)
 {
 	gint i;
 
-	if (!camel_exception_is_set (ex))
-		camel_folder_transfer_messages_to (
-			md->folder, md->uids, md->dest, NULL, md->delete, ex);
+	camel_folder_transfer_messages_to (
+		md->folder, md->uids, md->dest, NULL, md->delete, error);
 
 	for (i=0;i<md->uids->len;i++)
 		g_free(md->uids->pdata[i]);
@@ -84,10 +82,10 @@ vtrash_folder_append_message (CamelFolder *folder,
                               CamelMimeMessage *message,
                               const CamelMessageInfo *info,
                               gchar **appended_uid,
-                              CamelException *ex)
+                              GError **error)
 {
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_SYSTEM, "%s",
+	g_set_error (
+		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC, "%s",
 		_(vdata[((CamelVTrashFolder *)folder)->type].error_copy));
 
 	return FALSE;
@@ -99,7 +97,7 @@ vtrash_folder_transfer_messages_to (CamelFolder *source,
                                     CamelFolder *dest,
                                     GPtrArray **transferred_uids,
                                     gboolean delete_originals,
-                                    CamelException *ex)
+                                    GError **error)
 {
 	CamelVeeMessageInfo *mi;
 	gint i;
@@ -119,8 +117,8 @@ vtrash_folder_transfer_messages_to (CamelFolder *source,
 	if (CAMEL_IS_VTRASH_FOLDER (dest)) {
 		/* Copy to trash is meaningless. */
 		if (!delete_originals) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM, "%s",
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC, "%s",
 				_(vdata[((CamelVTrashFolder *)dest)->type].error_copy));
 			return FALSE;
 		}
@@ -168,7 +166,7 @@ vtrash_folder_transfer_messages_to (CamelFolder *source,
 	}
 
 	if (batch) {
-		g_hash_table_foreach(batch, (GHFunc)transfer_messages, ex);
+		g_hash_table_foreach(batch, (GHFunc)transfer_messages, error);
 		g_hash_table_destroy(batch);
 	}
 
diff --git a/camel/camel.h b/camel/camel.h
index 0c74c3d..7801dda 100644
--- a/camel/camel.h
+++ b/camel/camel.h
@@ -38,7 +38,6 @@
 #include <camel/camel-disco-diary.h>
 #include <camel/camel-disco-folder.h>
 #include <camel/camel-disco-store.h>
-#include <camel/camel-exception.h>
 #include <camel/camel-file-utils.h>
 #include <camel/camel-filter-driver.h>
 #include <camel/camel-filter-search.h>
diff --git a/camel/providers/groupwise/camel-groupwise-folder.c b/camel/providers/groupwise/camel-groupwise-folder.c
index 89aa95e..bc9f9ac 100644
--- a/camel/providers/groupwise/camel-groupwise-folder.c
+++ b/camel/providers/groupwise/camel-groupwise-folder.c
@@ -77,20 +77,20 @@ struct _CamelGroupwiseFolderPrivate {
 extern gint camel_application_is_exiting;
 
 /*prototypes*/
-static gboolean groupwise_transfer_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *destination, GPtrArray **transferred_uids, gboolean delete_originals, CamelException *ex);
+static gboolean groupwise_transfer_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *destination, GPtrArray **transferred_uids, gboolean delete_originals, GError **error);
 void convert_to_calendar (EGwItem *item, gchar **str, gint *len);
 static void convert_to_task (EGwItem *item, gchar **str, gint *len);
 static void convert_to_note (EGwItem *item, gchar **str, gint *len);
-static void gw_update_all_items ( CamelFolder *folder, GList *item_list, CamelException *ex);
+static void gw_update_all_items ( CamelFolder *folder, GList *item_list, GError **error);
 static void groupwise_populate_details_from_item (CamelMimeMessage *msg, EGwItem *item);
 static void groupwise_populate_msg_body_from_item (EGwConnection *cnc, CamelMultipart *multipart, EGwItem *item, gchar *body);
 static void groupwise_msg_set_recipient_list (CamelMimeMessage *msg, EGwItem *item);
-static void gw_update_cache ( CamelFolder *folder, GList *item_list, CamelException *ex, gboolean uid_flag);
-static CamelMimeMessage *groupwise_folder_item_to_msg ( CamelFolder *folder, EGwItem *item, CamelException *ex );
-static gchar * groupwise_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex);
+static void gw_update_cache ( CamelFolder *folder, GList *item_list, GError **error, gboolean uid_flag);
+static CamelMimeMessage *groupwise_folder_item_to_msg ( CamelFolder *folder, EGwItem *item, GError **error );
+static gchar * groupwise_get_filename (CamelFolder *folder, const gchar *uid, GError **error);
 static const gchar *get_from_from_org (EGwItemOrganizer *org);
-static void groupwise_refresh_folder(CamelFolder *folder, CamelException *ex);
-static gboolean groupwise_sync (CamelFolder *folder, gboolean expunge, CamelMessageInfo *update_single, CamelException *ex);
+static void groupwise_refresh_folder(CamelFolder *folder, GError **error);
+static gboolean groupwise_sync (CamelFolder *folder, gboolean expunge, CamelMessageInfo *update_single, GError **error);
 
 #define d(x)
 
@@ -100,16 +100,16 @@ static const gchar * GET_ITEM_VIEW_WITHOUT_CACHE = "peek default recipient threa
 G_DEFINE_TYPE (CamelGroupwiseFolder, camel_groupwise_folder, CAMEL_TYPE_OFFLINE_FOLDER)
 
 static gchar *
-groupwise_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex)
+groupwise_get_filename (CamelFolder *folder, const gchar *uid, GError **error)
 {
 	CamelGroupwiseFolder *gw_folder = CAMEL_GROUPWISE_FOLDER(folder);
 
-	return camel_data_cache_get_filename (gw_folder->cache, "cache", uid, ex);
+	return camel_data_cache_get_filename (gw_folder->cache, "cache", uid, error);
 }
 
 /* Get a message from cache if available otherwise get it from server */
 static CamelMimeMessage *
-groupwise_folder_get_message( CamelFolder *folder, const gchar *uid, CamelException *ex )
+groupwise_folder_get_message( CamelFolder *folder, const gchar *uid, GError **error )
 {
 	CamelMimeMessage *msg = NULL;
 	CamelGroupwiseFolder *gw_folder;
@@ -133,33 +133,29 @@ groupwise_folder_get_message( CamelFolder *folder, const gchar *uid, CamelExcept
 
 	mi = (CamelGroupwiseMessageInfo *) camel_folder_summary_uid (folder->summary, uid);
 	if (mi == NULL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+		g_set_error (
+			error, CAMEL_FOLDER_ERROR,
+			CAMEL_FOLDER_ERROR_INVALID_UID,
 			_("Cannot get message: %s\n  %s"), uid, _("No such message"));
 		return NULL;
 	}
-	cache_stream  = camel_data_cache_get (gw_folder->cache, "cache", uid, ex);
+	cache_stream  = camel_data_cache_get (gw_folder->cache, "cache", uid, error);
 	stream = camel_stream_mem_new ();
 	if (cache_stream) {
 		msg = camel_mime_message_new ();
-		camel_stream_reset (stream);
-		camel_stream_write_to_stream (cache_stream, stream);
-		camel_stream_reset (stream);
-		if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) msg, stream) == -1) {
+		camel_stream_reset (stream, NULL);
+		camel_stream_write_to_stream (cache_stream, stream, NULL);
+		camel_stream_reset (stream, NULL);
+		if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) msg, stream, error) == -1) {
 			if (errno == EINTR) {
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_USER_CANCEL,
-					_("User canceled"));
 				g_object_unref (msg);
 				g_object_unref (cache_stream);
 				g_object_unref (stream);
 				camel_message_info_free (&mi->info);
 				return NULL;
 			} else {
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_SYSTEM,
-					_("Cannot get message %s: %s"),
-					uid, g_strerror (errno));
+				g_prefix_error (
+					error, _("Cannot get message %s: "), uid);
 				g_object_unref (msg);
 				msg = NULL;
 			}
@@ -174,17 +170,19 @@ groupwise_folder_get_message( CamelFolder *folder, const gchar *uid, CamelExcept
 	}
 
 	if (((CamelOfflineStore *) gw_store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
 			_("This message is not available in offline mode."));
 		camel_message_info_free (&mi->info);
 		return NULL;
 	}
 
 	/* Check if we are really offline */
-	if (!camel_groupwise_store_connected (gw_store, ex)) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+	if (!camel_groupwise_store_connected (gw_store, NULL)) {
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
 			_("This message is not available in offline mode."));
 		camel_message_info_free (&mi->info);
 		return NULL;
@@ -199,17 +197,19 @@ groupwise_folder_get_message( CamelFolder *folder, const gchar *uid, CamelExcept
 		status = e_gw_connection_get_item (cnc, container_id, uid, GET_ITEM_VIEW_WITH_CACHE, &item);
 	if (status != E_GW_CONNECTION_STATUS_OK) {
 		g_free (container_id);
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SERVICE_INVALID,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_INVALID,
 			_("Could not get message"));
 		camel_message_info_free (&mi->info);
 		return NULL;
 	}
 
-	msg = groupwise_folder_item_to_msg (folder, item, ex);
+	msg = groupwise_folder_item_to_msg (folder, item, NULL);
 	if (!msg) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SERVICE_INVALID,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_INVALID,
 			_("Could not get message"));
 		g_free (container_id);
 		camel_message_info_free (&mi->info);
@@ -226,8 +226,8 @@ groupwise_folder_get_message( CamelFolder *folder, const gchar *uid, CamelExcept
 	/* add to cache */
 	CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
 	if ((cache_stream = camel_data_cache_add (gw_folder->cache, "cache", uid, NULL))) {
-		if (camel_data_wrapper_write_to_stream ((CamelDataWrapper *) msg, cache_stream) == -1
-				|| camel_stream_flush (cache_stream) == -1)
+		if (camel_data_wrapper_write_to_stream ((CamelDataWrapper *) msg, cache_stream, NULL) == -1
+				|| camel_stream_flush (cache_stream, NULL) == -1)
 			camel_data_cache_remove (gw_folder->cache, "cache", uid, NULL);
 		g_object_unref (cache_stream);
 	}
@@ -494,35 +494,35 @@ groupwise_folder_rename (CamelFolder *folder, const gchar *new)
 }
 
 static GPtrArray *
-groupwise_folder_search_by_expression (CamelFolder *folder, const gchar *expression, CamelException *ex)
+groupwise_folder_search_by_expression (CamelFolder *folder, const gchar *expression, GError **error)
 {
 	CamelGroupwiseFolder *gw_folder = CAMEL_GROUPWISE_FOLDER(folder);
 	GPtrArray *matches;
 
 	CAMEL_GROUPWISE_FOLDER_LOCK(gw_folder, search_lock);
 	camel_folder_search_set_folder (gw_folder->search, folder);
-	matches = camel_folder_search_search(gw_folder->search, expression, NULL, ex);
+	matches = camel_folder_search_search(gw_folder->search, expression, NULL, error);
 	CAMEL_GROUPWISE_FOLDER_UNLOCK(gw_folder, search_lock);
 
 	return matches;
 }
 
 static guint32
-groupwise_folder_count_by_expression (CamelFolder *folder, const gchar *expression, CamelException *ex)
+groupwise_folder_count_by_expression (CamelFolder *folder, const gchar *expression, GError **error)
 {
 	CamelGroupwiseFolder *gw_folder = CAMEL_GROUPWISE_FOLDER(folder);
 	guint32 matches;
 
 	CAMEL_GROUPWISE_FOLDER_LOCK(gw_folder, search_lock);
 	camel_folder_search_set_folder (gw_folder->search, folder);
-	matches = camel_folder_search_count (gw_folder->search, expression, ex);
+	matches = camel_folder_search_count (gw_folder->search, expression, error);
 	CAMEL_GROUPWISE_FOLDER_UNLOCK(gw_folder, search_lock);
 
 	return matches;
 }
 
 static GPtrArray *
-groupwise_folder_search_by_uids(CamelFolder *folder, const gchar *expression, GPtrArray *uids, CamelException *ex)
+groupwise_folder_search_by_uids(CamelFolder *folder, const gchar *expression, GPtrArray *uids, GError **error)
 {
 	CamelGroupwiseFolder *gw_folder = CAMEL_GROUPWISE_FOLDER(folder);
 	GPtrArray *matches;
@@ -533,7 +533,7 @@ groupwise_folder_search_by_uids(CamelFolder *folder, const gchar *expression, GP
 	CAMEL_GROUPWISE_FOLDER_LOCK(gw_folder, search_lock);
 
 	camel_folder_search_set_folder(gw_folder->search, folder);
-	matches = camel_folder_search_search(gw_folder->search, expression, uids, ex);
+	matches = camel_folder_search_search(gw_folder->search, expression, uids, error);
 
 	CAMEL_GROUPWISE_FOLDER_UNLOCK(gw_folder, search_lock);
 
@@ -626,7 +626,7 @@ error:
 }
 
 static void
-move_to_mailbox (CamelFolder *folder, CamelMessageInfo *info, CamelException *ex)
+move_to_mailbox (CamelFolder *folder, CamelMessageInfo *info, GError **error)
 {
 	CamelFolder *dest;
 	CamelStore *parent_store;
@@ -638,10 +638,10 @@ move_to_mailbox (CamelFolder *folder, CamelMessageInfo *info, CamelException *ex
 	uids = g_ptr_array_new ();
 	g_ptr_array_add (uids, (gpointer) uid);
 
-	dest = camel_store_get_folder (parent_store, "Mailbox", 0, ex);
+	dest = camel_store_get_folder (parent_store, "Mailbox", 0, error);
 	camel_message_info_set_flags (info, CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN|CAMEL_GW_MESSAGE_NOJUNK|CAMEL_GW_MESSAGE_JUNK, 0);
 	if (dest)
-		groupwise_transfer_messages_to (folder, uids, dest, NULL, TRUE, ex);
+		groupwise_transfer_messages_to (folder, uids, dest, NULL, TRUE, error);
 	else
 		g_warning ("No Mailbox folder found");
 
@@ -649,7 +649,7 @@ move_to_mailbox (CamelFolder *folder, CamelMessageInfo *info, CamelException *ex
 }
 
 static void
-move_to_junk (CamelFolder *folder, CamelMessageInfo *info, CamelException *ex)
+move_to_junk (CamelFolder *folder, CamelMessageInfo *info, GError **error)
 {
 	CamelFolder *dest;
 	CamelFolderInfo *fi;
@@ -662,17 +662,17 @@ move_to_junk (CamelFolder *folder, CamelMessageInfo *info, CamelException *ex)
 	uids = g_ptr_array_new ();
 	g_ptr_array_add (uids, (gpointer) uid);
 
-	dest = camel_store_get_folder (parent_store, JUNK_FOLDER, 0, ex);
+	dest = camel_store_get_folder (parent_store, JUNK_FOLDER, 0, error);
 
 	if (dest)
-		groupwise_transfer_messages_to (folder, uids, dest, NULL, TRUE, ex);
+		groupwise_transfer_messages_to (folder, uids, dest, NULL, TRUE, error);
 	else {
 		fi = create_junk_folder (parent_store);
-		dest = camel_store_get_folder (parent_store, JUNK_FOLDER, 0, ex);
+		dest = camel_store_get_folder (parent_store, JUNK_FOLDER, 0, error);
 		if (!dest)
 			g_warning ("Could not get JunkFolder:Message not moved");
 		else
-			groupwise_transfer_messages_to (folder, uids, dest, NULL, TRUE, ex);
+			groupwise_transfer_messages_to (folder, uids, dest, NULL, TRUE, error);
 	}
 	update_junk_list (parent_store, info, ADD_JUNK_ENTRY);
 }
@@ -680,7 +680,7 @@ move_to_junk (CamelFolder *folder, CamelMessageInfo *info, CamelException *ex)
 /********************* back to folder functions*************************/
 
 static gboolean
-groupwise_sync_summary (CamelFolder *folder, CamelException *ex)
+groupwise_sync_summary (CamelFolder *folder, GError **error)
 {
 	CamelStoreInfo *si;
 	CamelStore *parent_store;
@@ -690,7 +690,7 @@ groupwise_sync_summary (CamelFolder *folder, CamelException *ex)
 	full_name = camel_folder_get_full_name (folder);
 	parent_store = camel_folder_get_parent_store (folder);
 
-	camel_folder_summary_save_to_db (folder->summary, ex);
+	camel_folder_summary_save_to_db (folder->summary, error);
 
 	si = camel_store_summary_path ((CamelStoreSummary *) ((CamelGroupwiseStore *) parent_store)->summary, full_name);
 
@@ -749,27 +749,22 @@ groupwise_set_message_flags (CamelFolder *folder, const gchar *uid, guint32 flag
 
 	sync_immediately = g_getenv ("GW_SYNC_IMMEDIATE");
 
-	if (sync_immediately) {
-		CamelException ex;
-
-		camel_exception_init (&ex);
-		groupwise_sync (folder, FALSE, info, &ex);
-		camel_exception_clear (&ex);
-	}
+	if (sync_immediately)
+		groupwise_sync (folder, FALSE, info, NULL);
 
 	camel_message_info_free (info);
 	return res;
 }
 
 static gboolean
-groupwise_sync_all (CamelFolder *folder, gboolean expunge, CamelException *ex)
+groupwise_sync_all (CamelFolder *folder, gboolean expunge, GError **error)
 {
-	return groupwise_sync (folder, expunge, NULL, ex);
+	return groupwise_sync (folder, expunge, NULL, error);
 }
 
 /* This may need to be reorganized. */
 static gboolean
-groupwise_sync (CamelFolder *folder, gboolean expunge, CamelMessageInfo *update_single, CamelException *ex)
+groupwise_sync (CamelFolder *folder, gboolean expunge, CamelMessageInfo *update_single, GError **error)
 {
 	CamelGroupwiseStore *gw_store;
 	CamelGroupwiseFolder *gw_folder;
@@ -796,12 +791,11 @@ groupwise_sync (CamelFolder *folder, gboolean expunge, CamelMessageInfo *update_
 	deleted_items = deleted_head = NULL;
 
 	if (((CamelOfflineStore *) gw_store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
-		return groupwise_sync_summary (folder, ex);
+		return groupwise_sync_summary (folder, error);
 
 	camel_service_lock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-	if (!camel_groupwise_store_connected (gw_store, ex)) {
+	if (!camel_groupwise_store_connected (gw_store, NULL)) {
 		camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-		camel_exception_clear (ex);
 		return TRUE;
 	}
 	camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
@@ -813,7 +807,7 @@ groupwise_sync (CamelFolder *folder, gboolean expunge, CamelMessageInfo *update_
 		return TRUE;
 
 	changes = camel_folder_change_info_new ();
-	camel_folder_summary_prepare_fetch_all (folder->summary, ex);
+	camel_folder_summary_prepare_fetch_all (folder->summary, error);
 	count = camel_folder_summary_count (folder->summary);
 	CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
 	for (i=0; i < count; i++) {
@@ -840,7 +834,7 @@ groupwise_sync (CamelFolder *folder, gboolean expunge, CamelMessageInfo *update_
 
 		if ((flags & CAMEL_MESSAGE_JUNK) && strcmp(camel_folder_get_name(folder), JUNK_FOLDER)) {
 			/*marked a message junk*/
-			move_to_junk (folder, info, ex);
+			move_to_junk (folder, info, error);
 			camel_folder_summary_remove_uid (folder->summary, camel_message_info_uid(info));
 			camel_data_cache_remove (gw_folder->cache, "cache", camel_message_info_uid(info), NULL);
 			continue;
@@ -848,7 +842,7 @@ groupwise_sync (CamelFolder *folder, gboolean expunge, CamelMessageInfo *update_
 
 		if ((flags & CAMEL_GW_MESSAGE_NOJUNK) && !strcmp(camel_folder_get_name(folder), JUNK_FOLDER)) {
 			/*message was marked as junk, now unjunk*/
-			move_to_mailbox (folder, info, ex);
+			move_to_mailbox (folder, info, error);
 			camel_folder_summary_remove_uid (folder->summary, camel_message_info_uid(info));
 			camel_data_cache_remove (gw_folder->cache, "cache", camel_message_info_uid(info), NULL);
 			continue;
@@ -1004,7 +998,7 @@ groupwise_sync (CamelFolder *folder, gboolean expunge, CamelMessageInfo *update_
 	}
 
 	camel_service_lock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-	success = groupwise_sync_summary (folder, ex);
+	success = groupwise_sync_summary (folder, error);
 	camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
 	camel_folder_changed (folder, changes);
@@ -1014,7 +1008,7 @@ groupwise_sync (CamelFolder *folder, gboolean expunge, CamelMessageInfo *update_
 }
 
 CamelFolder *
-camel_gw_folder_new(CamelStore *store, const gchar *folder_name, const gchar *folder_dir, CamelException *ex)
+camel_gw_folder_new(CamelStore *store, const gchar *folder_name, const gchar *folder_dir, GError **error)
 {
 	CamelFolder *folder;
 	CamelGroupwiseFolder *gw_folder;
@@ -1039,8 +1033,8 @@ camel_gw_folder_new(CamelStore *store, const gchar *folder_name, const gchar *fo
 	g_free(summary_file);
 	if (!folder->summary) {
 		g_object_unref (CAMEL_OBJECT (folder));
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Could not load summary for %s"), folder_name);
 		return NULL;
 	}
@@ -1051,7 +1045,7 @@ camel_gw_folder_new(CamelStore *store, const gchar *folder_name, const gchar *fo
 	g_free(state_file);
 	camel_object_state_read (CAMEL_OBJECT (folder));
 
-	gw_folder->cache = camel_data_cache_new (folder_dir ,ex);
+	gw_folder->cache = camel_data_cache_new (folder_dir, error);
 	if (!gw_folder->cache) {
 		g_object_unref (folder);
 		return NULL;
@@ -1094,7 +1088,6 @@ update_update (CamelSession *session, CamelSessionThreadMsg *msg)
 {
 	struct _folder_update_msg *m = (struct _folder_update_msg *)msg;
 	EGwConnectionStatus status;
-	CamelException *ex = NULL;
 	CamelGroupwiseStore *gw_store;
 	CamelStore *parent_store;
 	GList *item_list, *items_full_list = NULL, *last_element=NULL;
@@ -1186,7 +1179,7 @@ update_update (CamelSession *session, CamelSessionThreadMsg *msg)
 	  }*/
 
 	g_print ("\nNumber of items in the folder: %d \n", g_list_length(items_full_list));
-	gw_update_all_items (m->folder, items_full_list, ex);
+	gw_update_all_items (m->folder, items_full_list, NULL);
 	camel_operation_end (NULL);
 
 	return;
@@ -1219,7 +1212,7 @@ static CamelSessionThreadOps update_ops = {
 };
 
 static gboolean
-groupwise_refresh_info(CamelFolder *folder, CamelException *ex)
+groupwise_refresh_info(CamelFolder *folder, GError **error)
 {
 	CamelGroupwiseSummary *summary = (CamelGroupwiseSummary *) folder->summary;
 	CamelStoreInfo *si;
@@ -1238,7 +1231,7 @@ groupwise_refresh_info(CamelFolder *folder, CamelException *ex)
 	 * should not interfere with the process
 	 */
 	if (summary->time_string && (strlen (summary->time_string) > 0))  {
-		groupwise_refresh_folder(folder, ex);
+		groupwise_refresh_folder(folder, error);
 		si = camel_store_summary_path ((CamelStoreSummary *)((CamelGroupwiseStore *)parent_store)->summary, full_name);
 		if (si) {
 			guint32 unread, total;
@@ -1260,7 +1253,7 @@ groupwise_refresh_info(CamelFolder *folder, CamelException *ex)
 		 * so do a get_folder again. And hope that it works
 		 */
 		g_print("Reloading folder...something wrong with the summary....\n");
-		gw_store_reload_folder (gw_store, folder, 0, ex);
+		gw_store_reload_folder (gw_store, folder, 0, error);
 	}
 
 	return TRUE;
@@ -1337,7 +1330,7 @@ get_merge_lists_new_count (CamelGroupwiseSummary *summary, GSList *new, GSList *
 }
 
 static void
-update_summary_string (CamelFolder *folder, const gchar *time_string, CamelException *ex)
+update_summary_string (CamelFolder *folder, const gchar *time_string)
 {
 	CamelGroupwiseSummary *summary = (CamelGroupwiseSummary *) folder->summary;
 
@@ -1346,11 +1339,11 @@ update_summary_string (CamelFolder *folder, const gchar *time_string, CamelExcep
 
 	((CamelGroupwiseSummary *) folder->summary)->time_string = g_strdup (time_string);
 	camel_folder_summary_touch (folder->summary);
-	camel_folder_summary_save_to_db (folder->summary, ex);
+	camel_folder_summary_save_to_db (folder->summary, NULL);
 }
 
 static void
-groupwise_refresh_folder(CamelFolder *folder, CamelException *ex)
+groupwise_refresh_folder(CamelFolder *folder, GError **error)
 {
 	CamelGroupwiseStore *gw_store;
 	CamelGroupwiseFolder *gw_folder;
@@ -1384,7 +1377,7 @@ groupwise_refresh_folder(CamelFolder *folder, CamelException *ex)
 
 	/* Sync-up the (un)read changes before getting updates,
 	so that the getFolderList will reflect the most recent changes too */
-	groupwise_sync_all (folder, FALSE, ex);
+	groupwise_sync_all (folder, FALSE, error);
 
 	if (((CamelOfflineStore *) gw_store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
 		g_warning ("In offline mode. Cannot refresh!!!\n");
@@ -1407,31 +1400,10 @@ groupwise_refresh_folder(CamelFolder *folder, CamelException *ex)
 
 	camel_service_lock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	if (!camel_groupwise_store_connected (gw_store, ex))
+	if (!camel_groupwise_store_connected (gw_store, error))
 		goto end1;
 
 	if (!strcmp (full_name, "Trash")) {
-#if 0
-		status = e_gw_connection_get_items (cnc, container_id, "peek recipient distribution created delivered attachments subject status size", NULL, &list);
-		if (status != E_GW_CONNECTION_STATUS_OK) {
-			if (status ==E_GW_CONNECTION_STATUS_OTHER) {
-				g_warning ("Trash full....Empty Trash!!!!\n");
-				camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Trash Folder Full. Please Empty."));
-				goto end1;
-				/*groupwise_expunge (folder, ex);*/
-			} else
-				camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Authentication failed"));
-			goto end1;
-		}
-		if (list || g_list_length(list)) {
-			camel_folder_summary_clear (folder->summary);
-			gw_update_summary (folder, list, ex);
-			g_list_foreach (list, (GFunc) g_object_unref, NULL);
-			g_list_free (list);
-			list = NULL;
-		}
-		goto end1;
-#endif
 		is_proxy = TRUE;
 	}
 
@@ -1456,8 +1428,9 @@ groupwise_refresh_folder(CamelFolder *folder, CamelException *ex)
 					"peek id",
 					&new_sync_time, "New", NULL, source, -1, &new_items);
 		if (status != E_GW_CONNECTION_STATUS_OK) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SERVICE_INVALID,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_INVALID,
 				_("Authentication failed"));
 			goto end2;
 		}
@@ -1473,7 +1446,10 @@ groupwise_refresh_folder(CamelFolder *folder, CamelException *ex)
 					"peek id",
 					&modified_sync_time, "Modified", NULL, source, -1, &modified_items);
 		if (status != E_GW_CONNECTION_STATUS_OK) {
-			camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Authentication failed"));
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_INVALID,
+				_("Authentication failed"));
 			goto end3;
 		}
 
@@ -1505,10 +1481,10 @@ groupwise_refresh_folder(CamelFolder *folder, CamelException *ex)
 		g_object_unref (container);
 
 		if (list)
-			gw_update_cache (folder, list, ex, FALSE);
+			gw_update_cache (folder, list, error, FALSE);
 
 		/* update the new_sync_time to summary */
-		update_summary_string (folder, new_sync_time, ex);
+		update_summary_string (folder, new_sync_time);
 	}
 
 	camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
@@ -1608,7 +1584,7 @@ groupwise_folder_set_threading_data (CamelGroupwiseMessageInfo *mi, EGwItem *ite
 
 /* Update the GroupWise cache with the list of items passed. should happen in thread. */
 static void
-gw_update_cache (CamelFolder *folder, GList *list, CamelException *ex, gboolean uid_flag)
+gw_update_cache (CamelFolder *folder, GList *list, GError **error, gboolean uid_flag)
 {
 	CamelGroupwiseMessageInfo *mi = NULL;
 	CamelMessageInfo *pmi = NULL;
@@ -1834,17 +1810,17 @@ gw_update_cache (CamelFolder *folder, GList *list, CamelException *ex, gboolean
 		if (folder_needs_caching) {
 				/******************** Begine Caching ************************/
 				/* add to cache if its a new message*/
-				t_cache_stream  = camel_data_cache_get (gw_folder->cache, "cache", id, ex);
+				t_cache_stream  = camel_data_cache_get (gw_folder->cache, "cache", id, error);
 				if (t_cache_stream) {
 						g_object_unref (t_cache_stream);
 
-						mail_msg = groupwise_folder_item_to_msg (folder, item, ex);
+						mail_msg = groupwise_folder_item_to_msg (folder, item, error);
 						if (mail_msg)
 								camel_medium_set_header (CAMEL_MEDIUM (mail_msg), "X-Evolution-Source", groupwise_base_url_lookup (gw_store->priv));
 
 						CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
 						if ((cache_stream = camel_data_cache_add (gw_folder->cache, "cache", id, NULL))) {
-								if (camel_data_wrapper_write_to_stream ((CamelDataWrapper *) mail_msg,	cache_stream) == -1 || camel_stream_flush (cache_stream) == -1)
+								if (camel_data_wrapper_write_to_stream ((CamelDataWrapper *) mail_msg,	cache_stream, NULL) == -1 || camel_stream_flush (cache_stream, NULL) == -1)
 										camel_data_cache_remove (gw_folder->cache, "cache", id, NULL);
 								g_object_unref (cache_stream);
 						}
@@ -1861,7 +1837,7 @@ gw_update_cache (CamelFolder *folder, GList *list, CamelException *ex, gboolean
 	camel_operation_end (NULL);
 	g_free (container_id);
 	g_string_free (str, TRUE);
-	groupwise_sync_summary (folder, ex);
+	groupwise_sync_summary (folder, error);
 
 	camel_folder_changed (folder, changes);
 	camel_folder_change_info_free (changes);
@@ -1900,7 +1876,7 @@ get_from_from_org (EGwItemOrganizer *org)
 
 /* Update summary, if there is none existing, create one */
 void
-gw_update_summary (CamelFolder *folder, GList *list,CamelException *ex)
+gw_update_summary (CamelFolder *folder, GList *list,GError **error)
 {
 	CamelGroupwiseMessageInfo *mi = NULL;
 	CamelGroupwiseStore *gw_store;
@@ -2076,7 +2052,7 @@ gw_update_summary (CamelFolder *folder, GList *list,CamelException *ex)
 static CamelMimeMessage *
 groupwise_folder_item_to_msg( CamelFolder *folder,
 		EGwItem *item,
-		CamelException *ex )
+		GError **error )
 {
 	CamelMimeMessage *msg = NULL;
 	CamelGroupwiseStore *gw_store;
@@ -2127,8 +2103,9 @@ groupwise_folder_item_to_msg( CamelFolder *folder,
 					(const gchar **)&attachment, &len);
 			if (status != E_GW_CONNECTION_STATUS_OK) {
 				g_warning ("Could not get attachment\n");
-				camel_exception_set (
-					ex, CAMEL_EXCEPTION_SERVICE_INVALID,
+				g_set_error (
+					error, CAMEL_SERVICE_ERROR,
+					CAMEL_SERVICE_ERROR_INVALID,
 					_("Could not get message"));
 				return NULL;
 			}
@@ -2180,8 +2157,9 @@ groupwise_folder_item_to_msg( CamelFolder *folder,
 								(const gchar **)&attachment, &len);
 						if (status != E_GW_CONNECTION_STATUS_OK) {
 							g_warning ("Could not get attachment\n");
-							camel_exception_set (
-								ex, CAMEL_EXCEPTION_SERVICE_INVALID,
+							g_set_error (
+								error, CAMEL_SERVICE_ERROR,
+								CAMEL_SERVICE_ERROR_INVALID,
 								_("Could not get message"));
 							return NULL;
 						}
@@ -2199,7 +2177,7 @@ groupwise_folder_item_to_msg( CamelFolder *folder,
 	msg = camel_mime_message_new ();
 	if (has_mime_822 && body) {
 		temp_stream = camel_stream_mem_new_with_buffer (body, body_len);
-		if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) msg, temp_stream) == -1) {
+		if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) msg, temp_stream, error) == -1) {
 			g_object_unref (msg);
 			g_object_unref (temp_stream);
 			msg = NULL;
@@ -2292,7 +2270,7 @@ groupwise_folder_item_to_msg( CamelFolder *folder,
 					g_warning ("Could not get attachment\n");
 					continue;
 				}
-				temp_msg = groupwise_folder_item_to_msg(folder, temp_item, ex);
+				temp_msg = groupwise_folder_item_to_msg(folder, temp_item, error);
 				if (temp_msg) {
 					CamelContentType *ct = camel_content_type_new("message", "rfc822");
 					part = camel_mime_part_new ();
@@ -2410,7 +2388,7 @@ end:
 }
 
 static void
-gw_update_all_items (CamelFolder *folder, GList *item_list, CamelException *ex)
+gw_update_all_items (CamelFolder *folder, GList *item_list, GError **error)
 {
 	CamelGroupwiseFolder *gw_folder = CAMEL_GROUPWISE_FOLDER (folder);
 	GPtrArray *summary = NULL;
@@ -2445,7 +2423,7 @@ gw_update_all_items (CamelFolder *folder, GList *item_list, CamelException *ex)
 		index ++;
 	}
 
-	groupwise_sync_summary (folder, ex);
+	groupwise_sync_summary (folder, error);
 	camel_folder_changed (folder, changes);
 
 	if (item_list) {
@@ -2454,7 +2432,7 @@ gw_update_all_items (CamelFolder *folder, GList *item_list, CamelException *ex)
 		parent_store = camel_folder_get_parent_store (folder);
 
 		camel_service_lock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-		gw_update_cache (folder, item_list, ex, TRUE);
+		gw_update_cache (folder, item_list, error, TRUE);
 		camel_service_unlock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
 		g_list_foreach (item_list, (GFunc)g_free, NULL);
@@ -2467,7 +2445,7 @@ gw_update_all_items (CamelFolder *folder, GList *item_list, CamelException *ex)
 static gboolean
 groupwise_append_message (CamelFolder *folder, CamelMimeMessage *message,
 		const CamelMessageInfo *info, gchar **appended_uid,
-		CamelException *ex)
+		GError **error)
 {
 	const gchar *container_id = NULL;
 	CamelGroupwiseStore *gw_store;
@@ -2491,8 +2469,8 @@ groupwise_append_message (CamelFolder *folder, CamelMimeMessage *message,
 		is_ok = TRUE;
 
 	if (!is_ok) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot append message to folder '%s': %s"),
 			full_name, e_gw_connection_get_error_message (status));
 		return FALSE;
@@ -2502,7 +2480,7 @@ groupwise_append_message (CamelFolder *folder, CamelMimeMessage *message,
 	offline = CAMEL_OFFLINE_STORE (parent_store);
 
 	if (offline->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
-		camel_groupwise_journal_append ((CamelGroupwiseJournal *) ((CamelGroupwiseFolder *)folder)->journal, message, info, appended_uid, ex);
+		camel_groupwise_journal_append ((CamelGroupwiseJournal *) ((CamelGroupwiseFolder *)folder)->journal, message, info, appended_uid, error);
 		return FALSE;
 	}
 	cnc = cnc_lookup (gw_store->priv);
@@ -2527,8 +2505,9 @@ groupwise_append_message (CamelFolder *folder, CamelMimeMessage *message,
 
 	status = e_gw_connection_create_item (cnc, item, &id);
 	if (status != E_GW_CONNECTION_STATUS_OK) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot create message: %s"),
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+			_("Cannot create message: %s"),
 			e_gw_connection_get_error_message (status));
 
 		if (appended_uid)
@@ -2540,8 +2519,8 @@ groupwise_append_message (CamelFolder *folder, CamelMimeMessage *message,
 	status = e_gw_connection_add_item (cnc, container_id, id);
 	g_message ("Adding %s to %s", id, container_id);
 	if (status != E_GW_CONNECTION_STATUS_OK) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot append message to folder '%s': %s"),
 			full_name, e_gw_connection_get_error_message (status));
 
@@ -2582,7 +2561,7 @@ uid_compar (gconstpointer va, gconstpointer vb)
 static gboolean
 groupwise_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
 		CamelFolder *destination, GPtrArray **transferred_uids,
-		gboolean delete_originals, CamelException *ex)
+		gboolean delete_originals, GError **error)
 {
 	gint count, index = 0;
 	GList *item_ids = NULL;
@@ -2643,23 +2622,25 @@ groupwise_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
 
 		for (l = item_ids, i = 0; l; l = l->next, i++) {
 			CamelMessageInfo *info;
+			gboolean success;
 
 			if (!(info = camel_folder_summary_uid (source->summary, uids->pdata[i])))
 				continue;
 
-			if (!(message = groupwise_folder_get_message (source, camel_message_info_uid (info), ex)))
+			if (!(message = groupwise_folder_get_message (source, camel_message_info_uid (info), error)))
 				break;
 
-			camel_groupwise_journal_transfer (journal, (CamelGroupwiseFolder *)source, message, info, uids->pdata[i], NULL, ex);
+			success = camel_groupwise_journal_transfer (journal, (CamelGroupwiseFolder *)source, message, info, uids->pdata[i], NULL, error);
 			g_object_unref (message);
 
-			if (camel_exception_is_set (ex))
+			if (!success)
 				break;
 
 			if (delete_originals) {
 				if (!strcmp(source_full_name, SENT)) {
-					camel_exception_set (
-						ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+					g_set_error (
+						error, CAMEL_SERVICE_ERROR,
+						CAMEL_SERVICE_ERROR_UNAVAILABLE,
 						_("This message is not available in offline mode."));
 
 				} else {
@@ -2779,7 +2760,7 @@ groupwise_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
 
 	/* Refresh the destination folder, if its not refreshed already */
 	if (gw_store->current_folder != destination )
-		camel_folder_refresh_info (destination, ex);
+		camel_folder_refresh_info (destination, error);
 
 	camel_folder_summary_touch (source->summary);
 	camel_folder_summary_touch (destination->summary);
@@ -2792,7 +2773,7 @@ groupwise_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
 }
 
 static gboolean
-groupwise_expunge (CamelFolder *folder, CamelException *ex)
+groupwise_expunge (CamelFolder *folder, GError **error)
 {
 	CamelGroupwiseStore *gw_store;
 	CamelGroupwiseFolder *gw_folder;
@@ -2836,7 +2817,7 @@ groupwise_expunge (CamelFolder *folder, CamelException *ex)
 
 	container_id =  g_strdup (camel_groupwise_store_container_id_lookup (gw_store, full_name));
 
-	camel_folder_summary_prepare_fetch_all (folder->summary, ex);
+	camel_folder_summary_prepare_fetch_all (folder->summary, error);
 	max = camel_folder_summary_count (folder->summary);
 	for (i = 0; i < max; i++) {
 		info = camel_folder_summary_index (folder->summary, i);
diff --git a/camel/providers/groupwise/camel-groupwise-folder.h b/camel/providers/groupwise/camel-groupwise-folder.h
index 53ad62e..1480b57 100644
--- a/camel/providers/groupwise/camel-groupwise-folder.h
+++ b/camel/providers/groupwise/camel-groupwise-folder.h
@@ -78,8 +78,8 @@ struct _CamelGroupwiseFolderClass {
 GType camel_groupwise_folder_get_type (void);
 
 /* implemented */
-CamelFolder * camel_gw_folder_new(CamelStore *store, const gchar *folder_dir, const gchar *folder_name, CamelException *ex);
-void gw_update_summary ( CamelFolder *folder, GList *item_list,CamelException *ex);
+CamelFolder * camel_gw_folder_new(CamelStore *store, const gchar *folder_dir, const gchar *folder_name, GError **error);
+void gw_update_summary ( CamelFolder *folder, GList *item_list,GError **error);
 
 G_END_DECLS
 
diff --git a/camel/providers/groupwise/camel-groupwise-journal.c b/camel/providers/groupwise/camel-groupwise-journal.c
index 9f1cb2c..e4c4e55 100644
--- a/camel/providers/groupwise/camel-groupwise-journal.c
+++ b/camel/providers/groupwise/camel-groupwise-journal.c
@@ -44,7 +44,7 @@
 static void groupwise_entry_free (CamelOfflineJournal *journal, CamelDListNode *entry);
 static CamelDListNode *groupwise_entry_load (CamelOfflineJournal *journal, FILE *in);
 static gint groupwise_entry_write (CamelOfflineJournal *journal, CamelDListNode *entry, FILE *out);
-static gint groupwise_entry_play (CamelOfflineJournal *journal, CamelDListNode *entry, CamelException *ex);
+static gint groupwise_entry_play (CamelOfflineJournal *journal, CamelDListNode *entry, GError **error);
 
 G_DEFINE_TYPE (CamelGroupwiseJournal, camel_groupwise_journal, CAMEL_TYPE_OFFLINE_JOURNAL)
 
@@ -156,21 +156,23 @@ gw_message_info_dup_to (CamelMessageInfoBase *dest, CamelMessageInfoBase *src)
 }
 
 static gint
-groupwise_entry_play_append (CamelOfflineJournal *journal, CamelGroupwiseJournalEntry *entry, CamelException *ex)
+groupwise_entry_play_append (CamelOfflineJournal *journal, CamelGroupwiseJournalEntry *entry, GError **error)
 {
 	CamelGroupwiseFolder *gw_folder = (CamelGroupwiseFolder *) journal->folder;
 	CamelFolder *folder = journal->folder;
 	CamelMimeMessage *message;
 	CamelMessageInfo *info;
 	CamelStream *stream;
-	gboolean success;
+	gboolean success = FALSE;
 
 	/* if the message isn't in the cache, the user went behind our backs so "not our problem" */
-	if (!gw_folder->cache || !(stream = camel_data_cache_get (gw_folder->cache, "cache", entry->uid, ex)))
+	if (!gw_folder->cache || !(stream = camel_data_cache_get (gw_folder->cache, "cache", entry->uid, error))) {
+		success = TRUE;
 		goto done;
+	}
 
 	message = camel_mime_message_new ();
-	if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream) == -1) {
+	if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream, error) == -1) {
 		g_object_unref (message);
 		g_object_unref (stream);
 		goto done;
@@ -183,23 +185,20 @@ groupwise_entry_play_append (CamelOfflineJournal *journal, CamelGroupwiseJournal
 		info = camel_message_info_new (NULL);
 	}
 
-	success = camel_folder_append_message (folder, message, info, NULL, ex);
+	success = camel_folder_append_message (folder, message, info, NULL, error);
 	camel_message_info_free (info);
 	g_object_unref (message);
 
-	if (!success)
-		return -1;
-
- done:
+done:
 
 	camel_folder_summary_remove_uid (folder->summary, entry->uid);
 	camel_data_cache_remove (gw_folder->cache, "cache", entry->uid, NULL);
 
-	return 0;
+	return (success == 0);
 }
 
 static gint
-groupwise_entry_play_transfer (CamelOfflineJournal *journal, CamelGroupwiseJournalEntry *entry, CamelException *ex)
+groupwise_entry_play_transfer (CamelOfflineJournal *journal, CamelGroupwiseJournalEntry *entry, GError **error)
 {
 	CamelGroupwiseFolder *gw_folder = (CamelGroupwiseFolder *) journal->folder;
 	CamelFolder *folder = journal->folder;
@@ -218,11 +217,11 @@ groupwise_entry_play_transfer (CamelOfflineJournal *journal, CamelGroupwiseJourn
 	}
 
 	name = camel_groupwise_store_folder_lookup ((CamelGroupwiseStore *) parent_store, entry->source_container);
-	if (name && (src = camel_store_get_folder (parent_store, name, 0, ex))) {
+	if (name && (src = camel_store_get_folder (parent_store, name, 0, error))) {
 		uids = g_ptr_array_sized_new (1);
 		g_ptr_array_add (uids, entry->original_uid);
 
-		if (camel_folder_transfer_messages_to (src, uids, folder, &xuids, FALSE, ex)) {
+		if (camel_folder_transfer_messages_to (src, uids, folder, &xuids, FALSE, error)) {
 			real = (CamelGroupwiseMessageInfo *) camel_folder_summary_uid (folder->summary, xuids->pdata[0]);
 
 			/* transfer all the system flags, user flags/tags, etc */
@@ -236,8 +235,8 @@ groupwise_entry_play_transfer (CamelOfflineJournal *journal, CamelGroupwiseJourn
 		g_ptr_array_free (uids, TRUE);
 		g_object_unref (src);
 	} else if (!name) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot get folder container %s"),
 			entry->source_container);
 		goto exception;
@@ -258,15 +257,15 @@ groupwise_entry_play_transfer (CamelOfflineJournal *journal, CamelGroupwiseJourn
 }
 
 static gint
-groupwise_entry_play (CamelOfflineJournal *journal, CamelDListNode *entry, CamelException *ex)
+groupwise_entry_play (CamelOfflineJournal *journal, CamelDListNode *entry, GError **error)
 {
 	CamelGroupwiseJournalEntry *groupwise_entry = (CamelGroupwiseJournalEntry *) entry;
 
 	switch (groupwise_entry->type) {
 	case CAMEL_GROUPWISE_JOURNAL_ENTRY_APPEND:
-		return groupwise_entry_play_append (journal, groupwise_entry, ex);
+		return groupwise_entry_play_append (journal, groupwise_entry, error);
 	case CAMEL_GROUPWISE_JOURNAL_ENTRY_TRANSFER:
-		return groupwise_entry_play_transfer (journal, groupwise_entry, ex);
+		return groupwise_entry_play_transfer (journal, groupwise_entry, error);
 	default:
 		g_assert_not_reached ();
 		return -1;
@@ -288,7 +287,7 @@ camel_groupwise_journal_new (CamelGroupwiseFolder *folder, const gchar *filename
 
 static gboolean
 update_cache (CamelGroupwiseJournal *groupwise_journal, CamelMimeMessage *message,
-	      const CamelMessageInfo *mi, gchar **updated_uid, CamelException *ex)
+	      const CamelMessageInfo *mi, gchar **updated_uid, GError **error)
 {
 	CamelOfflineJournal *journal = (CamelOfflineJournal *) groupwise_journal;
 	CamelGroupwiseFolder *groupwise_folder = (CamelGroupwiseFolder *) journal->folder;
@@ -299,8 +298,8 @@ update_cache (CamelGroupwiseJournal *groupwise_journal, CamelMimeMessage *messag
 	gchar *uid;
 
 	if (groupwise_folder->cache == NULL) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot append message in offline mode: cache unavailable"));
 		return FALSE;
 	}
@@ -308,18 +307,17 @@ update_cache (CamelGroupwiseJournal *groupwise_journal, CamelMimeMessage *messag
 	nextuid = camel_folder_summary_next_uid (folder->summary);
 	uid = g_strdup_printf ("-%u", nextuid);
 
-	if (!(cache = camel_data_cache_add (groupwise_folder->cache, "cache", uid, ex))) {
+	if (!(cache = camel_data_cache_add (groupwise_folder->cache, "cache", uid, error))) {
 		folder->summary->nextuid--;
 		g_free (uid);
 		return FALSE;
 	}
 
-	if (camel_data_wrapper_write_to_stream ((CamelDataWrapper *) message, cache) == -1
-	    || camel_stream_flush (cache) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Cannot append message in offline mode: %s"),
-			g_strerror (errno));
+	if (camel_data_wrapper_write_to_stream (
+		(CamelDataWrapper *) message, cache, error) == -1
+	    || camel_stream_flush (cache, error) == -1) {
+		g_prefix_error (
+			error, _("Cannot append message in offline mode: "));
 		camel_data_cache_remove (groupwise_folder->cache, "cache", uid, NULL);
 		folder->summary->nextuid--;
 		g_object_unref (cache);
@@ -345,16 +343,16 @@ update_cache (CamelGroupwiseJournal *groupwise_journal, CamelMimeMessage *messag
 	return TRUE;
 }
 
-void
+gboolean
 camel_groupwise_journal_append (CamelGroupwiseJournal *groupwise_journal, CamelMimeMessage *message,
-				const CamelMessageInfo *mi, gchar **appended_uid, CamelException *ex)
+				const CamelMessageInfo *mi, gchar **appended_uid, GError **error)
 {
 	CamelOfflineJournal *journal = (CamelOfflineJournal *) groupwise_journal;
 	CamelGroupwiseJournalEntry *entry;
 	gchar *uid;
 
-	if (!update_cache (groupwise_journal, message, mi, &uid, ex))
-		return;
+	if (!update_cache (groupwise_journal, message, mi, &uid, error))
+		return FALSE;
 
 	entry = g_new (CamelGroupwiseJournalEntry, 1);
 	entry->type = CAMEL_GROUPWISE_JOURNAL_ENTRY_APPEND;
@@ -364,13 +362,15 @@ camel_groupwise_journal_append (CamelGroupwiseJournal *groupwise_journal, CamelM
 
 	if (appended_uid)
 		*appended_uid = g_strdup (uid);
+
+	return TRUE;
 }
 
-void
+gboolean
 camel_groupwise_journal_transfer (CamelGroupwiseJournal *groupwise_journal, CamelGroupwiseFolder *source_folder,
 				  CamelMimeMessage *message,  const CamelMessageInfo *mi,
 				  const gchar *original_uid, gchar **transferred_uid,
-				  CamelException *ex)
+				  GError **error)
 {
 	CamelOfflineJournal *journal = (CamelOfflineJournal *) groupwise_journal;
 	CamelGroupwiseStore *gw_store;
@@ -381,8 +381,8 @@ camel_groupwise_journal_transfer (CamelGroupwiseJournal *groupwise_journal, Came
 	parent_store = camel_folder_get_parent_store (journal->folder);
 	gw_store = CAMEL_GROUPWISE_STORE (parent_store);
 
-	if (!update_cache (groupwise_journal, message, mi, &uid, ex))
-		return;
+	if (!update_cache (groupwise_journal, message, mi, &uid, error))
+		return FALSE;
 
 	entry = g_new (CamelGroupwiseJournalEntry, 1);
 	entry->type = CAMEL_GROUPWISE_JOURNAL_ENTRY_APPEND;
@@ -394,4 +394,6 @@ camel_groupwise_journal_transfer (CamelGroupwiseJournal *groupwise_journal, Came
 
 	if (transferred_uid)
 		*transferred_uid = g_strdup (uid);
+
+	return TRUE;
 }
diff --git a/camel/providers/groupwise/camel-groupwise-journal.h b/camel/providers/groupwise/camel-groupwise-journal.h
index d6246ea..a58e31f 100644
--- a/camel/providers/groupwise/camel-groupwise-journal.h
+++ b/camel/providers/groupwise/camel-groupwise-journal.h
@@ -83,10 +83,10 @@ GType camel_groupwise_journal_get_type (void);
 CamelOfflineJournal *camel_groupwise_journal_new (struct _CamelGroupwiseFolder *folder, const gchar *filename);
 
 /* interfaces for adding a journal entry */
-void camel_groupwise_journal_append (CamelGroupwiseJournal *journal, CamelMimeMessage *message, const CamelMessageInfo *mi,
-				     gchar **appended_uid, CamelException *ex);
-void camel_groupwise_journal_transfer (CamelGroupwiseJournal *journal, CamelGroupwiseFolder *source_folder, CamelMimeMessage *message,
-				       const CamelMessageInfo *mi, const gchar *orginal_uid, gchar **transferred_uid, CamelException *ex);
+gboolean camel_groupwise_journal_append (CamelGroupwiseJournal *journal, CamelMimeMessage *message, const CamelMessageInfo *mi,
+				     gchar **appended_uid, GError **error);
+gboolean camel_groupwise_journal_transfer (CamelGroupwiseJournal *journal, CamelGroupwiseFolder *source_folder, CamelMimeMessage *message,
+				       const CamelMessageInfo *mi, const gchar *orginal_uid, gchar **transferred_uid, GError **error);
 
 G_END_DECLS
 
diff --git a/camel/providers/groupwise/camel-groupwise-provider.c b/camel/providers/groupwise/camel-groupwise-provider.c
index e3a5d36..511a3df 100644
--- a/camel/providers/groupwise/camel-groupwise-provider.c
+++ b/camel/providers/groupwise/camel-groupwise-provider.c
@@ -106,7 +106,7 @@ CamelServiceAuthType camel_groupwise_password_authtype = {
 
 static gint
 groupwise_auto_detect_cb (CamelURL *url, GHashTable **auto_detected,
-			 CamelException *ex)
+			 GError **error)
 {
 	*auto_detected = g_hash_table_new (g_str_hash, g_str_equal);
 
@@ -120,11 +120,10 @@ void
 camel_provider_module_init(void)
 {
 	CamelProvider *imap_provider = NULL;
-	CamelException ex = CAMEL_EXCEPTION_INITIALISER;
 	gboolean use_imap = g_getenv ("USE_IMAP") != NULL;
 
 	if (use_imap)
-	    imap_provider = camel_provider_get("imapx://", &ex);
+		imap_provider = camel_provider_get("imapx://", NULL);
 
 	groupwise_provider.url_hash = groupwise_url_hash;
 	groupwise_provider.url_equal = groupwise_url_equal;
diff --git a/camel/providers/groupwise/camel-groupwise-store.c b/camel/providers/groupwise/camel-groupwise-store.c
index 5362acb..116d53e 100644
--- a/camel/providers/groupwise/camel-groupwise-store.c
+++ b/camel/providers/groupwise/camel-groupwise-store.c
@@ -75,8 +75,8 @@ struct _CamelGroupwiseStorePrivate {
 };
 
 extern CamelServiceAuthType camel_groupwise_password_authtype; /*for the query_auth_types function*/
-static CamelFolderInfo *convert_to_folder_info (CamelGroupwiseStore *store, EGwContainer *container, const gchar *url, CamelException *ex);
-static gboolean groupwise_folders_sync (CamelGroupwiseStore *store, CamelException *ex);
+static CamelFolderInfo *convert_to_folder_info (CamelGroupwiseStore *store, EGwContainer *container, const gchar *url, GError **error);
+static gboolean groupwise_folders_sync (CamelGroupwiseStore *store, GError **error);
 static gint match_path(const gchar *path, const gchar *name);
 
 G_DEFINE_TYPE (CamelGroupwiseStore, camel_groupwise_store, CAMEL_TYPE_OFFLINE_STORE)
@@ -84,7 +84,7 @@ G_DEFINE_TYPE (CamelGroupwiseStore, camel_groupwise_store, CAMEL_TYPE_OFFLINE_ST
 static gboolean
 groupwise_store_construct (CamelService *service, CamelSession *session,
 			   CamelProvider *provider, CamelURL *url,
-			   CamelException *ex)
+			   GError **error)
 {
 	CamelServiceClass *service_class;
 	CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (service);
@@ -97,17 +97,18 @@ groupwise_store_construct (CamelService *service, CamelSession *session,
 
 	/* Chain up to parent's construct() method. */
 	service_class = CAMEL_SERVICE_CLASS (camel_groupwise_store_parent_class);
-	if (!service_class->construct (service, session, provider, url, ex))
+	if (!service_class->construct (service, session, provider, url, error))
 		return FALSE;
 
 	if (!(url->host || url->user)) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SERVICE_INVALID,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_INVALID,
 			_("Host or user not available in url"));
 	}
 
 	/*storage path*/
-	priv->storage_path = camel_session_get_storage_path (session, service, ex);
+	priv->storage_path = camel_session_get_storage_path (session, service, error);
 	if (!priv->storage_path)
 		return FALSE;
 
@@ -170,7 +171,7 @@ groupwise_compare_folder_name (gconstpointer a, gconstpointer b)
 }
 
 static gboolean
-groupwise_auth_loop (CamelService *service, CamelException *ex)
+groupwise_auth_loop (CamelService *service, GError **error)
 {
 	CamelSession *session = camel_service_get_session (service);
 	CamelStore *store = CAMEL_STORE (service);
@@ -196,12 +197,13 @@ groupwise_auth_loop (CamelService *service, CamelException *ex)
 				"GroupWise", service->url->user, service->url->host);
 			service->url->passwd =
 				camel_session_get_password (session, service, "Groupwise",
-							    prompt, "password", prompt_flags, ex);
+							    prompt, "password", prompt_flags, error);
 			g_free (prompt);
 
 			if (!service->url->passwd) {
-				camel_exception_set (
-					ex, CAMEL_EXCEPTION_USER_CANCEL,
+				g_set_error (
+					error, G_IO_ERROR,
+					G_IO_ERROR_CANCELLED,
 					_("You did not enter a password."));
 				return FALSE;
 			}
@@ -219,11 +221,11 @@ groupwise_auth_loop (CamelService *service, CamelException *ex)
 				prompt_flags |= CAMEL_SESSION_PASSWORD_REPROMPT;
 				g_free (service->url->passwd);
 				service->url->passwd = NULL;
-				camel_exception_clear (ex);
 			} else {
-				camel_exception_set (
-					ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-					errors.description ?
+				g_set_error (
+					error, CAMEL_SERVICE_ERROR,
+					CAMEL_SERVICE_ERROR_UNAVAILABLE,
+					"%s", errors.description ?
 					errors.description :
 					_("You must be working online to complete this operation"));
 				return FALSE;
@@ -237,22 +239,26 @@ groupwise_auth_loop (CamelService *service, CamelException *ex)
 }
 
 static gboolean
-check_for_connection (CamelService *service, CamelException *ex)
+check_for_connection (CamelService *service, GError **error)
 {
 	CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (service);
 	CamelGroupwiseStorePrivate *priv = groupwise_store->priv;
 	struct addrinfo hints, *ai;
+	GError *local_error = NULL;
 
 	memset (&hints, 0, sizeof(hints));
 	hints.ai_socktype = SOCK_STREAM;
 	hints.ai_family = PF_UNSPEC;
-	ai = camel_getaddrinfo(priv->server_name, "groupwise", &hints, ex);
-	if (ai == NULL && priv->port != NULL && camel_exception_get_id(ex) != CAMEL_EXCEPTION_USER_CANCEL) {
-		camel_exception_clear (ex);
-		ai = camel_getaddrinfo(priv->server_name, priv->port, &hints, ex);
+	ai = camel_getaddrinfo(priv->server_name, "groupwise", &hints, &local_error);
+	if (ai == NULL && priv->port != NULL && g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+		g_clear_error (&local_error);
+		ai = camel_getaddrinfo(priv->server_name, priv->port, &hints, &local_error);
 	}
-	if (ai == NULL)
+
+	if (ai == NULL) {
+		g_propagate_error (error, local_error);
 		return FALSE;
+	}
 
 	camel_freeaddrinfo (ai);
 
@@ -279,7 +285,7 @@ groupwise_store_set_current_folder (CamelGroupwiseStore *groupwise_store, CamelF
 }
 
 static gboolean
-groupwise_connect (CamelService *service, CamelException *ex)
+groupwise_connect (CamelService *service, GError **error)
 {
 	CamelGroupwiseStore *store = CAMEL_GROUPWISE_STORE (service);
 	CamelGroupwiseStorePrivate *priv = store->priv;
@@ -297,7 +303,7 @@ groupwise_connect (CamelService *service, CamelException *ex)
 	if (!priv) {
 		store->priv = g_new0 (CamelGroupwiseStorePrivate, 1);
 		priv = store->priv;
-		camel_service_construct (service, service->session, service->provider, service->url, ex);
+		camel_service_construct (service, service->session, service->provider, service->url, error);
 	}
 
 	camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
@@ -307,7 +313,7 @@ groupwise_connect (CamelService *service, CamelException *ex)
 		return TRUE;
 	}
 
-	if (!check_for_connection (service, ex) || !groupwise_auth_loop (service, ex)) {
+	if (!check_for_connection (service, error) || !groupwise_auth_loop (service, error)) {
 		camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
 		camel_service_disconnect (service, TRUE, NULL);
 		return FALSE;
@@ -344,7 +350,7 @@ groupwise_connect (CamelService *service, CamelException *ex)
 }
 #if 0
 static void
-groupwise_disconnect_cleanup (CamelService *service, gboolean clean, CamelException *ex)
+groupwise_disconnect_cleanup (CamelService *service, gboolean clean, GError **error)
 {
 	CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (service);
 	CamelGroupwiseStorePrivate *priv = groupwise_store->priv;
@@ -398,7 +404,7 @@ groupwise_disconnect_cleanup (CamelService *service, gboolean clean, CamelExcept
 #endif
 
 static gboolean
-groupwise_disconnect (CamelService *service, gboolean clean, CamelException *ex)
+groupwise_disconnect (CamelService *service, gboolean clean, GError **error)
 {
 	CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (service);
 
@@ -419,7 +425,7 @@ groupwise_disconnect (CamelService *service, gboolean clean, CamelException *ex)
 }
 
 static  GList*
-groupwise_store_query_auth_types (CamelService *service, CamelException *ex)
+groupwise_store_query_auth_types (CamelService *service, GError **error)
 {
 	GList *auth_types = NULL;
 
@@ -492,7 +498,7 @@ groupwise_build_folder_info(CamelGroupwiseStore *gw_store, const gchar *parent_n
 }
 
 static void
-groupwise_forget_folder (CamelGroupwiseStore *gw_store, const gchar *folder_name, CamelException *ex)
+groupwise_forget_folder (CamelGroupwiseStore *gw_store, const gchar *folder_name, GError **error)
 {
 	CamelGroupwiseStorePrivate *priv = gw_store->priv;
 	gchar *state_file;
@@ -526,7 +532,7 @@ groupwise_forget_folder (CamelGroupwiseStore *gw_store, const gchar *folder_name
 }
 
 static CamelFolder *
-groupwise_get_folder_from_disk (CamelStore *store, const gchar *folder_name, guint32 flags, CamelException *ex)
+groupwise_get_folder_from_disk (CamelStore *store, const gchar *folder_name, guint32 flags, GError **error)
 {
 	CamelGroupwiseStore *gw_store = CAMEL_GROUPWISE_STORE (store);
 	CamelGroupwiseStorePrivate *priv = gw_store->priv;
@@ -538,20 +544,21 @@ groupwise_get_folder_from_disk (CamelStore *store, const gchar *folder_name, gui
 	g_free(storage_path);
 	if (!folder_dir || g_access (folder_dir, F_OK) != 0) {
 		g_free (folder_dir);
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("No such folder %s"), folder_name);
 		return NULL;
 	}
 
-	folder = camel_gw_folder_new (store, folder_name, folder_dir, ex);
+	folder = camel_gw_folder_new (store, folder_name, folder_dir, error);
 	g_free (folder_dir);
 
 	return folder;
 }
 
 static CamelFolder *
-groupwise_get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, CamelException *ex)
+groupwise_get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, GError **error)
 {
 	CamelGroupwiseStore *gw_store = CAMEL_GROUPWISE_STORE (store);
 	CamelGroupwiseStorePrivate *priv = gw_store->priv;
@@ -566,25 +573,23 @@ groupwise_get_folder (CamelStore *store, const gchar *folder_name, guint32 flags
 	CamelStoreInfo *si = NULL;
 	guint total = 0;
 
-	folder = groupwise_get_folder_from_disk (store, folder_name, flags, ex);
+	folder = groupwise_get_folder_from_disk (store, folder_name, flags, error);
 	if (folder) {
 		groupwise_store_set_current_folder (gw_store, folder);
 		return folder;
 	}
 
-	camel_exception_clear (ex);
-
 	camel_service_lock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
 	groupwise_store_set_current_folder (gw_store, NULL);
 
-	if (!camel_groupwise_store_connected (gw_store, ex)) {
+	if (!camel_groupwise_store_connected (gw_store, error)) {
 		camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 		return NULL;
 	}
 
 	if (!E_IS_GW_CONNECTION( priv->cnc)) {
-		if (!groupwise_connect (CAMEL_SERVICE(store), ex)) {
+		if (!groupwise_connect (CAMEL_SERVICE(store), error)) {
 			camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 			return NULL;
 		}
@@ -595,11 +600,12 @@ groupwise_get_folder (CamelStore *store, const gchar *folder_name, guint32 flags
 	storage_path = g_strdup_printf("%s/folders", priv->storage_path);
 	folder_dir = e_path_to_physical (storage_path, folder_name);
 	g_free(storage_path);
-	folder = camel_gw_folder_new (store, folder_name, folder_dir, ex);
+	folder = camel_gw_folder_new (store, folder_name, folder_dir, NULL);
 	if (!folder) {
 		camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SERVICE_INVALID,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_INVALID,
 			_("Authentication failed"));
 		g_free (folder_dir);
 		g_free (container_id);
@@ -647,16 +653,6 @@ groupwise_get_folder (CamelStore *store, const gchar *folder_name, guint32 flags
 				if (status != E_GW_CONNECTION_STATUS_OK) {
 						all_ok = FALSE;
 						break;
-						/*
-						   camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-						   e_gw_connection_destroy_cursor (priv->cnc, container_id, cursor);
-						//camel_folder_summary_clear (folder->summary);
-						camel_folder_summary_save_to_db (folder->summary, ex);
-						camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Authentication failed"));
-						camel_operation_end (NULL);
-						g_object_unref (folder);
-						g_free (container_id);
-						return NULL;*/
 				}
 
 				/* This full block is repeated in the reload_folder code as well. We need
@@ -672,7 +668,7 @@ groupwise_get_folder (CamelStore *store, const gchar *folder_name, guint32 flags
 						camel_operation_progress (NULL, (100*count)/total);
 				}
 
-				gw_update_summary (folder, list,  ex);
+				gw_update_summary (folder, list,  error);
 
 				/* For shared-folders created by the user, we don't get the total number of messages,
 				in the getFolderList call. So, we need to wait until an empty list is returned in the
@@ -696,7 +692,7 @@ groupwise_get_folder (CamelStore *store, const gchar *folder_name, guint32 flags
 		summary->time_string = g_strdup (e_gw_connection_get_server_time (priv->cnc));
 	}
 
-	camel_folder_summary_save_to_db (folder->summary, ex);
+	camel_folder_summary_save_to_db (folder->summary, NULL);
 
 	groupwise_store_set_current_folder (gw_store, folder);
 
@@ -706,8 +702,8 @@ groupwise_get_folder (CamelStore *store, const gchar *folder_name, guint32 flags
 	return folder;
 }
 
-void
-gw_store_reload_folder (CamelGroupwiseStore *gw_store, CamelFolder *folder, guint32 flags, CamelException *ex)
+gboolean
+gw_store_reload_folder (CamelGroupwiseStore *gw_store, CamelFolder *folder, guint32 flags, GError **error)
 {
 	CamelGroupwiseStorePrivate *priv = gw_store->priv;
 	CamelGroupwiseSummary *summary;
@@ -725,19 +721,17 @@ gw_store_reload_folder (CamelGroupwiseStore *gw_store, CamelFolder *folder, guin
 	name = camel_folder_get_name (folder);
 	full_name = camel_folder_get_full_name (folder);
 
-	camel_exception_clear (ex);
-
 	camel_service_lock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	if (!camel_groupwise_store_connected (gw_store, ex)) {
+	if (!camel_groupwise_store_connected (gw_store, error)) {
 		camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-		return;
+		return FALSE;
 	}
 
 	if (!E_IS_GW_CONNECTION( priv->cnc)) {
-		if (!groupwise_connect (CAMEL_SERVICE((CamelStore*)gw_store), ex)) {
+		if (!groupwise_connect (CAMEL_SERVICE((CamelStore*)gw_store), error)) {
 			camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-			return;
+			return FALSE;
 		}
 	}
 
@@ -751,7 +745,7 @@ gw_store_reload_folder (CamelGroupwiseStore *gw_store, CamelFolder *folder, guin
 
 	summary = (CamelGroupwiseSummary *) folder->summary;
 	camel_folder_summary_clear (folder->summary);
-	camel_folder_summary_save_to_db (folder->summary, ex);
+	camel_folder_summary_save_to_db (folder->summary, NULL);
 
 	summary_count = camel_folder_summary_count (folder->summary);
 	if (!summary_count || !summary->time_string) {
@@ -769,7 +763,7 @@ gw_store_reload_folder (CamelGroupwiseStore *gw_store, CamelFolder *folder, guin
 			if (status != E_GW_CONNECTION_STATUS_OK) {
 					camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 					g_free (container_id);
-					return;
+					return FALSE;
 			}
 
 			camel_operation_start (
@@ -783,13 +777,14 @@ gw_store_reload_folder (CamelGroupwiseStore *gw_store, CamelFolder *folder, guin
 					if (status != E_GW_CONNECTION_STATUS_OK) {
 							camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 							e_gw_connection_destroy_cursor (priv->cnc, container_id, cursor);
-							camel_folder_summary_save_to_db (folder->summary, ex);
-							camel_exception_set (
-								ex, CAMEL_EXCEPTION_SERVICE_INVALID,
+							camel_folder_summary_save_to_db (folder->summary, NULL);
+							g_set_error (
+								error, CAMEL_SERVICE_ERROR,
+								CAMEL_SERVICE_ERROR_INVALID,
 								_("Authentication failed"));
 							camel_operation_end (NULL);
 							g_free (container_id);
-							return;
+							return FALSE;
 					}
 					/* This full block is repeated in the get_folder code as well. We need
 					   better modularity */
@@ -804,7 +799,7 @@ gw_store_reload_folder (CamelGroupwiseStore *gw_store, CamelFolder *folder, guin
 							camel_operation_progress (NULL, (100*count)/total);
 					}
 
-					gw_update_summary (folder, list,  ex);
+					gw_update_summary (folder, list,  error);
 
 					/* For shared-folders created by the user, we don't get the total number of messages,
 					   in the getFolderList call. So, we need to wait until an empty list is returned in the
@@ -829,17 +824,17 @@ gw_store_reload_folder (CamelGroupwiseStore *gw_store, CamelFolder *folder, guin
 		summary->time_string = g_strdup (e_gw_connection_get_server_time (priv->cnc));
 	}
 
-	camel_folder_summary_save_to_db (folder->summary, ex);
+	camel_folder_summary_save_to_db (folder->summary, NULL);
 
 	groupwise_store_set_current_folder (gw_store, NULL);
 
 	g_free (container_id);
 	camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-	return;
+	return TRUE;
 }
 
 static CamelFolderInfo *
-convert_to_folder_info (CamelGroupwiseStore *store, EGwContainer *container, const gchar *url, CamelException *ex)
+convert_to_folder_info (CamelGroupwiseStore *store, EGwContainer *container, const gchar *url, GError **error)
 {
 	const gchar *name = NULL, *id = NULL, *parent = NULL;
 	gchar *par_name = NULL;
@@ -930,7 +925,7 @@ convert_to_folder_info (CamelGroupwiseStore *store, EGwContainer *container, con
 	if (store->current_folder
 	    && !strcmp (camel_folder_get_full_name (store->current_folder), fi->full_name)
 	    && type != E_GW_CONTAINER_TYPE_INBOX) {
-		CAMEL_FOLDER_GET_CLASS (store->current_folder)->refresh_info (store->current_folder, ex);
+		CAMEL_FOLDER_GET_CLASS (store->current_folder)->refresh_info (store->current_folder, error);
 	}
 	return fi;
 }
@@ -943,7 +938,7 @@ get_folders_free (gpointer k, gpointer v, gpointer d)
 }
 
 static gboolean
-groupwise_folders_sync (CamelGroupwiseStore *store, CamelException *ex)
+groupwise_folders_sync (CamelGroupwiseStore *store, GError **error)
 {
 	CamelGroupwiseStorePrivate  *priv = store->priv;
 	gint status;
@@ -1009,7 +1004,7 @@ groupwise_folders_sync (CamelGroupwiseStore *store, CamelException *ex)
 		if ((type == E_GW_CONTAINER_TYPE_CALENDAR) || (type == E_GW_CONTAINER_TYPE_CONTACTS))
 			continue;
 
-		info = convert_to_folder_info (store, E_GW_CONTAINER (folder_list->data), (const gchar *)url, ex);
+		info = convert_to_folder_info (store, E_GW_CONTAINER (folder_list->data), (const gchar *)url, error);
 		if (info) {
 			hfi = g_hash_table_lookup (present, info->full_name);
 			if (hfi == NULL)
@@ -1050,7 +1045,7 @@ groupwise_folders_sync (CamelGroupwiseStore *store, CamelException *ex)
 
 static CamelFolderInfo *
 groupwise_get_folder_info_offline (CamelStore *store, const gchar *top,
-			 guint32 flags, CamelException *ex)
+			 guint32 flags, GError **error)
 {
 	CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store);
 	CamelFolderInfo *fi;
@@ -1098,52 +1093,8 @@ groupwise_get_folder_info_offline (CamelStore *store, const gchar *top,
 	return fi;
 }
 
-/*** Thread stuff for refreshing folder tree begins ***/
-struct _store_refresh_msg {
-	CamelSessionThreadMsg msg;
-
-	CamelStore *store;
-	CamelException ex;
-};
-
-#if 0
-static void
-store_refresh_refresh (CamelSession *session, CamelSessionThreadMsg *msg)
-{
-	struct _store_refresh_msg *m = (struct _store_refresh_msg *)msg;
-	CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE(m->store);
-
-	camel_service_lock (CAMEL_SERVICE (m->store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-	if (!camel_groupwise_store_connected (groupwise_store, &m->ex))
-		goto done;
-	/*Get the folder list and save it here*/
-	groupwise_folders_sync (groupwise_store, &m->ex);
-	if (camel_exception_is_set (&m->ex))
-		goto done;
-	camel_store_summary_save ((CamelStoreSummary *)groupwise_store->summary);
-done:
-	camel_service_unlock (CAMEL_SERVICE (m->store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-}
-
-static void
-store_refresh_free(CamelSession *session, CamelSessionThreadMsg *msg)
-{
-	struct _store_refresh_msg *m = (struct _store_refresh_msg *)msg;
-
-	g_object_unref (m->store);
-	camel_exception_clear (&m->ex);
-}
-
-static CamelSessionThreadOps store_refresh_ops = {
-	store_refresh_refresh,
-	store_refresh_free,
-};
-#endif
-
-/*** Thread stuff ends ***/
-
 static CamelFolderInfo *
-groupwise_get_folder_info (CamelStore *store, const gchar *top, guint32 flags, CamelException *ex)
+groupwise_get_folder_info (CamelStore *store, const gchar *top, guint32 flags, GError **error)
 {
 	CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store);
 	CamelFolderInfo *info = NULL;
@@ -1151,13 +1102,12 @@ groupwise_get_folder_info (CamelStore *store, const gchar *top, guint32 flags, C
 	/* Do not call groupwise_store_connected function as it would internall call folders_sync
 	   to populate the hash table which is used for mapping container id */
 	if (!(((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_AVAIL
-	    && camel_service_connect ((CamelService *)store, ex)))
+	    && camel_service_connect ((CamelService *)store, error)))
 		goto offline;
 
 	camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	groupwise_folders_sync (groupwise_store, ex);
-	if (camel_exception_is_set (ex)) {
+	if (!groupwise_folders_sync (groupwise_store, error)) {
 		camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 		return NULL;
 	}
@@ -1168,7 +1118,7 @@ groupwise_get_folder_info (CamelStore *store, const gchar *top, guint32 flags, C
 	camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
 offline:
-	info = groupwise_get_folder_info_offline (store, top, flags, ex);
+	info = groupwise_get_folder_info_offline (store, top, flags, error);
 	return info;
 }
 
@@ -1213,7 +1163,7 @@ static CamelFolderInfo*
 groupwise_create_folder(CamelStore *store,
 		const gchar *parent_name,
 		const gchar *folder_name,
-		CamelException *ex)
+		GError **error)
 {
 	CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store);
 	CamelGroupwiseStorePrivate  *priv = groupwise_store->priv;
@@ -1223,8 +1173,8 @@ groupwise_create_folder(CamelStore *store,
 	gint status;
 
 	if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot create GroupWise folders in offline mode."));
 		return NULL;
 	}
@@ -1232,17 +1182,18 @@ groupwise_create_folder(CamelStore *store,
 	if (parent_name == NULL) {
 		parent_name = "";
 		if (groupwise_is_system_folder (folder_name)) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SYSTEM,
-				NULL  /* XXX Um, hello?  Error message? */);
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+				_("Cannot create a special system folder"));
 			return NULL;
 		}
 	}
 
 	if (parent_name && (strlen(parent_name) > 0) ) {
 		if (strcmp (parent_name, "Cabinet") && groupwise_is_system_folder (parent_name)) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_FOLDER_INVALID_STATE,
+			g_set_error (
+				error, CAMEL_FOLDER_ERROR,
+				CAMEL_FOLDER_ERROR_INVALID_STATE,
 				_("The parent folder is not allowed to contain subfolders"));
 			return NULL;
 		}
@@ -1251,7 +1202,7 @@ groupwise_create_folder(CamelStore *store,
 		parent_id = "";
 
 	if (!E_IS_GW_CONNECTION( priv->cnc)) {
-		if (!groupwise_connect (CAMEL_SERVICE(store), ex)) {
+		if (!groupwise_connect (CAMEL_SERVICE(store), error)) {
 			return NULL;
 		}
 	}
@@ -1276,7 +1227,7 @@ groupwise_create_folder(CamelStore *store,
 static gboolean
 groupwise_delete_folder(CamelStore *store,
 				   const gchar *folder_name,
-				   CamelException *ex)
+				   GError **error)
 {
 	CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store);
 	CamelGroupwiseStorePrivate  *priv = groupwise_store->priv;
@@ -1285,7 +1236,7 @@ groupwise_delete_folder(CamelStore *store,
 
 	camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	if (!camel_groupwise_store_connected (groupwise_store, ex)) {
+	if (!camel_groupwise_store_connected (groupwise_store, error)) {
 		camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 		return FALSE;
 	}
@@ -1299,7 +1250,7 @@ groupwise_delete_folder(CamelStore *store,
 	if (status == E_GW_CONNECTION_STATUS_OK) {
 		groupwise_store_set_current_folder (groupwise_store, NULL);
 
-		groupwise_forget_folder(groupwise_store,folder_name,ex);
+		groupwise_forget_folder(groupwise_store,folder_name,NULL);
 
 		g_hash_table_remove (priv->id_hash, container);
 		g_hash_table_remove (priv->name_hash, folder_name);
@@ -1315,7 +1266,7 @@ static gboolean
 groupwise_rename_folder(CamelStore *store,
 			const gchar *old_name,
 			const gchar *new_name,
-			CamelException *ex)
+			GError **error)
 {
 	CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store);
 	CamelGroupwiseStorePrivate  *priv = groupwise_store->priv;
@@ -1324,8 +1275,8 @@ groupwise_rename_folder(CamelStore *store,
 	gchar *temp_new = NULL;
 
 	if (groupwise_is_system_folder (old_name)) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot rename GroupWise folder '%s' to '%s'"),
 			old_name, new_name);
 		return FALSE;
@@ -1333,7 +1284,7 @@ groupwise_rename_folder(CamelStore *store,
 
 	camel_service_lock (CAMEL_SERVICE (groupwise_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	if (!camel_groupwise_store_connected (groupwise_store, ex)) {
+	if (!camel_groupwise_store_connected (groupwise_store, error)) {
 		camel_service_unlock (CAMEL_SERVICE (groupwise_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 		return FALSE;
 	}
@@ -1349,8 +1300,8 @@ groupwise_rename_folder(CamelStore *store,
 
 	if (!container_id || e_gw_connection_rename_folder (priv->cnc, container_id , temp_new) != E_GW_CONNECTION_STATUS_OK)
 	{
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot rename GroupWise folder '%s' to '%s'"),
 			old_name, new_name);
 		camel_service_unlock (CAMEL_SERVICE (groupwise_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
@@ -1426,9 +1377,9 @@ groupwise_base_url_lookup (CamelGroupwiseStorePrivate *priv)
 }
 
 static CamelFolder *
-groupwise_get_trash (CamelStore *store, CamelException *ex)
+groupwise_get_trash (CamelStore *store, GError **error)
 {
-	CamelFolder *folder = camel_store_get_folder(store, "Trash", 0, ex);
+	CamelFolder *folder = camel_store_get_folder(store, "Trash", 0, error);
 	if (folder) {
 		CamelObject *object = CAMEL_OBJECT (folder);
 		 gchar *state = g_build_filename((CAMEL_GROUPWISE_STORE(store))->priv->storage_path, "folders", "Trash", "cmeta", NULL);
@@ -1443,11 +1394,11 @@ groupwise_get_trash (CamelStore *store, CamelException *ex)
 }
 
 static gboolean
-groupwise_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, CamelException *ex)
+groupwise_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, GError **error)
 {
 	gboolean res;
 
-	res = CAMEL_STORE_CLASS(camel_groupwise_store_parent_class)->can_refresh_folder (store, info, ex) ||
+	res = CAMEL_STORE_CLASS(camel_groupwise_store_parent_class)->can_refresh_folder (store, info, error) ||
 	      (camel_url_get_param (((CamelService *)store)->url, "check_all") != NULL);
 
 	return res;
@@ -1458,15 +1409,15 @@ groupwise_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, CamelExc
  * online. Based on an equivalient function in IMAP
  */
 gboolean
-camel_groupwise_store_connected (CamelGroupwiseStore *store, CamelException *ex)
+camel_groupwise_store_connected (CamelGroupwiseStore *store, GError **error)
 {
 	if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_AVAIL
-	    && camel_service_connect ((CamelService *)store, ex)) {
+	    && camel_service_connect ((CamelService *)store, error)) {
 		CamelGroupwiseStore *gw_store = (CamelGroupwiseStore *) store;
 		CamelGroupwiseStorePrivate *priv = gw_store->priv;
 
 		if (g_hash_table_size (priv->name_hash) == 0)
-			groupwise_folders_sync ((CamelGroupwiseStore *) gw_store, ex);
+			return groupwise_folders_sync ((CamelGroupwiseStore *) gw_store, error);
 
 		return TRUE;
 	}
diff --git a/camel/providers/groupwise/camel-groupwise-store.h b/camel/providers/groupwise/camel-groupwise-store.h
index 02bb9a6..668bab1 100644
--- a/camel/providers/groupwise/camel-groupwise-store.h
+++ b/camel/providers/groupwise/camel-groupwise-store.h
@@ -86,8 +86,8 @@ EGwConnection *cnc_lookup (CamelGroupwiseStorePrivate *priv);
 gchar *storage_path_lookup (CamelGroupwiseStorePrivate *priv);
 const gchar *groupwise_base_url_lookup (CamelGroupwiseStorePrivate *priv);
 CamelFolderInfo * create_junk_folder (CamelStore *store);
-gboolean camel_groupwise_store_connected (CamelGroupwiseStore *store, CamelException *ex);
-void gw_store_reload_folder (CamelGroupwiseStore *store, CamelFolder *folder, guint32 flags, CamelException *ex);
+gboolean camel_groupwise_store_connected (CamelGroupwiseStore *store, GError **error);
+gboolean gw_store_reload_folder (CamelGroupwiseStore *store, CamelFolder *folder, guint32 flags, GError **error);
 void groupwise_store_set_current_folder (CamelGroupwiseStore *groupwise_store, CamelFolder *folder);
 
 G_END_DECLS
diff --git a/camel/providers/groupwise/camel-groupwise-summary.c b/camel/providers/groupwise/camel-groupwise-summary.c
index 29aee15..ca3a7db 100644
--- a/camel/providers/groupwise/camel-groupwise-summary.c
+++ b/camel/providers/groupwise/camel-groupwise-summary.c
@@ -53,7 +53,7 @@ static CamelMessageContentInfo * gw_content_info_migrate (CamelFolderSummary *s,
 static gboolean gw_info_set_flags(CamelMessageInfo *info, guint32 flags, guint32 set);
 
 static gint summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir);
-static CamelFIRecord * summary_header_to_db (CamelFolderSummary *s, CamelException *ex);
+static CamelFIRecord * summary_header_to_db (CamelFolderSummary *s, GError **error);
 static CamelMIRecord * message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info);
 static CamelMessageInfo * message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir);
 static gint content_info_to_db (CamelFolderSummary *s, CamelMessageContentInfo *info, CamelMIRecord *mir);
@@ -122,17 +122,13 @@ CamelFolderSummary *
 camel_groupwise_summary_new (struct _CamelFolder *folder, const gchar *filename)
 {
 	CamelFolderSummary *summary;
-	CamelException ex;
 
 	summary = g_object_new (CAMEL_TYPE_GROUPWISE_SUMMARY, NULL);
 	summary->folder = folder;
 	camel_folder_summary_set_build_content (summary, TRUE);
 	camel_folder_summary_set_filename (summary, filename);
 
-	camel_exception_init (&ex);
-	if (camel_folder_summary_load_from_db (summary, &ex) == -1) {
-		camel_folder_summary_clear_db (summary);
-	}
+	camel_folder_summary_load_from_db (summary, NULL);
 
 	return summary;
 }
@@ -179,12 +175,12 @@ gw_summary_header_load (CamelFolderSummary *s, FILE *in)
 }
 
 static CamelFIRecord *
-summary_header_to_db (CamelFolderSummary *s, CamelException *ex)
+summary_header_to_db (CamelFolderSummary *s, GError **error)
 {
 	CamelGroupwiseSummary *ims = CAMEL_GROUPWISE_SUMMARY(s);
 	struct _CamelFIRecord *fir;
 
-	fir = CAMEL_FOLDER_SUMMARY_CLASS (camel_groupwise_summary_parent_class)->summary_header_to_db (s, ex);
+	fir = CAMEL_FOLDER_SUMMARY_CLASS (camel_groupwise_summary_parent_class)->summary_header_to_db (s, error);
 	if (!fir)
 		return NULL;
 
diff --git a/camel/providers/groupwise/camel-groupwise-transport.c b/camel/providers/groupwise/camel-groupwise-transport.c
index 786ec13..e0cc87f 100644
--- a/camel/providers/groupwise/camel-groupwise-transport.c
+++ b/camel/providers/groupwise/camel-groupwise-transport.c
@@ -40,7 +40,7 @@ G_DEFINE_TYPE (CamelGroupwiseTransport, camel_groupwise_transport, CAMEL_TYPE_TR
 
 static gboolean
 groupwise_transport_connect (CamelService *service,
-                             CamelException *ex)
+                             GError **error)
 {
 	return TRUE;
 }
@@ -64,7 +64,7 @@ groupwise_send_to (CamelTransport *transport,
                    CamelMimeMessage *message,
                    CamelAddress *from,
                    CamelAddress *recipients,
-                   CamelException *ex)
+                   GError **error)
 {
 	CamelService *service;
 	CamelStore *store =  NULL;
@@ -79,8 +79,9 @@ groupwise_send_to (CamelTransport *transport,
 	EGwItemLinkInfo *info = NULL;
 
 	if (!transport) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 			_("Authentication failed"));
 		return FALSE;
 	}
@@ -94,12 +95,13 @@ groupwise_send_to (CamelTransport *transport,
 	camel_operation_start (NULL, _("Sending Message") );
 
 	/*camel groupwise store and cnc*/
-	store = camel_session_get_store (service->session, url, ex );
+	store = camel_session_get_store (service->session, url, NULL);
 	g_free (url);
 	if (!store) {
 		g_warning ("ERROR: Could not get a pointer to the store");
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_STORE_INVALID,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_INVALID,
 			_("Cannot get folder: Invalid operation on this store"));
 		return FALSE;
 	}
@@ -110,8 +112,9 @@ groupwise_send_to (CamelTransport *transport,
 	if (!cnc) {
 		g_warning ("||| Eh!!! Failure |||\n");
 		camel_operation_end (NULL);
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 			_("Authentication failed"));
 		return FALSE;
 	}
@@ -143,12 +146,14 @@ groupwise_send_to (CamelTransport *transport,
 
 		/* FIXME: 58652 should be changed with an enum.*/
 		if (status == 58652)
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_UNAVAILABLE,
 				_("You have exceeded this account's storage limit. Your messages are queued in your Outbox. Resend by pressing Send/Receive after deleting/archiving some of your mail.\n"));
 		else
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_UNAVAILABLE,
 				_("Could not send message: %s"),
 				_("Unknown error"));
 		status = 0;
diff --git a/camel/providers/groupwise/camel-groupwise-utils.c b/camel/providers/groupwise/camel-groupwise-utils.c
index 775f0f7..9f829b6 100644
--- a/camel/providers/groupwise/camel-groupwise-utils.c
+++ b/camel/providers/groupwise/camel-groupwise-utils.c
@@ -444,14 +444,14 @@ camel_groupwise_util_item_from_message (EGwConnection *cnc, CamelMimeMessage *me
 				filtered_stream = g_object_ref (content);
 			}
 
-			camel_data_wrapper_decode_to_stream (dw, filtered_stream);
-			camel_stream_flush (filtered_stream);
+			camel_data_wrapper_decode_to_stream (dw, filtered_stream, NULL);
+			camel_stream_flush (filtered_stream, NULL);
 			g_object_unref (filtered_stream);
 
-			camel_stream_write (content, "", 1);
+			camel_stream_write (content, "", 1, NULL);
 			e_gw_item_set_message (item, (const gchar *)byte_array->data);
 		} else {
-			camel_data_wrapper_decode_to_stream (dw, content);
+			camel_data_wrapper_decode_to_stream (dw, content, NULL);
 			send_as_attachment (cnc, item, content, type, dw, NULL, NULL, &attach_list);
 		}
 
@@ -648,7 +648,7 @@ do_multipart (EGwConnection *cnc, EGwItem *item, CamelMultipart *mp, GSList **at
 			if (temp_part) {
 				is_alternative = TRUE;
 				temp_dw = camel_medium_get_content (CAMEL_MEDIUM (temp_part));
-				camel_data_wrapper_write_to_stream(temp_dw, temp_content);
+				camel_data_wrapper_write_to_stream(temp_dw, temp_content, NULL);
 				filename = camel_mime_part_get_filename (temp_part);
 				disposition = camel_mime_part_get_disposition (temp_part);
 				cid = camel_mime_part_get_content_id (temp_part);
@@ -679,18 +679,18 @@ do_multipart (EGwConnection *cnc, EGwItem *item, CamelMultipart *mp, GSList **at
 				filtered_stream = g_object_ref (content);
 			}
 
-			camel_data_wrapper_decode_to_stream (dw, filtered_stream);
-			camel_stream_flush (filtered_stream);
+			camel_data_wrapper_decode_to_stream (dw, filtered_stream, NULL);
+			camel_stream_flush (filtered_stream, NULL);
 			g_object_unref (filtered_stream);
 
-			camel_stream_write (content, "", 1);
+			camel_stream_write (content, "", 1, NULL);
 			e_gw_item_set_message (item, (const gchar *) buffer->data);
 		} else {
 			filename = camel_mime_part_get_filename (part);
 			disposition = camel_mime_part_get_disposition (part);
 			content_id = camel_mime_part_get_content_id (part);
 
-			camel_data_wrapper_decode_to_stream (dw, content);
+			camel_data_wrapper_decode_to_stream (dw, content, NULL);
 			send_as_attachment (cnc, item, content, type, dw, filename, content_id, attach_list);
 		}
 
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c
index 6134542..37f1069 100644
--- a/camel/providers/imap/camel-imap-command.c
+++ b/camel/providers/imap/camel-imap-command.c
@@ -44,11 +44,11 @@
 extern gint camel_verbose_debug;
 
 static gboolean imap_command_start (CamelImapStore *store, CamelFolder *folder,
-				    const gchar *cmd, CamelException *ex);
+				    const gchar *cmd, GError **error);
 static CamelImapResponse *imap_read_response (CamelImapStore *store,
-					      CamelException *ex);
+					      GError **error);
 static gchar *imap_read_untagged (CamelImapStore *store, gchar *line,
-				 CamelException *ex);
+				 GError **error);
 static gchar *imap_command_strdup_vprintf (CamelImapStore *store,
 					  const gchar *fmt, va_list ap);
 static gchar *imap_command_strdup_printf (CamelImapStore *store,
@@ -59,7 +59,7 @@ static gchar *imap_command_strdup_printf (CamelImapStore *store,
  * @store: the IMAP store
  * @folder: The folder to perform the operation in (or %NULL if not
  * relevant).
- * @ex: a CamelException
+ * @error: return location for a #GError, or %NULL
  * @fmt: a sort of printf-style format string, followed by arguments
  *
  * This function calls camel_imap_command_start() to send the
@@ -84,7 +84,7 @@ static gchar *imap_command_strdup_printf (CamelImapStore *store,
 CamelImapResponse *
 camel_imap_command (CamelImapStore *store,
                     CamelFolder *folder,
-                    CamelException *ex,
+                    GError **error,
                     const gchar *fmt, ...)
 {
 	va_list ap;
@@ -108,14 +108,14 @@ camel_imap_command (CamelImapStore *store,
 		cmd = imap_command_strdup_printf (store, "SELECT %F", full_name);
 	}
 
-	if (!imap_command_start (store, folder, cmd, ex)) {
+	if (!imap_command_start (store, folder, cmd, error)) {
 		g_free (cmd);
 		camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 		return NULL;
 	}
 	g_free (cmd);
 
-	return imap_read_response (store, ex);
+	return imap_read_response (store, error);
 }
 
 /**
@@ -123,7 +123,7 @@ camel_imap_command (CamelImapStore *store,
  * @store: the IMAP store
  * @folder: The folder to perform the operation in (or %NULL if not
  * relevant).
- * @ex: a CamelException
+ * @error: return location for a #GError, or %NULL
  * @fmt: a sort of printf-style format string, followed by arguments
  *
  * This function makes sure that @folder (if non-%NULL) is the
@@ -155,7 +155,7 @@ camel_imap_command (CamelImapStore *store,
 gboolean
 camel_imap_command_start (CamelImapStore *store,
                           CamelFolder *folder,
-                          CamelException *ex,
+                          GError **error,
                           const gchar *fmt, ...)
 {
 	va_list ap;
@@ -167,7 +167,7 @@ camel_imap_command_start (CamelImapStore *store,
 	va_end (ap);
 
 	camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-	ok = imap_command_start (store, folder, cmd, ex);
+	ok = imap_command_start (store, folder, cmd, error);
 	g_free (cmd);
 
 	if (!ok)
@@ -179,20 +179,22 @@ static gboolean
 imap_command_start (CamelImapStore *store,
                     CamelFolder *folder,
                     const gchar *cmd,
-                    CamelException *ex)
+                    GError **error)
 {
 	gssize nwritten;
 
 	if (!store->ostream) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_STORE_INVALID,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_INVALID,
 			_("No output stream"));
 		return FALSE;
 	}
 
 	if (!store->istream) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_STORE_INVALID,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_INVALID,
 			_("No input stream"));
 		return FALSE;
 	}
@@ -200,16 +202,17 @@ imap_command_start (CamelImapStore *store,
 	/* Check for current folder */
 	if (folder && folder != store->current_folder) {
 		CamelImapResponse *response;
-		CamelException internal_ex;
+		GError *local_error = NULL;
 
-		response = camel_imap_command (store, folder, ex, NULL);
+		response = camel_imap_command (store, folder, error, NULL);
 		if (!response)
 			return FALSE;
-		camel_exception_init (&internal_ex);
-		camel_imap_folder_selected (folder, response, &internal_ex);
+
+		camel_imap_folder_selected (folder, response, &local_error);
 		camel_imap_response_free (store, response);
-		if (camel_exception_is_set (&internal_ex)) {
-			camel_exception_xfer (ex, &internal_ex);
+
+		if (local_error != NULL) {
+			g_propagate_error (error, local_error);
 			return FALSE;
 		}
 	}
@@ -236,13 +239,15 @@ imap_command_start (CamelImapStore *store,
 
 	if (nwritten == -1) {
 		if (errno == EINTR)
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_USER_CANCEL,
+			g_set_error (
+				error, G_IO_ERROR,
+				G_IO_ERROR_CANCELLED,
 				_("Operation cancelled"));
 		else
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-				g_strerror (errno));
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
+				"%s", g_strerror (errno));
 
 		camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
 		return FALSE;
@@ -256,7 +261,7 @@ imap_command_start (CamelImapStore *store,
  * @store: the IMAP store
  * @cmd: buffer containing the response/request data
  * @cmdlen: command length
- * @ex: a CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * This method is for sending continuing responses to the IMAP server
  * after camel_imap_command() or camel_imap_command_response() returns
@@ -271,48 +276,42 @@ CamelImapResponse *
 camel_imap_command_continuation (CamelImapStore *store,
                                  const gchar *cmd,
                                  gsize cmdlen,
-                                 CamelException *ex)
+                                 GError **error)
 {
-	if (!camel_imap_store_connected (store, ex))
+	if (!camel_imap_store_connected (store, error))
 		return NULL;
 
 	if (!store->ostream) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_STORE_INVALID,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_INVALID,
 			_("No output stream"));
 		return NULL;
 	}
 
 	if (!store->istream) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_STORE_INVALID,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_INVALID,
 			_("No input stream"));
 		return NULL;
 	}
 
-	if (camel_stream_write (store->ostream, cmd, cmdlen) == -1 ||
-	    camel_stream_write (store->ostream, "\r\n", 2) == -1) {
-		if (errno == EINTR)
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_USER_CANCEL,
-				_("Operation cancelled"));
-		else
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-				g_strerror (errno));
+	if (camel_stream_write (store->ostream, cmd, cmdlen, error) == -1 ||
+	    camel_stream_write (store->ostream, "\r\n", 2, error) == -1) {
 		camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
 		camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 		return NULL;
 	}
 
-	return imap_read_response (store, ex);
+	return imap_read_response (store, error);
 }
 
 /**
  * camel_imap_command_response:
  * @store: the IMAP store
  * @response: a pointer to pass back the response data in
- * @ex: a CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * This reads a single tagged, untagged, or continuation response from
  * @store into * response  The caller must free the string when it is
@@ -325,12 +324,12 @@ camel_imap_command_continuation (CamelImapStore *store,
  **/
 CamelImapResponseType
 camel_imap_command_response (CamelImapStore *store, gchar **response,
-			     CamelException *ex)
+			     GError **error)
 {
 	CamelImapResponseType type;
 	gchar *respbuf;
 
-	if (camel_imap_store_readline (store, &respbuf, ex) < 0) {
+	if (camel_imap_store_readline (store, &respbuf, error) < 0) {
 		camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 		return CAMEL_IMAP_RESPONSE_ERROR;
 	}
@@ -348,8 +347,9 @@ camel_imap_command_response (CamelImapStore *store, gchar **response,
 
 			/* Connection was lost, no more data to fetch */
 			camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_UNAVAILABLE,
 				_("Server unexpectedly disconnected: %s"), err);
 			store->connected = FALSE;
 			g_free (respbuf);
@@ -360,7 +360,7 @@ camel_imap_command_response (CamelImapStore *store, gchar **response,
 
 		/* Read the rest of the response. */
 		type = CAMEL_IMAP_RESPONSE_UNTAGGED;
-		respbuf = imap_read_untagged (store, respbuf, ex);
+		respbuf = imap_read_untagged (store, respbuf, error);
 		if (!respbuf)
 			type = CAMEL_IMAP_RESPONSE_ERROR;
 		else if (!g_ascii_strncasecmp (respbuf, "* OK [ALERT]", 12)
@@ -394,7 +394,7 @@ camel_imap_command_response (CamelImapStore *store, gchar **response,
 }
 
 static CamelImapResponse *
-imap_read_response (CamelImapStore *store, CamelException *ex)
+imap_read_response (CamelImapStore *store, GError **error)
 {
 	CamelImapResponse *response;
 	CamelImapResponseType type;
@@ -414,7 +414,7 @@ imap_read_response (CamelImapStore *store, CamelException *ex)
 	} */
 
 	response->untagged = g_ptr_array_new ();
-	while ((type = camel_imap_command_response (store, &respbuf, ex))
+	while ((type = camel_imap_command_response (store, &respbuf, error))
 	       == CAMEL_IMAP_RESPONSE_UNTAGGED)
 		g_ptr_array_add (response->untagged, respbuf);
 
@@ -438,8 +438,9 @@ imap_read_response (CamelImapStore *store, CamelException *ex)
 	if (!p || (g_ascii_strncasecmp(p, " NO", 3) != 0 && g_ascii_strncasecmp(p, " BAD", 4)) ) {
 		g_warning ("Unexpected response from IMAP server: %s",
 			   respbuf);
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
 			_("Unexpected response from IMAP server: %s"),
 			respbuf);
 		camel_imap_response_free_without_processing (store, response);
@@ -449,8 +450,9 @@ imap_read_response (CamelImapStore *store, CamelException *ex)
 	p += 3;
 	if (!*p++)
 		p = NULL;
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_SERVICE_INVALID,
+	g_set_error (
+		error, CAMEL_SERVICE_ERROR,
+		CAMEL_SERVICE_ERROR_INVALID,
 		_("IMAP command failed: %s"),
 		(p != NULL) ? p : _("Unknown error"));
 	camel_imap_response_free_without_processing (store, response);
@@ -462,7 +464,7 @@ imap_read_response (CamelImapStore *store, CamelException *ex)
  * of literals.
  */
 static gchar *
-imap_read_untagged (CamelImapStore *store, gchar *line, CamelException *ex)
+imap_read_untagged (CamelImapStore *store, gchar *line, GError **error)
 {
 	gint fulllen, ldigits, nread, n, i, sexp = 0;
 	guint length;
@@ -512,17 +514,10 @@ imap_read_untagged (CamelImapStore *store, gchar *line, CamelException *ex)
 			n = camel_stream_read (
 				store->istream,
 				str->str + nread + 1,
-				length - nread);
+				length - nread, error);
 			if (n == -1) {
-				if (errno == EINTR)
-					camel_exception_set (
-						ex, CAMEL_EXCEPTION_USER_CANCEL,
-						_("Operation cancelled"));
-				else
-					camel_exception_set (
-						ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-						g_strerror (errno));
-				camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
+				camel_service_disconnect (
+					CAMEL_SERVICE (store), FALSE, NULL);
 				g_string_free (str, TRUE);
 				goto lose;
 			}
@@ -531,8 +526,9 @@ imap_read_untagged (CamelImapStore *store, gchar *line, CamelException *ex)
 		} while (n > 0 && nread < length);
 
 		if (nread < length) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_UNAVAILABLE,
 				_("Server response ended too soon."));
 			camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
 			g_string_free (str, TRUE);
@@ -587,7 +583,7 @@ imap_read_untagged (CamelImapStore *store, gchar *line, CamelException *ex)
 
 		/* Read the next line. */
 		do {
-			if (camel_imap_store_readline (store, &line, ex) < 0)
+			if (camel_imap_store_readline (store, &line, error) < 0)
 				goto lose;
 
 			/* MAJOR HACK ALERT, gropuwise sometimes sends an extra blank line after literals, check that here
@@ -701,7 +697,7 @@ camel_imap_response_free_without_processing (CamelImapStore *store,
  * @store: the store the response came from
  * @response: the response data returned from camel_imap_command
  * @type: the response type to extract
- * @ex: a CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * This checks that @response contains a single untagged response of
  * type @type and returns just that response data. If @response
@@ -715,7 +711,7 @@ gchar *
 camel_imap_response_extract (CamelImapStore *store,
 			     CamelImapResponse *response,
 			     const gchar *type,
-			     CamelException *ex)
+			     GError **error)
 {
 	gint len = strlen (type), i;
 	gchar *resp;
@@ -738,8 +734,9 @@ camel_imap_response_extract (CamelImapStore *store,
 		g_ptr_array_remove_index (response->untagged, i);
 	} else {
 		resp = NULL;
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
 			_("IMAP server response did not "
 			  "contain %s information"), type);
 	}
@@ -752,7 +749,7 @@ camel_imap_response_extract (CamelImapStore *store,
  * camel_imap_response_extract_continuation:
  * @store: the store the response came from
  * @response: the response data returned from camel_imap_command
- * @ex: a CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * This checks that @response contains a continuation response, and
  * returns just that data. If @response doesn't contain a continuation
@@ -764,7 +761,7 @@ camel_imap_response_extract (CamelImapStore *store,
 gchar *
 camel_imap_response_extract_continuation (CamelImapStore *store,
 					  CamelImapResponse *response,
-					  CamelException *ex)
+					  GError **error)
 {
 	gchar *status;
 
@@ -775,8 +772,9 @@ camel_imap_response_extract_continuation (CamelImapStore *store,
 		return status;
 	}
 
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+	g_set_error (
+		error, CAMEL_SERVICE_ERROR,
+		CAMEL_SERVICE_ERROR_UNAVAILABLE,
 		_("Unexpected OK response from IMAP server: %s"),
 		response->status);
 
diff --git a/camel/providers/imap/camel-imap-command.h b/camel/providers/imap/camel-imap-command.h
index fc330a2..76b8f3d 100644
--- a/camel/providers/imap/camel-imap-command.h
+++ b/camel/providers/imap/camel-imap-command.h
@@ -47,12 +47,12 @@ struct _CamelImapResponse {
 
 CamelImapResponse *camel_imap_command              (CamelImapStore *store,
 						    CamelFolder *folder,
-						    CamelException *ex,
+						    GError **error,
 						    const gchar *fmt, ...);
 CamelImapResponse *camel_imap_command_continuation (CamelImapStore *store,
 						    const gchar *cmd,
 						    gsize cmdlen,
-						    CamelException *ex);
+						    GError **error);
 
 void  camel_imap_response_free                     (CamelImapStore *store,
 						    CamelImapResponse *response);
@@ -61,18 +61,18 @@ void  camel_imap_response_free_without_processing  (CamelImapStore *store,
 gchar *camel_imap_response_extract                  (CamelImapStore *store,
 						    CamelImapResponse *response,
 						    const gchar *type,
-						    CamelException *ex);
+						    GError **error);
 gchar *camel_imap_response_extract_continuation     (CamelImapStore *store,
 						    CamelImapResponse *response,
-						    CamelException *ex);
+						    GError **error);
 
 gboolean           camel_imap_command_start        (CamelImapStore *store,
 						    CamelFolder *folder,
-						    CamelException *ex,
+						    GError **error,
 						    const gchar *fmt, ...);
 CamelImapResponseType camel_imap_command_response  (CamelImapStore *store,
 						    gchar **response,
-						    CamelException *ex);
+						    GError **error);
 
 G_END_DECLS
 
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index daa0ebf..da76a24 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -71,43 +71,43 @@ enum {
 
 extern gint camel_application_is_exiting;
 
-static gboolean imap_rescan (CamelFolder *folder, gint exists, CamelException *ex);
-static gboolean imap_refresh_info (CamelFolder *folder, CamelException *ex);
-static gboolean imap_sync_offline (CamelFolder *folder, CamelException *ex);
-static gboolean imap_sync (CamelFolder *folder, gboolean expunge, CamelException *ex);
-static gboolean imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException *ex);
-static gboolean imap_expunge_uids_offline (CamelFolder *folder, GPtrArray *uids, CamelException *ex);
-static gboolean imap_expunge (CamelFolder *folder, CamelException *ex);
-/*static void imap_cache_message (CamelDiscoFolder *disco_folder, const gchar *uid, CamelException *ex);*/
+static gboolean imap_rescan (CamelFolder *folder, gint exists, GError **error);
+static gboolean imap_refresh_info (CamelFolder *folder, GError **error);
+static gboolean imap_sync_offline (CamelFolder *folder, GError **error);
+static gboolean imap_sync (CamelFolder *folder, gboolean expunge, GError **error);
+static gboolean imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, GError **error);
+static gboolean imap_expunge_uids_offline (CamelFolder *folder, GPtrArray *uids, GError **error);
+static gboolean imap_expunge (CamelFolder *folder, GError **error);
+/*static void imap_cache_message (CamelDiscoFolder *disco_folder, const gchar *uid, GError **error);*/
 static void imap_rename (CamelFolder *folder, const gchar *new);
-static GPtrArray * imap_get_uncached_uids (CamelFolder *folder, GPtrArray * uids, CamelException *ex);
-static gchar * imap_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex);
+static GPtrArray * imap_get_uncached_uids (CamelFolder *folder, GPtrArray * uids, GError **error);
+static gchar * imap_get_filename (CamelFolder *folder, const gchar *uid, GError **error);
 
 /* message manipulation */
 static CamelMimeMessage *imap_get_message (CamelFolder *folder, const gchar *uid,
-					   CamelException *ex);
+					   GError **error);
 static gboolean imap_sync_message (CamelFolder *folder, const gchar *uid,
-			       CamelException *ex);
+			       GError **error);
 static gboolean imap_append_online (CamelFolder *folder, CamelMimeMessage *message,
 				const CamelMessageInfo *info, gchar **appended_uid,
-				CamelException *ex);
+				GError **error);
 static gboolean imap_append_offline (CamelFolder *folder, CamelMimeMessage *message,
 				 const CamelMessageInfo *info, gchar **appended_uid,
-				 CamelException *ex);
+				 GError **error);
 
 static gboolean imap_transfer_online (CamelFolder *source, GPtrArray *uids,
 				  CamelFolder *dest, GPtrArray **transferred_uids,
 				  gboolean delete_originals,
-				  CamelException *ex);
+				  GError **error);
 static gboolean imap_transfer_offline (CamelFolder *source, GPtrArray *uids,
 				   CamelFolder *dest, GPtrArray **transferred_uids,
 				   gboolean delete_originals,
-				   CamelException *ex);
+				   GError **error);
 
 /* searching */
-static GPtrArray *imap_search_by_expression (CamelFolder *folder, const gchar *expression, CamelException *ex);
-static guint32 imap_count_by_expression (CamelFolder *folder, const gchar *expression, CamelException *ex);
-static GPtrArray *imap_search_by_uids	    (CamelFolder *folder, const gchar *expression, GPtrArray *uids, CamelException *ex);
+static GPtrArray *imap_search_by_expression (CamelFolder *folder, const gchar *expression, GError **error);
+static guint32 imap_count_by_expression (CamelFolder *folder, const gchar *expression, GError **error);
+static GPtrArray *imap_search_by_uids	    (CamelFolder *folder, const gchar *expression, GPtrArray *uids, GError **error);
 static void       imap_search_free          (CamelFolder *folder, GPtrArray *uids);
 
 static void imap_thaw (CamelFolder *folder);
@@ -119,13 +119,13 @@ static GData *parse_fetch_response (CamelImapFolder *imap_folder, gchar *msg_att
 static CamelImapMessageInfo * imap_folder_summary_uid_or_error(
 	CamelFolderSummary *summary,
 	const gchar * uid,
-	CamelException *ex);
+	GError **error);
 
 static gboolean
 imap_transfer_messages (CamelFolder *source, GPtrArray *uids,
 			CamelFolder *dest, GPtrArray **transferred_uids,
-			gboolean delete_originals, CamelException *ex,
-			gboolean can_call_sync);
+			gboolean delete_originals, gboolean can_call_sync,
+			GError **error);
 
 #ifdef G_OS_WIN32
 /* The strtok() in Microsoft's C library is MT-safe (but still uses
@@ -308,7 +308,7 @@ camel_imap_folder_init (CamelImapFolder *imap_folder)
 }
 
 static void
-replay_offline_journal (CamelImapStore *imap_store, CamelImapFolder *imap_folder, CamelException *ex)
+replay_offline_journal (CamelImapStore *imap_store, CamelImapFolder *imap_folder, GError **error)
 {
 	CamelIMAPJournal *imap_journal;
 
@@ -320,16 +320,16 @@ replay_offline_journal (CamelImapStore *imap_store, CamelImapFolder *imap_folder
 	g_return_if_fail (imap_journal != NULL);
 
 	/* do not replay when still in offline */
-	if (CAMEL_OFFLINE_STORE (imap_store)->state != CAMEL_OFFLINE_STORE_NETWORK_AVAIL || !camel_imap_store_connected (imap_store, ex))
+	if (CAMEL_OFFLINE_STORE (imap_store)->state != CAMEL_OFFLINE_STORE_NETWORK_AVAIL || !camel_imap_store_connected (imap_store, error))
 		return;
 
 	/* Check if the replay is already in progress as imap_sync would be called while expunge resync */
 	if (!imap_journal->rp_in_progress) {
 		imap_journal->rp_in_progress++;
 
-		camel_offline_journal_replay (imap_folder->journal, ex);
+		camel_offline_journal_replay (imap_folder->journal, error);
 		camel_imap_journal_close_folders (imap_journal);
-		camel_offline_journal_write (imap_folder->journal, ex);
+		camel_offline_journal_write (imap_folder->journal, error);
 
 		imap_journal->rp_in_progress--;
 		g_return_if_fail (imap_journal->rp_in_progress >= 0);
@@ -338,7 +338,7 @@ replay_offline_journal (CamelImapStore *imap_store, CamelImapFolder *imap_folder
 
 CamelFolder *
 camel_imap_folder_new (CamelStore *parent, const gchar *folder_name,
-		       const gchar *folder_dir, CamelException *ex)
+		       const gchar *folder_dir, GError **error)
 {
 	CamelImapStore *imap_store = CAMEL_IMAP_STORE (parent);
 	CamelFolder *folder;
@@ -347,8 +347,9 @@ camel_imap_folder_new (CamelStore *parent, const gchar *folder_name,
 	gchar *summary_file, *state_file, *path;
 
 	if (g_mkdir_with_parents (folder_dir, S_IRWXU) != 0) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not create directory %s: %s"),
 			folder_dir, g_strerror (errno));
 		return NULL;
@@ -370,8 +371,8 @@ camel_imap_folder_new (CamelStore *parent, const gchar *folder_name,
 	g_free (summary_file);
 	if (!folder->summary) {
 		g_object_unref (CAMEL_OBJECT (folder));
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Could not load summary for %s"), folder_name);
 		return NULL;
 	}
@@ -387,7 +388,7 @@ camel_imap_folder_new (CamelStore *parent, const gchar *folder_name,
 	g_free(state_file);
 	camel_object_state_read (CAMEL_OBJECT (folder));
 
-	imap_folder->cache = camel_imap_message_cache_new (folder_dir, folder->summary, ex);
+	imap_folder->cache = camel_imap_message_cache_new (folder_dir, folder->summary, error);
 	if (!imap_folder->cache) {
 		g_object_unref (CAMEL_OBJECT (folder));
 		return NULL;
@@ -476,7 +477,7 @@ camel_imap_folder_set_check_folder (CamelImapFolder *imap_folder,
 gboolean
 camel_imap_folder_selected (CamelFolder *folder,
                             CamelImapResponse *response,
-                            CamelException *ex)
+                            GError **error)
 {
 	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
 	CamelImapSummary *imap_summary = CAMEL_IMAP_SUMMARY (folder->summary);
@@ -531,7 +532,7 @@ camel_imap_folder_selected (CamelFolder *folder,
 		camel_imap_message_cache_clear (imap_folder->cache);
 		CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
 		imap_folder->need_rescan = FALSE;
-		return camel_imap_folder_changed (folder, exists, NULL, ex);
+		return camel_imap_folder_changed (folder, exists, NULL, error);
 	}
 
 	/* If we've lost messages, we have to rescan everything */
@@ -552,7 +553,7 @@ camel_imap_folder_selected (CamelFolder *folder,
 		 * is selected, and we don't want camel_imap_command
 		 * to worry about it.)
 		 */
-		response = camel_imap_command (store, NULL, ex, "FETCH %d UID", count);
+		response = camel_imap_command (store, NULL, error, "FETCH %d UID", count);
 		if (!response)
 			return FALSE;
 		uid = 0;
@@ -586,13 +587,13 @@ camel_imap_folder_selected (CamelFolder *folder,
 
 	/* Now rescan if we need to */
 	if (imap_folder->need_rescan)
-		return imap_rescan (folder, exists, ex);
+		return imap_rescan (folder, exists, error);
 
 	/* If we don't need to rescan completely, but new messages
 	 * have been added, find out about them.
 	 */
 	if (exists > count)
-		camel_imap_folder_changed (folder, exists, NULL, ex);
+		camel_imap_folder_changed (folder, exists, NULL, error);
 
 	/* And we're done. */
 
@@ -602,11 +603,11 @@ camel_imap_folder_selected (CamelFolder *folder,
 static gchar *
 imap_get_filename (CamelFolder *folder,
                    const gchar *uid,
-                   CamelException *ex)
+                   GError **error)
 {
 	CamelImapFolder *imap_folder = (CamelImapFolder*) folder;
 
-	return camel_imap_message_cache_get_filename (imap_folder->cache, uid, "", ex);
+	return camel_imap_message_cache_get_filename (imap_folder->cache, uid, "", error);
 }
 
 static void
@@ -644,7 +645,7 @@ imap_rename (CamelFolder *folder, const gchar *new)
 
 /* called with connect_lock locked */
 static gboolean
-get_folder_status (CamelFolder *folder, guint32 *total, guint32 *unread, CamelException *ex)
+get_folder_status (CamelFolder *folder, guint32 *total, guint32 *unread, GError **error)
 {
 	CamelStore *parent_store;
 	CamelImapStore *imap_store;
@@ -659,7 +660,7 @@ get_folder_status (CamelFolder *folder, guint32 *total, guint32 *unread, CamelEx
 
 	imap_store = CAMEL_IMAP_STORE (parent_store);
 
-	response = camel_imap_command (imap_store, folder, ex, "STATUS %F (MESSAGES UNSEEN)", full_name);
+	response = camel_imap_command (imap_store, folder, error, "STATUS %F (MESSAGES UNSEEN)", full_name);
 
 	if (response) {
 		gint i;
@@ -723,7 +724,7 @@ get_folder_status (CamelFolder *folder, guint32 *total, guint32 *unread, CamelEx
 
 static gboolean
 imap_refresh_info (CamelFolder *folder,
-                   CamelException *ex)
+                   GError **error)
 {
 	CamelStore *parent_store;
 	CamelImapStore *imap_store;
@@ -732,6 +733,7 @@ imap_refresh_info (CamelFolder *folder,
 	CamelStoreInfo *si;
 	const gchar *full_name;
 	gint check_rescan = -1;
+	GError *local_error = NULL;
 
 	parent_store = camel_folder_get_parent_store (folder);
 	imap_store = CAMEL_IMAP_STORE (parent_store);
@@ -751,19 +753,19 @@ imap_refresh_info (CamelFolder *folder,
 	 * should do it.  */
 	camel_service_lock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	if (camel_application_is_exiting  || !camel_imap_store_connected(imap_store, ex))
+	if (camel_application_is_exiting  || !camel_imap_store_connected(imap_store, error))
 		goto done;
 
 	/* try to store local changes first, as the summary contains new local messages */
-	replay_offline_journal (imap_store, imap_folder, ex);
+	replay_offline_journal (imap_store, imap_folder, &local_error);
 
 	full_name = camel_folder_get_full_name (folder);
 
 	if (imap_store->current_folder != folder
 	    || g_ascii_strcasecmp (full_name, "INBOX") == 0) {
-		response = camel_imap_command (imap_store, folder, ex, NULL);
+		response = camel_imap_command (imap_store, folder, &local_error, NULL);
 		if (response) {
-			camel_imap_folder_selected (folder, response, ex);
+			camel_imap_folder_selected (folder, response, &local_error);
 			camel_imap_response_free (imap_store, response);
 		}
 	} else if (imap_folder->need_rescan) {
@@ -771,18 +773,18 @@ imap_refresh_info (CamelFolder *folder,
 		 * a NOOP to give the server a chance to tell us about new
 		 * messages.
 		 */
-		imap_rescan (folder, camel_folder_summary_count (folder->summary), ex);
+		imap_rescan (folder, camel_folder_summary_count (folder->summary), &local_error);
 		check_rescan = 0;
 	} else {
 #if 0
 		/* on some servers need to CHECKpoint INBOX to recieve new messages?? */
 		/* rfc2060 suggests this, but havent seen a server that requires it */
 		if (g_ascii_strcasecmp (full_name, "INBOX") == 0) {
-			response = camel_imap_command (imap_store, folder, ex, "CHECK");
+			response = camel_imap_command (imap_store, folder, &local_error, "CHECK");
 			camel_imap_response_free (imap_store, response);
 		}
 #endif
-		response = camel_imap_command (imap_store, folder, ex, "NOOP");
+		response = camel_imap_command (imap_store, folder, &local_error, "NOOP");
 		camel_imap_response_free (imap_store, response);
 	}
 
@@ -803,7 +805,7 @@ imap_refresh_info (CamelFolder *folder,
 		camel_store_summary_info_free((CamelStoreSummary *)((CamelImapStore *)parent_store)->summary, si);
 	}
 
-	if (check_rescan && !camel_application_is_exiting && !camel_exception_is_set (ex)) {
+	if (check_rescan && !camel_application_is_exiting && local_error == NULL) {
 		if (check_rescan == -1) {
 			guint32 total, unread = 0, server_total = 0, server_unread = 0;
 
@@ -811,7 +813,7 @@ imap_refresh_info (CamelFolder *folder,
 
 			/* Check whether there are changes in total/unread messages in the folders
 			   and if so, then rescan whole summary */
-			if (get_folder_status (folder, &server_total, &server_unread, ex)) {
+			if (get_folder_status (folder, &server_total, &server_unread, &local_error)) {
 
 				total = camel_folder_summary_count (folder->summary);
 				unread = folder->summary->unread_count;
@@ -822,14 +824,19 @@ imap_refresh_info (CamelFolder *folder,
 		}
 
 		if (check_rescan)
-			imap_rescan (folder, camel_folder_summary_count (folder->summary), ex);
+			imap_rescan (folder, camel_folder_summary_count (folder->summary), &local_error);
 	}
 done:
 	camel_service_unlock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	camel_folder_summary_save_to_db (folder->summary, ex);
+	camel_folder_summary_save_to_db (folder->summary, NULL);
 	camel_store_summary_save ((CamelStoreSummary *)((CamelImapStore *)parent_store)->summary);
 
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return FALSE;
+	}
+
 	return TRUE;
 }
 
@@ -912,7 +919,7 @@ merge_custom_flags (CamelMessageInfo *mi, const gchar *custom_flags)
 
 /* Called with the store's connect_lock locked */
 static gboolean
-imap_rescan (CamelFolder *folder, gint exists, CamelException *ex)
+imap_rescan (CamelFolder *folder, gint exists, GError **error)
 {
 	CamelStore *parent_store;
 	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
@@ -944,7 +951,7 @@ imap_rescan (CamelFolder *folder, gint exists, CamelException *ex)
 	summary_len = camel_folder_summary_count (folder->summary);
 	if (summary_len == 0) {
 		if (exists)
-			return camel_imap_folder_changed (folder, exists, NULL, ex);
+			return camel_imap_folder_changed (folder, exists, NULL, error);
 		return TRUE;
 	}
 
@@ -960,7 +967,7 @@ imap_rescan (CamelFolder *folder, gint exists, CamelException *ex)
 	}
 
 	ok = camel_imap_command_start (
-		store, folder, ex,
+		store, folder, error,
 		"UID FETCH 1:%s (FLAGS)", uid);
 	g_free (uid);
 	if (!ok) {
@@ -970,7 +977,7 @@ imap_rescan (CamelFolder *folder, gint exists, CamelException *ex)
 
 	new = g_malloc0 (summary_len * sizeof (*new));
 	summary_got = 0;
-	while ((type = camel_imap_command_response (store, &resp, ex)) == CAMEL_IMAP_RESPONSE_UNTAGGED && !camel_application_is_exiting) {
+	while ((type = camel_imap_command_response (store, &resp, error)) == CAMEL_IMAP_RESPONSE_UNTAGGED && !camel_application_is_exiting) {
 		GData *data;
 		gchar *uid;
 		guint32 flags;
@@ -1028,7 +1035,7 @@ imap_rescan (CamelFolder *folder, gint exists, CamelException *ex)
 	 */
 	removed = g_array_new (FALSE, FALSE, sizeof (gint));
 
-	camel_folder_summary_prepare_fetch_all (folder->summary, ex);
+	camel_folder_summary_prepare_fetch_all (folder->summary, NULL);
 
 	for (i = 0, j = 0; i < summary_len && new[j].uid; i++) {
 		gboolean changed = FALSE;
@@ -1224,7 +1231,7 @@ imap_rescan (CamelFolder *folder, gint exists, CamelException *ex)
 	}
 
 	/* And finally update the summary. */
-	success = camel_imap_folder_changed (folder, exists, removed, ex);
+	success = camel_imap_folder_changed (folder, exists, removed, error);
 	g_array_free (removed, TRUE);
 
 	return success;
@@ -1404,7 +1411,7 @@ get_matching (CamelFolder *folder, guint32 flags, guint32 mask, CamelMessageInfo
 
 static gboolean
 imap_sync_offline (CamelFolder *folder,
-                   CamelException *ex)
+                   GError **error)
 {
 	CamelStore *parent_store;
 
@@ -1428,14 +1435,17 @@ imap_sync_offline (CamelFolder *folder,
 		}
 	}
 
-	camel_folder_summary_save_to_db (folder->summary, ex);
+	camel_folder_summary_save_to_db (folder->summary, NULL);
 	camel_store_summary_save((CamelStoreSummary *)((CamelImapStore *)parent_store)->summary);
 
 	return TRUE;
 }
 
 static void
-move_messages (CamelFolder *src_folder, GPtrArray *uids, CamelFolder *des_folder, CamelException *ex)
+move_messages (CamelFolder *src_folder,
+               GPtrArray *uids,
+               CamelFolder *des_folder,
+               GError **error)
 {
 	g_return_if_fail (src_folder != NULL);
 
@@ -1446,26 +1456,26 @@ move_messages (CamelFolder *src_folder, GPtrArray *uids, CamelFolder *des_folder
 	/* moving to the same folder means expunge only */
 	if (src_folder != des_folder) {
 		/* do 'copy' to not be bothered with CAMEL_MESSAGE_DELETED again */
-		if (!imap_transfer_messages (src_folder, uids, des_folder, NULL, FALSE, ex, FALSE))
+		if (!imap_transfer_messages (src_folder, uids, des_folder, NULL, FALSE, FALSE, error))
 			return;
 	}
 
-	if (!camel_exception_is_set (ex))
-		camel_imap_expunge_uids_only (src_folder, uids, ex);
+	camel_imap_expunge_uids_only (src_folder, uids, error);
 }
 
 static gboolean
 imap_sync (CamelFolder *folder,
            gboolean expunge,
-           CamelException *ex)
+           GError **error)
 {
 	CamelStore *parent_store;
 	CamelImapStore *store;
 	CamelImapMessageInfo *info;
 	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
 	gboolean success;
-	CamelException local_ex;
-	CamelFolder *real_trash = NULL, *real_junk = NULL;
+	CamelFolder *real_junk = NULL;
+	CamelFolder *real_trash = NULL;
+	GError *local_error = NULL;
 
 	GPtrArray *matches, *summary, *deleted_uids = NULL, *junked_uids = NULL;
 	gchar *set, *flaglist, *uid;
@@ -1476,17 +1486,16 @@ imap_sync (CamelFolder *folder,
 
 	if (folder->permanent_flags == 0 || CAMEL_OFFLINE_STORE (store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
 		if (expunge) {
-			if (!imap_expunge (folder, ex))
+			if (!imap_expunge (folder, error))
 				return FALSE;
 		}
-		return imap_sync_offline (folder, ex);
+		return imap_sync_offline (folder, error);
 	}
 
-	camel_exception_init (&local_ex);
 	camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
 	/* write local changes first */
-	replay_offline_journal (store, imap_folder, ex);
+	replay_offline_journal (store, imap_folder, NULL);
 
 	/* Find a message with changed flags, find all of the other
 	 * messages like it, sync them as a group, mark them as
@@ -1503,11 +1512,7 @@ imap_sync (CamelFolder *folder,
 			real_trash = folder;
 			g_object_ref (real_trash);
 		} else {
-			CamelException ex2;
-
-			camel_exception_init (&ex2);
-			real_trash = camel_store_get_trash (parent_store, &ex2);
-			camel_exception_clear (&ex2);
+			real_trash = camel_store_get_trash (parent_store, NULL);
 
 			if (!store->real_trash_path && real_trash) {
 				/* failed to open real trash */
@@ -1526,11 +1531,7 @@ imap_sync (CamelFolder *folder,
 			/* syncing the junk, but cannot move messages to itself, thus do nothing */
 			real_junk = NULL;
 		} else {
-			CamelException ex2;
-
-			camel_exception_init (&ex2);
-			real_junk = camel_store_get_junk (parent_store, &ex2);
-			camel_exception_clear (&ex2);
+			real_junk = camel_store_get_junk (parent_store, NULL);
 
 			if (!store->real_junk_path && real_junk) {
 				/* failed to open real junk */
@@ -1575,7 +1576,7 @@ imap_sync (CamelFolder *folder,
 		}
 
 		/* Make sure we're connected before issuing commands */
-		if (!camel_imap_store_connected(store, ex)) {
+		if (!camel_imap_store_connected(store, NULL)) {
 			g_free(set);
 			camel_message_info_free(info);
 			break;
@@ -1604,7 +1605,7 @@ imap_sync (CamelFolder *folder,
 				g_free (flaglist);
 				flaglist = strdup ("(\\Seen)");
 
-				response = camel_imap_command (store, folder, &local_ex,
+				response = camel_imap_command (store, folder, &local_error,
 						"UID STORE %s +FLAGS.SILENT %s",
 						set, flaglist);
 				if (response)
@@ -1618,8 +1619,8 @@ imap_sync (CamelFolder *folder,
 		camel_message_info_free (info);
 
 		/* Note: to 'unset' flags, use -FLAGS.SILENT (<flag list>) */
-		if (!camel_exception_is_set (&local_ex)) {
-			response = camel_imap_command (store, folder, &local_ex,
+		if (local_error == NULL) {
+			response = camel_imap_command (store, folder, &local_error,
 					       "UID STORE %s %sFLAGS.SILENT %s",
 					       set, unset ? "-" : "", flaglist);
 		}
@@ -1630,7 +1631,7 @@ imap_sync (CamelFolder *folder,
 		if (response)
 			camel_imap_response_free (store, response);
 
-		if (!camel_exception_is_set (&local_ex)) {
+		if (local_error == NULL) {
 			for (j = 0; j < matches->len; j++) {
 				info = matches->pdata[j];
 				if (deleted_uids) {
@@ -1657,8 +1658,8 @@ imap_sync (CamelFolder *folder,
 		camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
 		/* check for an exception */
-		if (camel_exception_is_set (&local_ex)) {
-			camel_exception_xfer (ex, &local_ex);
+		if (local_error != NULL) {
+			g_propagate_error (error, local_error);
 			if (deleted_uids) {
 				g_ptr_array_foreach (deleted_uids, (GFunc) camel_pstring_free, NULL);
 				g_ptr_array_free (deleted_uids, TRUE);
@@ -1678,12 +1679,10 @@ imap_sync (CamelFolder *folder,
 		camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 	}
 
-	if (!camel_exception_is_set (ex))
-		move_messages (folder, deleted_uids, real_trash, &local_ex);
-	if (!camel_exception_is_set (&local_ex))
-		move_messages (folder, junked_uids, real_junk, &local_ex);
-	if (camel_exception_is_set (&local_ex))
-		camel_exception_xfer (ex, &local_ex);
+	if (local_error == NULL)
+		move_messages (folder, deleted_uids, real_trash, &local_error);
+	if (local_error == NULL)
+		move_messages (folder, junked_uids, real_junk, &local_error);
 
 	if (deleted_uids) {
 		g_ptr_array_foreach (deleted_uids, (GFunc) camel_pstring_free, NULL);
@@ -1698,14 +1697,17 @@ imap_sync (CamelFolder *folder,
 	if (real_junk)
 		g_object_unref (real_junk);
 
-	if (expunge && !camel_exception_is_set (ex))
-		imap_expunge (folder, ex);
+	if (expunge && local_error == NULL)
+		imap_expunge (folder, &local_error);
+
+	if (local_error != NULL)
+		g_propagate_error (error, local_error);
 
 	g_ptr_array_foreach (summary, (GFunc) camel_pstring_free, NULL);
 	g_ptr_array_free (summary, TRUE);
 
 	/* Save the summary */
-	success = imap_sync_offline (folder, ex);
+	success = imap_sync_offline (folder, error);
 
 	camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
@@ -1731,7 +1733,7 @@ uid_compar (gconstpointer va, gconstpointer vb)
 static gboolean
 imap_expunge_uids_offline (CamelFolder *folder,
                            GPtrArray *uids,
-                           CamelException *ex)
+                           GError **error)
 {
 	CamelFolderChangeInfo *changes;
 	CamelStore *parent_store;
@@ -1755,9 +1757,9 @@ imap_expunge_uids_offline (CamelFolder *folder,
 		 */
 	}
 
-	camel_db_delete_uids (parent_store->cdb_w, full_name, list, ex);
+	camel_db_delete_uids (parent_store->cdb_w, full_name, list, NULL);
 	g_slist_free(list);
-	camel_folder_summary_save_to_db (folder->summary, ex);
+	camel_folder_summary_save_to_db (folder->summary, NULL);
 
 	camel_imap_journal_log (CAMEL_IMAP_FOLDER (folder)->journal,
 			       CAMEL_IMAP_JOURNAL_ENTRY_EXPUNGE, uids);
@@ -1771,7 +1773,7 @@ imap_expunge_uids_offline (CamelFolder *folder,
 static gboolean
 imap_expunge_uids_online (CamelFolder *folder,
                           GPtrArray *uids,
-                          CamelException *ex)
+                          GError **error)
 {
 	CamelImapStore *store;
 	CamelImapResponse *response;
@@ -1793,7 +1795,7 @@ imap_expunge_uids_online (CamelFolder *folder,
 	camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
 	if ((store->capabilities & IMAP_CAPABILITY_UIDPLUS) == 0) {
-		if (!CAMEL_FOLDER_GET_CLASS (folder)->sync (folder, 0, ex)) {
+		if (!CAMEL_FOLDER_GET_CLASS (folder)->sync (folder, 0, error)) {
 			camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 			return FALSE;
 		}
@@ -1803,7 +1805,7 @@ imap_expunge_uids_online (CamelFolder *folder,
 
 	while (uid < uids->len) {
 		set = imap_uid_array_to_set (folder->summary, uids, uid, UID_SET_LIMIT, &uid);
-		response = camel_imap_command (store, folder, ex,
+		response = camel_imap_command (store, folder, error,
 					       "UID STORE %s +FLAGS.SILENT (\\Deleted)",
 					       set);
 		if (response)
@@ -1815,12 +1817,14 @@ imap_expunge_uids_online (CamelFolder *folder,
 		}
 
 		if (!full_expunge) {
-			response = camel_imap_command (store, folder, ex,
-						       "UID EXPUNGE %s", set);
+			GError *local_error = NULL;
+
+			response = camel_imap_command (
+				store, folder, &local_error,
+				"UID EXPUNGE %s", set);
 
-			if (camel_exception_is_set (ex)) {
-				g_debug (G_STRLOC ": 'UID EXPUNGE %s' failed: %s (0x%x)", set, camel_exception_get_description (ex), camel_exception_get_id (ex));
-				camel_exception_clear (ex);
+			if (local_error != NULL) {
+				g_clear_error (&local_error);
 
 				/* UID EXPUNGE failed, something is broken on the server probably,
 				   thus fall back to the full expunge. It's not so good, especially
@@ -1832,7 +1836,7 @@ imap_expunge_uids_online (CamelFolder *folder,
 		}
 
 		if (full_expunge)
-			response = camel_imap_command (store, folder, ex, "EXPUNGE");
+			response = camel_imap_command (store, folder, NULL, "EXPUNGE");
 
 		if (response)
 			camel_imap_response_free (store, response);
@@ -1852,9 +1856,9 @@ imap_expunge_uids_online (CamelFolder *folder,
 		 */
 	}
 
-	camel_db_delete_uids (parent_store->cdb_w, full_name, list, ex);
+	camel_db_delete_uids (parent_store->cdb_w, full_name, list, NULL);
 	g_slist_free (list);
-	camel_folder_summary_save_to_db (folder->summary, ex);
+	camel_folder_summary_save_to_db (folder->summary, NULL);
 	camel_folder_changed (folder, changes);
 	camel_folder_change_info_free (changes);
 
@@ -1863,7 +1867,7 @@ imap_expunge_uids_online (CamelFolder *folder,
 
 static gboolean
 imap_expunge (CamelFolder *folder,
-              CamelException *ex)
+              GError **error)
 {
 	CamelStore *parent_store;
 	GPtrArray *uids = NULL;
@@ -1873,33 +1877,33 @@ imap_expunge (CamelFolder *folder,
 	full_name = camel_folder_get_full_name (folder);
 	parent_store = camel_folder_get_parent_store (folder);
 
-	camel_folder_summary_save_to_db (folder->summary, ex);
+	camel_folder_summary_save_to_db (folder->summary, NULL);
 
 	if ((parent_store->flags & CAMEL_STORE_VTRASH) == 0) {
 		CamelFolder *trash;
-		CamelException ex2;
+		GError *local_error = NULL;
 
-		camel_exception_init (&ex2);
-		trash = camel_store_get_trash (parent_store, &ex2);
+		trash = camel_store_get_trash (parent_store, &local_error);
 
-		if (!camel_exception_is_set (&ex2) && trash && (folder == trash || g_ascii_strcasecmp (full_name, camel_folder_get_full_name (trash)) == 0)) {
+		if (local_error == NULL && trash && (folder == trash || g_ascii_strcasecmp (full_name, camel_folder_get_full_name (trash)) == 0)) {
 			/* it's a real trash folder, thus get all mails from there */
 			uids = camel_folder_summary_array (folder->summary);
 		}
 
-		camel_exception_clear (&ex2);
+		if (local_error != NULL)
+			g_clear_error (&local_error);
 	}
 
 	if (!uids)
-		uids = camel_db_get_folder_deleted_uids (parent_store->cdb_r, full_name, ex);
+		uids = camel_db_get_folder_deleted_uids (parent_store->cdb_r, full_name, NULL);
 
 	if (!uids)
 		return TRUE;
 
 	if (CAMEL_OFFLINE_STORE (parent_store)->state == CAMEL_OFFLINE_STORE_NETWORK_AVAIL)
-		success = imap_expunge_uids_online (folder, uids, ex);
+		success = imap_expunge_uids_online (folder, uids, error);
 	else
-		success = imap_expunge_uids_offline (folder, uids, ex);
+		success = imap_expunge_uids_offline (folder, uids, error);
 
 	g_ptr_array_foreach (uids, (GFunc) camel_pstring_free, NULL);
 	g_ptr_array_free (uids, TRUE);
@@ -1910,7 +1914,7 @@ imap_expunge (CamelFolder *folder,
 gboolean
 camel_imap_expunge_uids_resyncing (CamelFolder *folder,
                                    GPtrArray *uids,
-                                   CamelException *ex)
+                                   GError **error)
 {
 	CamelStore *parent_store;
 	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
@@ -1926,7 +1930,7 @@ camel_imap_expunge_uids_resyncing (CamelFolder *folder,
 		return TRUE;
 
 	if (store->capabilities & IMAP_CAPABILITY_UIDPLUS)
-		return imap_expunge_uids_online (folder, uids, ex);
+		return imap_expunge_uids_online (folder, uids, error);
 
 	/* If we don't have UID EXPUNGE we need to avoid expunging any
 	 * of the wrong messages. So we search for deleted messages,
@@ -1936,17 +1940,17 @@ camel_imap_expunge_uids_resyncing (CamelFolder *folder,
 
 	camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	if (!CAMEL_FOLDER_GET_CLASS (folder)->sync (folder, 0, ex)) {
+	if (!CAMEL_FOLDER_GET_CLASS (folder)->sync (folder, 0, error)) {
 		camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 		return FALSE;
 	}
 
-	response = camel_imap_command (store, folder, ex, "UID SEARCH DELETED");
+	response = camel_imap_command (store, folder, error, "UID SEARCH DELETED");
 	if (!response) {
 		camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 		return FALSE;
 	}
-	result = camel_imap_response_extract (store, response, "SEARCH", ex);
+	result = camel_imap_response_extract (store, response, "SEARCH", error);
 	if (!result) {
 		camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 		return FALSE;
@@ -2000,7 +2004,7 @@ camel_imap_expunge_uids_resyncing (CamelFolder *folder,
 		while (uid < keep_uids->len) {
 			uidset = imap_uid_array_to_set (folder->summary, keep_uids, uid, UID_SET_LIMIT, &uid);
 
-			response = camel_imap_command (store, folder, ex,
+			response = camel_imap_command (store, folder, error,
 						       "UID STORE %s -FLAGS.SILENT (\\Deleted)",
 						       uidset);
 
@@ -2024,7 +2028,7 @@ camel_imap_expunge_uids_resyncing (CamelFolder *folder,
 		while (uid < mark_uids->len) {
 			uidset = imap_uid_array_to_set (folder->summary, mark_uids, uid, UID_SET_LIMIT, &uid);
 
-			response = camel_imap_command (store, folder, ex,
+			response = camel_imap_command (store, folder, error,
 						       "UID STORE %s +FLAGS.SILENT (\\Deleted)",
 						       uidset);
 
@@ -2044,7 +2048,7 @@ camel_imap_expunge_uids_resyncing (CamelFolder *folder,
 	}
 
 	/* Do the actual expunging */
-	response = camel_imap_command (store, folder, ex, "EXPUNGE");
+	response = camel_imap_command (store, folder, NULL, "EXPUNGE");
 	if (response)
 		camel_imap_response_free (store, response);
 
@@ -2056,9 +2060,7 @@ camel_imap_expunge_uids_resyncing (CamelFolder *folder,
 		while (uid < keep_uids->len) {
 			uidset = imap_uid_array_to_set (folder->summary, keep_uids, uid, UID_SET_LIMIT, &uid);
 
-			/* Don't pass ex if it's already been set */
-			response = camel_imap_command (store, folder,
-						       camel_exception_is_set (ex) ? NULL : ex,
+			response = camel_imap_command (store, folder, NULL,
 						       "UID STORE %s +FLAGS.SILENT (\\Deleted)",
 						       uidset);
 
@@ -2078,22 +2080,24 @@ camel_imap_expunge_uids_resyncing (CamelFolder *folder,
 	return TRUE;
 }
 
-void
-camel_imap_expunge_uids_only (CamelFolder *folder, GPtrArray *uids, CamelException *ex)
+gboolean
+camel_imap_expunge_uids_only (CamelFolder *folder,
+                              GPtrArray *uids,
+                              GError **error)
 {
 	CamelStore *parent_store;
 
-	g_return_if_fail (folder != NULL);
+	g_return_val_if_fail (folder != NULL, FALSE);
 
 	parent_store = camel_folder_get_parent_store (folder);
-	g_return_if_fail (parent_store != NULL);
+	g_return_val_if_fail (parent_store != NULL, FALSE);
 
-	g_return_if_fail (uids != NULL);
+	g_return_val_if_fail (uids != NULL, FALSE);
 
 	if (CAMEL_OFFLINE_STORE (parent_store)->state == CAMEL_OFFLINE_STORE_NETWORK_AVAIL)
-		camel_imap_expunge_uids_resyncing (folder, uids, ex);
+		return camel_imap_expunge_uids_resyncing (folder, uids, error);
 	else
-		imap_expunge_uids_offline (folder, uids, ex);
+		return imap_expunge_uids_offline (folder, uids, error);
 }
 
 static gchar *
@@ -2118,7 +2122,7 @@ imap_append_offline (CamelFolder *folder,
                      CamelMimeMessage *message,
                      const CamelMessageInfo *info,
                      gchar **appended_uid,
-                     CamelException *ex)
+                     GError **error)
 {
 	CamelImapMessageCache *cache = CAMEL_IMAP_FOLDER (folder)->cache;
 	CamelFolderChangeInfo *changes;
@@ -2128,8 +2132,8 @@ imap_append_offline (CamelFolder *folder,
 
 	camel_imap_summary_add_offline (folder->summary, uid, message, info);
 	CAMEL_IMAP_FOLDER_REC_LOCK (folder, cache_lock);
-	camel_imap_message_cache_insert_wrapper (cache, uid, "",
-						 CAMEL_DATA_WRAPPER (message), ex);
+	camel_imap_message_cache_insert_wrapper (
+		cache, uid, "", CAMEL_DATA_WRAPPER (message));
 	CAMEL_IMAP_FOLDER_REC_UNLOCK (folder, cache_lock);
 
 	changes = camel_folder_change_info_new ();
@@ -2173,7 +2177,7 @@ do_append (CamelFolder *folder,
            CamelMimeMessage *message,
            const CamelMessageInfo *info,
            gchar **uid,
-           CamelException *ex)
+           GError **error)
 {
 	CamelStore *parent_store;
 	CamelImapStore *store;
@@ -2185,6 +2189,7 @@ do_append (CamelFolder *folder,
 	const gchar *full_name;
 	gchar *flagstr, *end;
 	guint32 flags = 0;
+	GError *local_error = NULL;
 
 	parent_store = camel_folder_get_parent_store (folder);
 	store = CAMEL_IMAP_STORE (parent_store);
@@ -2204,7 +2209,7 @@ do_append (CamelFolder *folder,
 	camel_stream_filter_add (
 		CAMEL_STREAM_FILTER (streamfilter), crlf_filter);
 	camel_data_wrapper_write_to_stream (
-		CAMEL_DATA_WRAPPER (message), streamfilter);
+		CAMEL_DATA_WRAPPER (message), streamfilter, NULL);
 	g_object_unref (streamfilter);
 	g_object_unref (crlf_filter);
 	g_object_unref (memstream);
@@ -2224,47 +2229,36 @@ retry:
 
 	full_name = camel_folder_get_full_name (folder);
 	response = camel_imap_command (
-		store, NULL, ex, "APPEND %F%s%s {%d}",
+		store, NULL, &local_error, "APPEND %F%s%s {%d}",
 		full_name, flagstr ? " " : "",
 		flagstr ? flagstr : "", ba->len);
 	g_free (flagstr);
 
 	if (!response) {
-		if (camel_exception_get_id(ex) == CAMEL_EXCEPTION_SERVICE_INVALID && !store->nocustomappend) {
-			camel_exception_clear(ex);
+		if (g_error_matches (local_error, CAMEL_SERVICE_ERROR, CAMEL_SERVICE_ERROR_INVALID) && !store->nocustomappend) {
+			g_clear_error (&local_error);
 			store->nocustomappend = 1;
 			goto retry;
 		}
+		g_propagate_error (error, local_error);
 		g_byte_array_free (ba, TRUE);
 		return NULL;
 	}
 
 	if (*response->status != '+') {
-		if (!camel_exception_is_set (ex))
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
-				_("Unexpected response status '%s' after APPEND command"),
-				response->status);
-
 		camel_imap_response_free (store, response);
 		g_byte_array_free (ba, TRUE);
 		return NULL;
 	}
 
 	/* send the rest of our data - the mime message */
-	response2 = camel_imap_command_continuation (store, (const gchar *) ba->data, ba->len, ex);
+	response2 = camel_imap_command_continuation (store, (const gchar *) ba->data, ba->len, error);
 	g_byte_array_free (ba, TRUE);
 
 	/* free it only after message is sent. This may cause more FETCHes. */
 	camel_imap_response_free (store, response);
-	if (!response2) {
-		if (!camel_exception_is_set (ex))
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SYSTEM,
-				_("No response on continuation after APPEND command"));
-
+	if (!response2)
 		return response2;
-	}
 
 	if (store->capabilities & IMAP_CAPABILITY_UIDPLUS) {
 		*uid = camel_strstrcase (response2->status, "[APPENDUID ");
@@ -2292,7 +2286,7 @@ imap_append_online (CamelFolder *folder,
                     CamelMimeMessage *message,
                     const CamelMessageInfo *info,
                     gchar **appended_uid,
-                    CamelException *ex)
+                    GError **error)
 {
 	CamelStore *parent_store;
 	CamelImapStore *store;
@@ -2305,18 +2299,13 @@ imap_append_online (CamelFolder *folder,
 	store = CAMEL_IMAP_STORE (parent_store);
 
 	if (CAMEL_OFFLINE_STORE (store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
-		return imap_append_offline (folder, message, info, appended_uid, ex);
+		return imap_append_offline (folder, message, info, appended_uid, error);
 	}
 
 	count = camel_folder_summary_count (folder->summary);
-	response = do_append (folder, message, info, &uid, ex);
-	if (!response) {
-		if (!camel_exception_is_set (ex))
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SYSTEM,
-				_("Unknown error occurred during APPEND command!"));
+	response = do_append (folder, message, info, &uid, error);
+	if (!response)
 		return FALSE;
-	}
 
 	if (uid) {
 		/* Cache first, since freeing response may trigger a
@@ -2325,7 +2314,7 @@ imap_append_online (CamelFolder *folder,
 		CAMEL_IMAP_FOLDER_REC_LOCK (folder, cache_lock);
 		camel_imap_message_cache_insert_wrapper (
 			CAMEL_IMAP_FOLDER (folder)->cache, uid,
-			"", CAMEL_DATA_WRAPPER (message), ex);
+			"", CAMEL_DATA_WRAPPER (message));
 		CAMEL_IMAP_FOLDER_REC_UNLOCK (folder, cache_lock);
 		if (appended_uid)
 			*appended_uid = uid;
@@ -2340,7 +2329,7 @@ imap_append_online (CamelFolder *folder,
 	camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 	if (store->current_folder != folder ||
 	    camel_folder_summary_count (folder->summary) == count)
-		success = imap_refresh_info (folder, ex);
+		success = imap_refresh_info (folder, error);
 	camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
 	return success;
@@ -2351,7 +2340,7 @@ camel_imap_append_resyncing (CamelFolder *folder,
                              CamelMimeMessage *message,
                              const CamelMessageInfo *info,
                              gchar **appended_uid,
-                             CamelException *ex)
+                             GError **error)
 {
 	CamelStore *parent_store;
 	CamelImapStore *store;
@@ -2361,7 +2350,7 @@ camel_imap_append_resyncing (CamelFolder *folder,
 	parent_store = camel_folder_get_parent_store (folder);
 	store = CAMEL_IMAP_STORE (parent_store);
 
-	response = do_append (folder, message, info, &uid, ex);
+	response = do_append (folder, message, info, &uid, error);
 	if (!response)
 		return FALSE;
 
@@ -2371,7 +2360,7 @@ camel_imap_append_resyncing (CamelFolder *folder,
 
 		CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock);
 		camel_imap_message_cache_copy (imap_folder->cache, olduid,
-					       imap_folder->cache, uid, ex);
+					       imap_folder->cache, uid);
 		CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
 
 		if (appended_uid)
@@ -2392,7 +2381,7 @@ imap_transfer_offline (CamelFolder *source,
                        CamelFolder *dest,
                        GPtrArray **transferred_uids,
                        gboolean delete_originals,
-                       CamelException *ex)
+                       GError **error)
 {
 	CamelStore *parent_store;
 	CamelImapStore *store;
@@ -2403,6 +2392,7 @@ imap_transfer_offline (CamelFolder *source,
 	CamelMessageInfo *mi;
 	gchar *uid, *destuid;
 	gint i;
+	GError *local_error = NULL;
 
 	parent_store = camel_folder_get_parent_store (source);
 	store = CAMEL_IMAP_STORE (parent_store);
@@ -2424,7 +2414,7 @@ imap_transfer_offline (CamelFolder *source,
 
 	changes = camel_folder_change_info_new ();
 
-	for (i = 0; i < uids->len && !camel_exception_is_set (ex); i++) {
+	for (i = 0; i < uids->len && local_error == NULL; i++) {
 		uid = uids->pdata[i];
 
 		destuid = get_temp_uid ();
@@ -2440,7 +2430,7 @@ imap_transfer_offline (CamelFolder *source,
 		} else
 			camel_imap_summary_add_offline_uncached (dest->summary, destuid, mi);
 
-		camel_imap_message_cache_copy (sc, uid, dc, destuid, ex);
+		camel_imap_message_cache_copy (sc, uid, dc, destuid);
 		camel_message_info_free(mi);
 
 		camel_folder_change_info_add_uid (changes, destuid);
@@ -2449,7 +2439,7 @@ imap_transfer_offline (CamelFolder *source,
 		else
 			g_free (destuid);
 
-		if (delete_originals && !camel_exception_is_set (ex))
+		if (delete_originals && local_error == NULL)
 			camel_folder_delete_message (source, uid);
 	}
 
@@ -2462,7 +2452,12 @@ imap_transfer_offline (CamelFolder *source,
 	camel_imap_journal_log (
 		CAMEL_IMAP_FOLDER (source)->journal,
 		CAMEL_IMAP_JOURNAL_ENTRY_TRANSFER,
-		dest, uids, delete_originals, ex);
+		dest, uids, delete_originals, NULL);
+
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return FALSE;
+	}
 
 	return TRUE;
 }
@@ -2504,8 +2499,7 @@ handle_copyuid (CamelImapResponse *response, CamelFolder *source,
 		CAMEL_IMAP_FOLDER_REC_LOCK (destination, cache_lock);
 		for (i = 0; i < src->len; i++) {
 			camel_imap_message_cache_copy (scache, src->pdata[i],
-						       dcache, dest->pdata[i],
-						       NULL);
+						       dcache, dest->pdata[i]);
 
 			imap_folder_add_ignore_recent (CAMEL_IMAP_FOLDER (destination), dest->pdata[i]);
 		}
@@ -2534,7 +2528,6 @@ handle_copyuid_copy_user_tags (CamelImapResponse *response,
 	gchar *validity, *srcset, *destset;
 	GPtrArray *src, *dest;
 	gint i;
-	CamelException ex;
 
 	validity = camel_strstrcase (response->status, "[COPYUID ");
 	if (!validity)
@@ -2557,16 +2550,10 @@ handle_copyuid_copy_user_tags (CamelImapResponse *response,
 		CAMEL_IMAP_STORE (parent_store), camel_imap_command (
 		CAMEL_IMAP_STORE (parent_store), destination, NULL, "NOOP"));
 
-	camel_exception_init (&ex);
 	/* refresh folder's summary first, we copied messages there on the server,
 	   but do not know about it in a local summary */
-	imap_refresh_info (destination, &ex);
-	if (camel_exception_is_set (&ex)) {
-		g_warning ("destination folder refresh failed, error: %s", ex.desc);
-		camel_exception_clear (&ex);
+	if (!imap_refresh_info (destination, NULL))
 		goto lose;
-	}
-	camel_exception_clear (&ex);
 
 	src = imap_uid_set_to_array (source->summary, srcset);
 	dest = imap_uid_set_to_array (destination->summary, destset);
@@ -2646,7 +2633,7 @@ do_copy (CamelFolder *source,
          GPtrArray *uids,
          CamelFolder *destination,
          gint delete_originals,
-         CamelException *ex)
+         GError **error)
 {
 	CamelStore *parent_store;
 	CamelImapStore *store;
@@ -2654,26 +2641,27 @@ do_copy (CamelFolder *source,
 	const gchar *full_name;
 	gchar *uidset;
 	gint uid = 0, last=0, i;
+	GError *local_error = NULL;
 
 	parent_store = camel_folder_get_parent_store (source);
 	store = CAMEL_IMAP_STORE (parent_store);
 
 	full_name = camel_folder_get_full_name (destination);
 
-	while (uid < uids->len && !camel_exception_is_set (ex)) {
+	while (uid < uids->len && local_error == NULL) {
 		uidset = imap_uid_array_to_set (source->summary, uids, uid, UID_SET_LIMIT, &uid);
 
 		/* use XGWMOVE only when none of the moving messages has set any user tag */
 		if ((store->capabilities & IMAP_CAPABILITY_XGWMOVE) != 0 && delete_originals && !any_has_user_tag (source, uidset)) {
 			response = camel_imap_command (
-				store, source, ex,
+				store, source, &local_error,
 				"UID XGWMOVE %s %F", uidset,
 				full_name);
 			/* returns only 'A00012 OK UID XGWMOVE completed' '* 2 XGWMOVE' so nothing useful */
 			camel_imap_response_free (store, response);
 		} else {
 			response = camel_imap_command (
-				store, source, ex,
+				store, source, &local_error,
 				"UID COPY %s %F", uidset,
 				full_name);
 			if (response && (store->capabilities & IMAP_CAPABILITY_UIDPLUS))
@@ -2683,7 +2671,7 @@ do_copy (CamelFolder *source,
 			camel_imap_response_free (store, response);
 		}
 
-		if (!camel_exception_is_set(ex) && delete_originals) {
+		if (local_error == NULL && delete_originals) {
 			for (i=last;i<uid;i++)
 				camel_folder_delete_message(source, uids->pdata[i]);
 			last = uid;
@@ -2691,17 +2679,22 @@ do_copy (CamelFolder *source,
 		g_free (uidset);
 	}
 
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return FALSE;
+	}
+
 	return TRUE;
 }
 
 static gboolean
 imap_transfer_messages (CamelFolder *source,
-			GPtrArray *uids,
-			CamelFolder *dest,
-			GPtrArray **transferred_uids,
-			gboolean delete_originals,
-			CamelException *ex,
-			gboolean can_call_sync)
+                        GPtrArray *uids,
+                        CamelFolder *dest,
+                        GPtrArray **transferred_uids,
+                        gboolean delete_originals,
+                        gboolean can_call_sync,
+                        GError **error)
 {
 	CamelStore *parent_store;
 	CamelImapStore *store;
@@ -2714,10 +2707,10 @@ imap_transfer_messages (CamelFolder *source,
 	if (CAMEL_OFFLINE_STORE (store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
 		return imap_transfer_offline (
 			source, uids, dest, transferred_uids,
-			delete_originals, ex);
+			delete_originals, error);
 
 	/* Sync message flags if needed. */
-	if (can_call_sync && !imap_sync (source, FALSE, ex))
+	if (can_call_sync && !imap_sync (source, FALSE, error))
 		return FALSE;
 
 	count = camel_folder_summary_count (dest->summary);
@@ -2725,13 +2718,13 @@ imap_transfer_messages (CamelFolder *source,
 	qsort (uids->pdata, uids->len, sizeof (gpointer), uid_compar);
 
 	/* Now copy the messages */
-	if (!do_copy(source, uids, dest, delete_originals, ex))
+	if (!do_copy(source, uids, dest, delete_originals, error))
 		return FALSE;
 
 	/* Make the destination notice its new messages */
 	if (store->current_folder != dest ||
 	    camel_folder_summary_count (dest->summary) == count)
-		success = imap_refresh_info (dest, ex);
+		success = imap_refresh_info (dest, error);
 
 	/* FIXME */
 	if (transferred_uids)
@@ -2746,9 +2739,9 @@ imap_transfer_online (CamelFolder *source,
                       CamelFolder *dest,
                       GPtrArray **transferred_uids,
                       gboolean delete_originals,
-                      CamelException *ex)
+                      GError **error)
 {
-	return imap_transfer_messages (source, uids, dest, transferred_uids, delete_originals, ex, TRUE);
+	return imap_transfer_messages (source, uids, dest, transferred_uids, delete_originals, TRUE, error);
 }
 
 gboolean
@@ -2757,13 +2750,14 @@ camel_imap_transfer_resyncing (CamelFolder *source,
                                CamelFolder *dest,
                                GPtrArray **transferred_uids,
                                gboolean delete_originals,
-                               CamelException *ex)
+                               GError **error)
 {
 	GPtrArray *realuids;
 	gint first, i;
 	const gchar *uid;
 	CamelMimeMessage *message;
 	CamelMessageInfo *info;
+	GError *local_error = NULL;
 
 	qsort (uids->pdata, uids->len, sizeof (gpointer), uid_compar);
 
@@ -2776,7 +2770,7 @@ camel_imap_transfer_resyncing (CamelFolder *source,
 	realuids = g_ptr_array_new ();
 
 	i = 0;
-	while (i < uids->len && !camel_exception_is_set (ex)) {
+	while (i < uids->len && local_error == NULL) {
 		 /* Skip past real UIDs  */
 		for (first = i; i < uids->len; i++) {
 			uid = uids->pdata[i];
@@ -2791,16 +2785,16 @@ camel_imap_transfer_resyncing (CamelFolder *source,
 
 		/* If we saw any real UIDs, do a COPY */
 		if (i != first) {
-			do_copy (source, realuids, dest, delete_originals, ex);
+			do_copy (source, realuids, dest, delete_originals, &local_error);
 			g_ptr_array_set_size (realuids, 0);
-			if (i == uids->len || camel_exception_is_set (ex))
+			if (i == uids->len || local_error != NULL)
 				break;
 		}
 
 		/* Deal with fake UIDs */
 		while (i < uids->len &&
 		       !isdigit (*(guchar *)(uids->pdata[i])) &&
-		       !camel_exception_is_set (ex)) {
+		       local_error == NULL) {
 			uid = uids->pdata[i];
 			message = camel_folder_get_message (source, uid, NULL);
 			if (!message) {
@@ -2811,10 +2805,10 @@ camel_imap_transfer_resyncing (CamelFolder *source,
 			info = camel_folder_get_message_info (source, uid);
 			g_return_val_if_fail (info != NULL, FALSE);
 
-			imap_append_online (dest, message, info, NULL, ex);
+			imap_append_online (dest, message, info, NULL, &local_error);
 			camel_folder_free_message_info (source, info);
 			g_object_unref (CAMEL_OBJECT (message));
-			if (delete_originals && !camel_exception_is_set (ex))
+			if (delete_originals && local_error == NULL)
 				camel_folder_delete_message (source, uid);
 			i++;
 		}
@@ -2826,13 +2820,18 @@ camel_imap_transfer_resyncing (CamelFolder *source,
 	if (transferred_uids)
 		*transferred_uids = NULL;
 
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return FALSE;
+	}
+
 	return TRUE;
 }
 
 static GPtrArray *
 imap_search_by_expression (CamelFolder *folder,
                            const gchar *expression,
-                           CamelException *ex)
+                           GError **error)
 {
 	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
 	GPtrArray *matches;
@@ -2843,7 +2842,7 @@ imap_search_by_expression (CamelFolder *folder,
 	CAMEL_IMAP_FOLDER_LOCK(folder, search_lock);
 
 	camel_folder_search_set_folder (imap_folder->search, folder);
-	matches = camel_folder_search_search(imap_folder->search, expression, NULL, ex);
+	matches = camel_folder_search_search(imap_folder->search, expression, NULL, error);
 
 	CAMEL_IMAP_FOLDER_UNLOCK(folder, search_lock);
 
@@ -2853,7 +2852,7 @@ imap_search_by_expression (CamelFolder *folder,
 static guint32
 imap_count_by_expression (CamelFolder *folder,
                           const gchar *expression,
-                          CamelException *ex)
+                          GError **error)
 {
 	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
 	guint32 matches;
@@ -2864,7 +2863,7 @@ imap_count_by_expression (CamelFolder *folder,
 	CAMEL_IMAP_FOLDER_LOCK(folder, search_lock);
 
 	camel_folder_search_set_folder (imap_folder->search, folder);
-	matches = camel_folder_search_count(imap_folder->search, expression, ex);
+	matches = camel_folder_search_count(imap_folder->search, expression, error);
 
 	CAMEL_IMAP_FOLDER_UNLOCK(folder, search_lock);
 
@@ -2875,7 +2874,7 @@ static GPtrArray *
 imap_search_by_uids (CamelFolder *folder,
                      const gchar *expression,
                      GPtrArray *uids,
-                     CamelException *ex)
+                     GError **error)
 {
 	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER(folder);
 	GPtrArray *matches;
@@ -2886,7 +2885,7 @@ imap_search_by_uids (CamelFolder *folder,
 	CAMEL_IMAP_FOLDER_LOCK(folder, search_lock);
 
 	camel_folder_search_set_folder(imap_folder->search, folder);
-	matches = camel_folder_search_search(imap_folder->search, expression, uids, ex);
+	matches = camel_folder_search_search(imap_folder->search, expression, uids, error);
 
 	CAMEL_IMAP_FOLDER_UNLOCK(folder, search_lock);
 
@@ -2910,7 +2909,7 @@ imap_search_free (CamelFolder *folder, GPtrArray *uids)
 static CamelMimeMessage *get_message (CamelImapFolder *imap_folder,
 				      const gchar *uid,
 				      CamelMessageContentInfo *ci,
-				      CamelException *ex);
+				      GError **error);
 
 struct _part_spec_stack {
 	struct _part_spec_stack *parent;
@@ -3002,7 +3001,7 @@ static CamelDataWrapper *
 get_content (CamelImapFolder *imap_folder, const gchar *uid,
 	     CamelMimePart *part, CamelMessageContentInfo *ci,
 	     gint frommsg,
-	     CamelException *ex)
+	     GError **error)
 {
 	CamelDataWrapper *content = NULL;
 	CamelStream *stream;
@@ -3033,10 +3032,10 @@ get_content (CamelImapFolder *imap_folder, const gchar *uid,
 			strcpy(spec, part_spec);
 		g_free(part_spec);
 
-		stream = camel_imap_folder_fetch_data (imap_folder, uid, spec, FALSE, ex);
+		stream = camel_imap_folder_fetch_data (imap_folder, uid, spec, FALSE, error);
 		if (stream) {
 			ret = camel_data_wrapper_construct_from_stream (
-				CAMEL_DATA_WRAPPER (body_mp), stream);
+				CAMEL_DATA_WRAPPER (body_mp), stream, error);
 			g_object_unref (CAMEL_OBJECT (stream));
 			if (ret == -1) {
 				g_object_unref ( body_mp);
@@ -3071,12 +3070,12 @@ get_content (CamelImapFolder *imap_folder, const gchar *uid,
 		num = 1;
 		while (ci) {
 			sprintf (child_spec + speclen, "%d.MIME", num++);
-			stream = camel_imap_folder_fetch_data (imap_folder, uid, child_spec, FALSE, ex);
+			stream = camel_imap_folder_fetch_data (imap_folder, uid, child_spec, FALSE, error);
 			if (stream) {
 				gint ret;
 
 				part = camel_mime_part_new ();
-				ret = camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (part), stream);
+				ret = camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (part), stream, error);
 				g_object_unref (CAMEL_OBJECT (stream));
 				if (ret == -1) {
 					g_object_unref (CAMEL_OBJECT (part));
@@ -3085,7 +3084,7 @@ get_content (CamelImapFolder *imap_folder, const gchar *uid,
 					return NULL;
 				}
 
-				content = get_content (imap_folder, uid, part, ci, FALSE, ex);
+				content = get_content (imap_folder, uid, part, ci, FALSE, error);
 			}
 
 			if (!stream || !content) {
@@ -3127,7 +3126,7 @@ get_content (CamelImapFolder *imap_folder, const gchar *uid,
 
 		return (CamelDataWrapper *) body_mp;
 	} else if (camel_content_type_is (ci->type, "message", "rfc822")) {
-		content = (CamelDataWrapper *) get_message (imap_folder, uid, ci->childs, ex);
+		content = (CamelDataWrapper *) get_message (imap_folder, uid, ci->childs, error);
 		g_free (part_spec);
 		return content;
 	} else {
@@ -3151,7 +3150,7 @@ get_content (CamelImapFolder *imap_folder, const gchar *uid,
 static CamelMimeMessage *
 get_message (CamelImapFolder *imap_folder, const gchar *uid,
 	     CamelMessageContentInfo *ci,
-	     CamelException *ex)
+	     GError **error)
 {
 	CamelFolder *folder;
 	CamelStore *parent_store;
@@ -3171,7 +3170,7 @@ get_message (CamelImapFolder *imap_folder, const gchar *uid,
 	section_text = g_strdup_printf ("%s%s%s", part_spec, *part_spec ? "." : "",
 					store->server_level >= IMAP_LEVEL_IMAP4REV1 ? "HEADER" : "0");
 
-	stream = camel_imap_folder_fetch_data (imap_folder, uid, section_text, FALSE, ex);
+	stream = camel_imap_folder_fetch_data (imap_folder, uid, section_text, FALSE, error);
 	g_free (section_text);
 	g_free(part_spec);
 	if (!stream)
@@ -3179,14 +3178,14 @@ get_message (CamelImapFolder *imap_folder, const gchar *uid,
 
 	msg = camel_mime_message_new ();
 	ret = camel_data_wrapper_construct_from_stream (
-		CAMEL_DATA_WRAPPER (msg), stream);
+		CAMEL_DATA_WRAPPER (msg), stream, error);
 	g_object_unref (CAMEL_OBJECT (stream));
 	if (ret == -1) {
 		g_object_unref (CAMEL_OBJECT (msg));
 		return NULL;
 	}
 
-	content = get_content (imap_folder, uid, CAMEL_MIME_PART (msg), ci, TRUE, ex);
+	content = get_content (imap_folder, uid, CAMEL_MIME_PART (msg), ci, TRUE, error);
 	if (!content) {
 		g_object_unref (CAMEL_OBJECT (msg));
 		return NULL;
@@ -3212,27 +3211,24 @@ get_message (CamelImapFolder *imap_folder, const gchar *uid,
 
 static CamelMimeMessage *
 get_message_simple (CamelImapFolder *imap_folder, const gchar *uid,
-		    CamelStream *stream, CamelException *ex)
+		    CamelStream *stream, GError **error)
 {
 	CamelMimeMessage *msg;
 	gint ret;
 
 	if (!stream) {
 		stream = camel_imap_folder_fetch_data (imap_folder, uid, "",
-						       FALSE, ex);
+						       FALSE, error);
 		if (!stream)
 			return NULL;
 	}
 
 	msg = camel_mime_message_new ();
 	ret = camel_data_wrapper_construct_from_stream (
-		CAMEL_DATA_WRAPPER (msg), stream);
+		CAMEL_DATA_WRAPPER (msg), stream, error);
 	g_object_unref (CAMEL_OBJECT (stream));
 	if (ret == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-			_("Unable to retrieve message: %s"),
-			g_strerror (errno));
+		g_prefix_error (error, _("Unable to retrieve message: "));
 		g_object_unref (CAMEL_OBJECT (msg));
 		return NULL;
 	}
@@ -3259,13 +3255,14 @@ content_info_incomplete (CamelMessageContentInfo *ci)
 }
 
 static CamelImapMessageInfo *
-imap_folder_summary_uid_or_error(CamelFolderSummary *summary, const gchar * uid, CamelException *ex)
+imap_folder_summary_uid_or_error(CamelFolderSummary *summary, const gchar * uid, GError **error)
 {
 	CamelImapMessageInfo *mi;
 	mi = (CamelImapMessageInfo *)camel_folder_summary_uid (summary, uid);
 	if (mi == NULL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+		g_set_error (
+			error, CAMEL_FOLDER_ERROR,
+			CAMEL_FOLDER_ERROR_INVALID_UID,
 			_("Cannot get message with message ID %s: %s"),
 			uid, _("No such message available."));
 	}
@@ -3275,7 +3272,7 @@ imap_folder_summary_uid_or_error(CamelFolderSummary *summary, const gchar * uid,
 static CamelMimeMessage *
 imap_get_message (CamelFolder *folder,
                   const gchar *uid,
-                  CamelException *ex)
+                  GError **error)
 {
 	CamelStore *parent_store;
 	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
@@ -3284,18 +3281,19 @@ imap_get_message (CamelFolder *folder,
 	CamelMimeMessage *msg = NULL;
 	CamelStream *stream = NULL;
 	gint retry;
+	GError *local_error = NULL;
 
 	parent_store = camel_folder_get_parent_store (folder);
 	store = CAMEL_IMAP_STORE (parent_store);
 
-	mi = imap_folder_summary_uid_or_error(folder->summary, uid, ex);
+	mi = imap_folder_summary_uid_or_error(folder->summary, uid, error);
 	if (!mi)
 	  return NULL;
 
 	/* If its cached in full, just get it as is, this is only a shortcut,
 	   since we get stuff from the cache anyway.  It affects a busted connection though. */
 	if ( (stream = camel_imap_folder_fetch_data(imap_folder, uid, "", TRUE, NULL))
-	     && (msg = get_message_simple(imap_folder, uid, stream, ex)))
+	     && (msg = get_message_simple(imap_folder, uid, stream, error)))
 		goto done;
 
 	/* All this mess is so we silently retry a fetch if we fail with
@@ -3303,7 +3301,7 @@ imap_get_message (CamelFolder *folder,
 	retry = 0;
 	do {
 		retry++;
-		camel_exception_clear(ex);
+		g_clear_error (&local_error);
 
 		/* If the message is small or only 1 part, or server doesn't do 4v1 (properly) fetch it in one piece. */
 		if (store->server_level < IMAP_LEVEL_IMAP4REV1
@@ -3311,7 +3309,7 @@ imap_get_message (CamelFolder *folder,
 		    || mi->info.size < IMAP_SMALL_BODY_SIZE
 		    || (!content_info_incomplete(mi->info.content) && !mi->info.content->childs)) {
 			CamelMessageInfoBase *info = (CamelMessageInfoBase *) camel_folder_summary_uid (folder->summary, uid);
-			msg = get_message_simple (imap_folder, uid, NULL, ex);
+			msg = get_message_simple (imap_folder, uid, NULL, &local_error);
 			if (info && !info->preview && msg && camel_folder_summary_get_need_preview(folder->summary)) {
 				if (camel_mime_message_build_preview ((CamelMimePart *)msg, (CamelMessageInfo *)info) && info->preview)
 					camel_folder_summary_add_preview (folder->summary, (CamelMessageInfo *)info);
@@ -3331,15 +3329,16 @@ imap_get_message (CamelFolder *folder,
 				gint i;
 
 				camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-				if (!camel_imap_store_connected(store, ex)) {
+				if (!camel_imap_store_connected(store, NULL)) {
 					camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-					camel_exception_set (
-						ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+					g_set_error (
+						error, CAMEL_SERVICE_ERROR,
+						CAMEL_SERVICE_ERROR_UNAVAILABLE,
 						_("This message is not currently available"));
 					goto fail;
 				}
 
-				response = camel_imap_command (store, folder, ex, "UID FETCH %s BODY", uid);
+				response = camel_imap_command (store, folder, &local_error, "UID FETCH %s BODY", uid);
 				camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
 				if (response) {
@@ -3368,7 +3367,7 @@ imap_get_message (CamelFolder *folder,
 
 					camel_imap_response_free (store, response);
 				} else {
-					camel_exception_clear(ex);
+					g_clear_error (&local_error);
 				}
 			}
 
@@ -3385,9 +3384,9 @@ imap_get_message (CamelFolder *folder,
 			 * let the mailer's "bad MIME" code handle it.
 			 */
 			if (content_info_incomplete (mi->info.content))
-				msg = get_message_simple (imap_folder, uid, NULL, ex);
+				msg = get_message_simple (imap_folder, uid, NULL, &local_error);
 			else
-				msg = get_message (imap_folder, uid, mi->info.content, ex);
+				msg = get_message (imap_folder, uid, mi->info.content, &local_error);
 			if (msg && camel_folder_summary_get_need_preview(folder->summary)) {
 				CamelMessageInfoBase *info = (CamelMessageInfoBase *) camel_folder_summary_uid (folder->summary, uid);
 				if (info && !info->preview) {
@@ -3400,7 +3399,7 @@ imap_get_message (CamelFolder *folder,
 		}
 	} while (msg == NULL
 		 && retry < 2
-		 && camel_exception_get_id(ex) == CAMEL_EXCEPTION_SERVICE_UNAVAILABLE);
+		 && g_error_matches (local_error, CAMEL_SERVICE_ERROR, CAMEL_SERVICE_ERROR_UNAVAILABLE));
 
 done:
 	if (msg) {
@@ -3452,7 +3451,7 @@ fail:
 static gboolean
 imap_sync_message (CamelFolder *folder,
                    const gchar *uid,
-                   CamelException *ex)
+                   GError **error)
 {
 	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
 	CamelImapMessageInfo *mi;
@@ -3460,7 +3459,7 @@ imap_sync_message (CamelFolder *folder,
 	CamelStream *stream = NULL;
 	gboolean success = FALSE;
 
-	mi = imap_folder_summary_uid_or_error(folder->summary, uid, ex);
+	mi = imap_folder_summary_uid_or_error(folder->summary, uid, error);
 	if (!mi)
 	  /* No such UID - is this duplicate work? The sync process selects
 	   * UIDs to start with.
@@ -3479,7 +3478,7 @@ imap_sync_message (CamelFolder *folder,
 		g_object_unref (stream);
 		return TRUE;
 	}
-	msg = imap_get_message(folder, uid, ex);
+	msg = imap_get_message(folder, uid, error);
 	if (msg != NULL) {
 		g_object_unref (msg);
 		success = TRUE;
@@ -3491,7 +3490,7 @@ imap_sync_message (CamelFolder *folder,
 /* FIXME Remove it after confirming
 static void
 imap_cache_message (CamelDiscoFolder *disco_folder, const gchar *uid,
-		    CamelException *ex)
+		    GError **error)
 {
 	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (disco_folder);
 	CamelStream *stream;
@@ -3631,7 +3630,7 @@ add_message_from_data (CamelFolder *folder, GPtrArray *messages,
 
 	msg = camel_mime_message_new ();
 	if (camel_data_wrapper_construct_from_stream (
-		CAMEL_DATA_WRAPPER (msg), stream) == -1) {
+		CAMEL_DATA_WRAPPER (msg), stream, NULL) == -1) {
 		g_object_unref (CAMEL_OBJECT (msg));
 		return;
 	}
@@ -3736,7 +3735,7 @@ static gboolean
 imap_update_summary (CamelFolder *folder,
                      gint exists,
                      CamelFolderChangeInfo *changes,
-                     CamelException *ex)
+                     GError **error)
 {
 	CamelStore *parent_store;
 	CamelImapStore *store;
@@ -3797,7 +3796,7 @@ imap_update_summary (CamelFolder *folder,
 		uidval = 0;
 
 	got = 0;
-	if (!camel_imap_command_start (store, folder, ex,
+	if (!camel_imap_command_start (store, folder, error,
 				       "UID FETCH %d:* (FLAGS RFC822.SIZE INTERNALDATE BODYSTRUCTURE BODY.PEEK[%s])",
 				       uidval + 1, header_spec->str)) {
 		g_string_free (header_spec, TRUE);
@@ -3814,7 +3813,7 @@ imap_update_summary (CamelFolder *folder,
 	fetch_data = g_ptr_array_new ();
 	messages = g_ptr_array_new ();
 	ct = exists - seq;
-	while ((type = camel_imap_command_response (store, &resp, ex)) ==
+	while ((type = camel_imap_command_response (store, &resp, error)) ==
 	       CAMEL_IMAP_RESPONSE_UNTAGGED && !camel_application_is_exiting) {
 		data = parse_fetch_response (imap_folder, resp);
 		g_free (resp);
@@ -3887,7 +3886,7 @@ imap_update_summary (CamelFolder *folder,
 
 		while (uid < needheaders->len && !camel_application_is_exiting) {
 			uidset = imap_uid_array_to_set (folder->summary, needheaders, uid, UID_SET_LIMIT, &uid);
-			if (!camel_imap_command_start (store, folder, ex,
+			if (!camel_imap_command_start (store, folder, error,
 						       "UID FETCH %s BODYSTRUCTURE BODY.PEEK[%s]",
 						       uidset, header_spec->str)) {
 				g_ptr_array_free (needheaders, TRUE);
@@ -3898,7 +3897,7 @@ imap_update_summary (CamelFolder *folder,
 			}
 			g_free (uidset);
 
-			while ((type = camel_imap_command_response (store, &resp, ex))
+			while ((type = camel_imap_command_response (store, &resp, error))
 			       == CAMEL_IMAP_RESPONSE_UNTAGGED && !camel_application_is_exiting) {
 				data = parse_fetch_response (imap_folder, resp);
 				g_free (resp);
@@ -4009,8 +4008,8 @@ imap_update_summary (CamelFolder *folder,
 		mi = messages->pdata[i];
 		if (!mi) {
 			g_warning ("No information for message %d", i + first);
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Incomplete server response: "
 				  "no information provided for message %d"),
 				i + first);
@@ -4019,8 +4018,8 @@ imap_update_summary (CamelFolder *folder,
 		uid = (gchar *)camel_message_info_uid(mi);
 		if (uid[0] == 0) {
 			g_warning("Server provided no uid: message %d", i + first);
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Incomplete server response: "
 				  "no UID provided for message %d"),
 				i + first);
@@ -4036,15 +4035,6 @@ imap_update_summary (CamelFolder *folder,
 /*					break; */
 /*			} */
 
-/*			g_warning("Message already present? %s", camel_message_info_uid(mi)); */
-/*			camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, */
-/*					      _("Unexpected server response: Identical UIDs provided for messages %d and %d"), */
-/*					      seq + 1, i + first); */
-
-/*			camel_message_info_free(&info->info); */
-/*			break; */
-/*		}  */
-
 		((CamelMessageInfoBase *)mi)->dirty = TRUE;
 		if (((CamelMessageInfoBase *)mi)->summary)
 			camel_folder_summary_touch (((CamelMessageInfoBase *)mi)->summary);
@@ -4097,7 +4087,7 @@ imap_update_summary (CamelFolder *folder,
 /* Called with the store's connect_lock locked */
 gboolean
 camel_imap_folder_changed (CamelFolder *folder, gint exists,
-			   GArray *expunged, CamelException *ex)
+			   GArray *expunged, GError **error)
 {
 	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
 	CamelFolderChangeInfo *changes;
@@ -4132,16 +4122,16 @@ camel_imap_folder_changed (CamelFolder *folder, gint exists,
 		/* Delete all in one transaction */
 		full_name = camel_folder_get_full_name (folder);
 		parent_store = camel_folder_get_parent_store (folder);
-		camel_db_delete_uids (parent_store->cdb_w, full_name, deleted, ex);
+		camel_db_delete_uids (parent_store->cdb_w, full_name, deleted, NULL);
 		g_slist_foreach (deleted, (GFunc) g_free, NULL);
 		g_slist_free (deleted);
 	}
 
 	len = camel_folder_summary_count (folder->summary);
 	if (exists > len && !camel_application_is_exiting)
-		success = imap_update_summary (folder, exists, changes, ex);
+		success = imap_update_summary (folder, exists, changes, error);
 
-	camel_folder_summary_save_to_db (folder->summary, ex);
+	camel_folder_summary_save_to_db (folder->summary, NULL);
 	if (camel_folder_change_info_changed (changes))
 		camel_folder_changed (folder, changes);
 
@@ -4161,18 +4151,15 @@ imap_thaw (CamelFolder *folder)
 
 	imap_folder = CAMEL_IMAP_FOLDER (folder);
 	if (imap_folder->need_refresh) {
-		CamelException ex = CAMEL_EXCEPTION_INITIALISER;
-
 		imap_folder->need_refresh = FALSE;
-		imap_refresh_info (folder, &ex);
-		camel_exception_clear (&ex);
+		imap_refresh_info (folder, NULL);
 	}
 }
 
 CamelStream *
 camel_imap_folder_fetch_data (CamelImapFolder *imap_folder, const gchar *uid,
 			      const gchar *section_text, gboolean cache_only,
-			      CamelException *ex)
+			      GError **error)
 {
 	CamelFolder *folder = CAMEL_FOLDER (imap_folder);
 	CamelStore *parent_store;
@@ -4197,38 +4184,35 @@ camel_imap_folder_fetch_data (CamelImapFolder *imap_folder, const gchar *uid,
 	 * an inefficiency, and bad luck.
 	 */
 	CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock);
-	stream = camel_imap_message_cache_get (imap_folder->cache, uid, section_text, ex);
+	stream = camel_imap_message_cache_get (imap_folder->cache, uid, section_text, NULL);
 	if (!stream && (!strcmp (section_text, "HEADER") || !strcmp (section_text, "0"))) {
-		camel_exception_clear (ex);
-		stream = camel_imap_message_cache_get (imap_folder->cache, uid, "", ex);
+		stream = camel_imap_message_cache_get (imap_folder->cache, uid, "", NULL);
 	}
 	CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
 
 	if (stream || cache_only)
 		return stream;
 
-	camel_exception_clear(ex);
-
 	camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 	CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock);
 
-	if (!camel_imap_store_connected(store, ex)) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+	if (!camel_imap_store_connected (store, NULL)) {
+		g_set_error (
+			error, CAMEL_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
 			_("This message is not currently available"));
 		CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
 		camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 		return NULL;
 	}
 
-	camel_exception_clear (ex);
 	if (store->server_level < IMAP_LEVEL_IMAP4REV1 && !*section_text) {
 		response = camel_imap_command (
-			store, folder, ex,
+			store, folder, error,
 			"UID FETCH %s RFC822.PEEK", uid);
 	} else {
 		response = camel_imap_command (
-			store, folder, ex,
+			store, folder, error,
 			"UID FETCH %s BODY.PEEK[%s]", uid,
 			section_text);
 	}
@@ -4253,8 +4237,9 @@ camel_imap_folder_fetch_data (CamelImapFolder *imap_folder, const gchar *uid,
 	camel_imap_response_free (store, response);
 	CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
 	if (!stream) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+		g_set_error (
+			error, CAMEL_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
 			_("Could not find message body in FETCH response."));
 	} else {
 		g_object_ref (CAMEL_OBJECT (stream));
@@ -4516,7 +4501,7 @@ done:
 static GPtrArray *
 imap_get_uncached_uids (CamelFolder *folder,
                         GPtrArray *uids,
-                        CamelException *ex)
+                        GError **error)
 {
 	GPtrArray *result;
 	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
@@ -4524,7 +4509,7 @@ imap_get_uncached_uids (CamelFolder *folder,
 	CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock);
 
 	result = camel_imap_message_cache_filter_cached (
-		imap_folder->cache, uids, ex);
+		imap_folder->cache, uids, error);
 
 	CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
 
diff --git a/camel/providers/imap/camel-imap-folder.h b/camel/providers/imap/camel-imap-folder.h
index 423e2be..25b1b6f 100644
--- a/camel/providers/imap/camel-imap-folder.h
+++ b/camel/providers/imap/camel-imap-folder.h
@@ -79,7 +79,7 @@ GType		camel_imap_folder_get_type	(void);
 CamelFolder *	camel_imap_folder_new		(CamelStore *parent,
 						 const gchar *folder_name,
 						 const gchar *folder_dir,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_imap_folder_get_check_folder
 						(CamelImapFolder *imap_folder);
 void		camel_imap_folder_set_check_folder
@@ -87,35 +87,34 @@ void		camel_imap_folder_set_check_folder
 						 gboolean check_folder);
 gboolean	camel_imap_folder_selected	(CamelFolder *folder,
 						 CamelImapResponse *response,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_imap_folder_changed	(CamelFolder *folder,
 						 gint exists,
 						 GArray *expunged,
-						 CamelException *ex);
+						 GError **error);
 CamelStream *	camel_imap_folder_fetch_data	(CamelImapFolder *imap_folder,
 						 const gchar *uid,
 						 const gchar *section_text,
 						 gboolean cache_only,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_imap_append_resyncing	(CamelFolder *folder,
 						 CamelMimeMessage *message,
 						 const CamelMessageInfo *info,
 						 gchar **appended_uid,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_imap_transfer_resyncing	(CamelFolder *source,
 						 GPtrArray *uids,
 						 CamelFolder *dest,
 						 GPtrArray **transferred_uids,
 						 gboolean delete_originals,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_imap_expunge_uids_resyncing
 						(CamelFolder *folder,
 						 GPtrArray *uids,
-						 CamelException *ex);
-
-void		camel_imap_expunge_uids_only	(CamelFolder *folder,
+						 GError **error);
+gboolean	camel_imap_expunge_uids_only	(CamelFolder *folder,
 						 GPtrArray *uids,
-						 CamelException *ex);
+						 GError **error);
 
 G_END_DECLS
 
diff --git a/camel/providers/imap/camel-imap-journal.c b/camel/providers/imap/camel-imap-journal.c
index 3421098..e939596 100644
--- a/camel/providers/imap/camel-imap-journal.c
+++ b/camel/providers/imap/camel-imap-journal.c
@@ -44,7 +44,7 @@
 static void imap_entry_free (CamelOfflineJournal *journal, CamelDListNode *entry);
 static CamelDListNode *imap_entry_load (CamelOfflineJournal *journal, FILE *in);
 static gint imap_entry_write (CamelOfflineJournal *journal, CamelDListNode *entry, FILE *out);
-static gint imap_entry_play (CamelOfflineJournal *journal, CamelDListNode *entry, CamelException *ex);
+static gint imap_entry_play (CamelOfflineJournal *journal, CamelDListNode *entry, GError **error);
 static void unref_folder (gpointer key, gpointer value, gpointer data);
 static void free_uids (GPtrArray *array);
 static void close_folder (gpointer name, gpointer folder, gpointer data);
@@ -286,19 +286,18 @@ journal_decode_folder (CamelIMAPJournal *journal, const gchar *name)
 	}
 	if (!folder) {
 		CamelStore *parent_store;
-		CamelException ex;
 		gchar *msg;
+		GError *local_error = NULL;
 
-		camel_exception_init (&ex);
 		parent_store = camel_folder_get_parent_store (
 			CAMEL_OFFLINE_JOURNAL (journal)->folder);
-		folder = camel_store_get_folder (parent_store, name, 0, &ex);
+		folder = camel_store_get_folder (parent_store, name, 0, &local_error);
 		if (folder)
 			g_hash_table_insert (journal->folders, (gchar *) name, folder);
 		else {
 			msg = g_strdup_printf (_("Could not open '%s':\n%s\nChanges made to this folder will not be resynchronized."),
-					       name, camel_exception_get_description (&ex));
-			camel_exception_clear (&ex);
+					       name, local_error->message);
+			g_clear_error (&local_error);
 			camel_session_alert_user (
 				camel_service_get_session (CAMEL_SERVICE (parent_store)),
 				CAMEL_SESSION_ALERT_WARNING,
@@ -311,7 +310,7 @@ journal_decode_folder (CamelIMAPJournal *journal, const gchar *name)
 }
 
 static gint
-imap_entry_play (CamelOfflineJournal *journal, CamelDListNode *entry, CamelException *ex)
+imap_entry_play (CamelOfflineJournal *journal, CamelDListNode *entry, GError **error)
 {
 	CamelIMAPJournalEntry *imap_entry = (CamelIMAPJournalEntry *) entry;
 
@@ -320,7 +319,7 @@ imap_entry_play (CamelOfflineJournal *journal, CamelDListNode *entry, CamelExcep
 	switch (imap_entry->type) {
 	case CAMEL_IMAP_JOURNAL_ENTRY_EXPUNGE:
 		camel_imap_expunge_uids_resyncing (
-			journal->folder, imap_entry->uids, ex);
+			journal->folder, imap_entry->uids, NULL);
 		return 0;
 	case CAMEL_IMAP_JOURNAL_ENTRY_APPEND:
 	{
@@ -328,13 +327,13 @@ imap_entry_play (CamelOfflineJournal *journal, CamelDListNode *entry, CamelExcep
 		CamelMimeMessage *message;
 		CamelMessageInfo *info;
 
-		message = camel_folder_get_message (journal->folder, imap_entry->append_uid, NULL);
+		message = camel_folder_get_message (journal->folder, imap_entry->append_uid, error);
 		if (!message)
 			return -1;
 
 		info = camel_folder_get_message_info (journal->folder, imap_entry->append_uid);
 		camel_imap_append_resyncing (
-			journal->folder, message, info, &ret_uid, ex);
+			journal->folder, message, info, &ret_uid, NULL);
 		camel_folder_free_message_info (journal->folder, info);
 
 		if (ret_uid) {
@@ -356,10 +355,9 @@ imap_entry_play (CamelOfflineJournal *journal, CamelDListNode *entry, CamelExcep
 			return -1;
 		}
 
-		camel_exception_clear (ex);
 		if (!camel_imap_transfer_resyncing (
 			journal->folder, imap_entry->uids, destination,
-			&ret_uids, imap_entry->move, ex))
+			&ret_uids, imap_entry->move, error))
 			return -1;
 
 		if (ret_uids) {
diff --git a/camel/providers/imap/camel-imap-message-cache.c b/camel/providers/imap/camel-imap-message-cache.c
index 517fad6..e881252 100644
--- a/camel/providers/imap/camel-imap-message-cache.c
+++ b/camel/providers/imap/camel-imap-message-cache.c
@@ -168,7 +168,7 @@ cache_put (CamelImapMessageCache *cache, const gchar *uid, const gchar *key,
  * camel_imap_message_cache_new:
  * @path: directory to use for storage
  * @summary: CamelFolderSummary for the folder we are caching
- * @ex: a CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Returns: a new CamelImapMessageCache object using @path for
  * storage. If cache files already exist in @path, then any that do not
@@ -179,23 +179,18 @@ cache_put (CamelImapMessageCache *cache, const gchar *uid, const gchar *key,
 CamelImapMessageCache *
 camel_imap_message_cache_new (const gchar *path,
                               CamelFolderSummary *summary,
-                              CamelException *ex)
+                              GError **error)
 {
 	CamelImapMessageCache *cache;
 	GDir *dir;
 	const gchar *dname;
 	gchar *uid, *p;
 	GPtrArray *deletes;
-	GError *error = NULL;
 	GHashTable *shash;
 
-	dir = g_dir_open (path, 0, &error);
+	dir = g_dir_open (path, 0, error);
 	if (!dir) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Could not open cache directory: %s"),
-			error->message);
-		g_error_free (error);
+		g_prefix_error (error, _("Could not open cache directory: "));
 		return NULL;
 	}
 
@@ -240,27 +235,22 @@ camel_imap_message_cache_new (const gchar *path,
 /**
  * camel_imap_message_cache_delete:
  * @path: directory to use for storage
- * @ex: a CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * All the files under this directory would be deleted
  **/
 
 gboolean
 camel_imap_message_cache_delete (const gchar *path,
-                                 CamelException *ex)
+                                 GError **error)
 {
 	GDir *dir;
 	const gchar *dname;
-	GError *error = NULL;
 	GPtrArray *deletes;
 
-	dir = g_dir_open (path, 0, &error);
+	dir = g_dir_open (path, 0, error);
 	if (!dir) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Could not open cache directory: %s"),
-			error->message);
-		g_error_free (error);
+		g_prefix_error (error, _("Could not open cache directory: "));
 		return FALSE;
 	}
 
@@ -308,7 +298,7 @@ camel_imap_message_cache_set_path (CamelImapMessageCache *cache, const gchar *pa
 
 static CamelStream *
 insert_setup (CamelImapMessageCache *cache, const gchar *uid, const gchar *part_spec,
-	      gchar **path, gchar **key, CamelException *ex)
+	      gchar **path, gchar **key, GError **error)
 {
 	CamelStream *stream;
 	gint fd;
@@ -330,8 +320,9 @@ insert_setup (CamelImapMessageCache *cache, const gchar *uid, const gchar *part_
 
 	fd = g_open (*path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0600);
 	if (fd == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Failed to cache message %s: %s"),
 			uid, g_strerror (errno));
 		g_free (*path);
@@ -357,8 +348,8 @@ insert_finish (CamelImapMessageCache *cache,
                gchar *key,
                CamelStream *stream)
 {
-	camel_stream_flush (stream);
-	camel_stream_reset (stream);
+	camel_stream_flush (stream, NULL);
+	camel_stream_reset (stream, NULL);
 	cache_put (cache, uid, key, stream);
 	g_free (path);
 
@@ -384,20 +375,17 @@ camel_imap_message_cache_insert (CamelImapMessageCache *cache,
                                  const gchar *part_spec,
                                  const gchar *data,
                                  gint len,
-                                 CamelException *ex)
+                                 GError **error)
 {
 	gchar *path, *key;
 	CamelStream *stream;
 
-	stream = insert_setup (cache, uid, part_spec, &path, &key, ex);
+	stream = insert_setup (cache, uid, part_spec, &path, &key, error);
 	if (!stream)
 		return NULL;
 
-	if (camel_stream_write (stream, data, len) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Failed to cache message %s: %s"),
-			uid, g_strerror (errno));
+	if (camel_stream_write (stream, data, len, error) == -1) {
+		g_prefix_error (error, _("Failed to cache message %s: "), uid);
 		return insert_abort (path, stream);
 	}
 
@@ -417,21 +405,16 @@ void
 camel_imap_message_cache_insert_stream (CamelImapMessageCache *cache,
                                         const gchar *uid,
                                         const gchar *part_spec,
-                                        CamelStream *data_stream,
-                                        CamelException *ex)
+                                        CamelStream *data_stream)
 {
 	gchar *path, *key;
 	CamelStream *stream;
 
-	stream = insert_setup (cache, uid, part_spec, &path, &key, ex);
+	stream = insert_setup (cache, uid, part_spec, &path, &key, NULL);
 	if (!stream)
 		return;
 
-	if (camel_stream_write_to_stream (data_stream, stream) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Failed to cache message %s: %s"),
-			uid, g_strerror (errno));
+	if (camel_stream_write_to_stream (data_stream, stream, NULL) == -1) {
 		insert_abort (path, stream);
 	} else {
 		insert_finish (cache, uid, path, key, stream);
@@ -452,21 +435,16 @@ void
 camel_imap_message_cache_insert_wrapper (CamelImapMessageCache *cache,
                                          const gchar *uid,
                                          const gchar *part_spec,
-                                         CamelDataWrapper *wrapper,
-                                         CamelException *ex)
+                                         CamelDataWrapper *wrapper)
 {
 	gchar *path, *key;
 	CamelStream *stream;
 
-	stream = insert_setup (cache, uid, part_spec, &path, &key, ex);
+	stream = insert_setup (cache, uid, part_spec, &path, &key, NULL);
 	if (!stream)
 		return;
 
-	if (camel_data_wrapper_write_to_stream (wrapper, stream) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Failed to cache message %s: %s"),
-			uid, g_strerror (errno));
+	if (camel_data_wrapper_write_to_stream (wrapper, stream, NULL) == -1) {
 		insert_abort (path, stream);
 	} else {
 		insert_finish (cache, uid, path, key, stream);
@@ -479,7 +457,7 @@ camel_imap_message_cache_insert_wrapper (CamelImapMessageCache *cache,
  * @cache: the cache
  * @uid: the UID of the data to get
  * @part_spec: the part_spec of the data to get
- * @ex: exception
+ * @error: return location for a #GError, or %NULL
  *
  * Returns: the filename of a cache item
  **/
@@ -487,7 +465,7 @@ gchar *
 camel_imap_message_cache_get_filename (CamelImapMessageCache *cache,
 				       const gchar *uid,
 				       const gchar *part_spec,
-				       CamelException *ex)
+				       GError **error)
 {
 	gchar *path;
 
@@ -509,14 +487,14 @@ camel_imap_message_cache_get_filename (CamelImapMessageCache *cache,
  * @cache: the cache
  * @uid: the UID of the data to get
  * @part_spec: the part_spec of the data to get
- * @ex: exception
+ * @error: return location for a #GError, or %NULL
  *
  * Returns: a CamelStream containing the cached data (which the
  * caller must unref), or %NULL if that data is not cached.
  **/
 CamelStream *
 camel_imap_message_cache_get (CamelImapMessageCache *cache, const gchar *uid,
-			      const gchar *part_spec, CamelException *ex)
+			      const gchar *part_spec, GError **error)
 {
 	CamelStream *stream;
 	gchar *path, *key;
@@ -534,20 +512,17 @@ camel_imap_message_cache_get (CamelImapMessageCache *cache, const gchar *uid,
 
 	stream = g_hash_table_lookup (cache->parts, key);
 	if (stream) {
-		camel_stream_reset (CAMEL_STREAM (stream));
+		camel_stream_reset (CAMEL_STREAM (stream), NULL);
 		g_object_ref (stream);
 		g_free (path);
 		return stream;
 	}
 
-	stream = camel_stream_fs_new_with_name (path, O_RDONLY, 0);
+	stream = camel_stream_fs_new_with_name (path, O_RDONLY, 0, error);
 	if (stream)
 		cache_put (cache, uid, key, stream);
 	else
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Failed to cache %s: %s"),
-			part_spec, g_strerror (errno));
+		g_prefix_error (error, _("Failed to cache %s: "), part_spec);
 
 	g_free (path);
 
@@ -633,8 +608,7 @@ void
 camel_imap_message_cache_copy (CamelImapMessageCache *source,
 			       const gchar *source_uid,
 			       CamelImapMessageCache *dest,
-			       const gchar *dest_uid,
-			       CamelException *ex)
+			       const gchar *dest_uid)
 {
 	GPtrArray *subparts;
 	CamelStream *stream;
@@ -650,9 +624,9 @@ camel_imap_message_cache_copy (CamelImapMessageCache *source,
 		if (!part++)
 			continue;
 
-		if ((stream = camel_imap_message_cache_get (source, source_uid, part, ex))) {
-			camel_imap_message_cache_insert_stream (dest, dest_uid, part, stream, ex);
-			g_object_unref (CAMEL_OBJECT (stream));
+		if ((stream = camel_imap_message_cache_get (source, source_uid, part, NULL))) {
+			camel_imap_message_cache_insert_stream (dest, dest_uid, part, stream);
+			g_object_unref (stream);
 		}
 	}
 }
@@ -687,7 +661,7 @@ _match_part(gpointer part_name, gpointer user_data)
  * needed.
  */
 GPtrArray *
-camel_imap_message_cache_filter_cached(CamelImapMessageCache *cache, GPtrArray *uids, CamelException *ex)
+camel_imap_message_cache_filter_cached(CamelImapMessageCache *cache, GPtrArray *uids, GError **error)
 {
 	GPtrArray *result, *parts_list;
 	gint i;
diff --git a/camel/providers/imap/camel-imap-message-cache.h b/camel/providers/imap/camel-imap-message-cache.h
index 640c388..9258305 100644
--- a/camel/providers/imap/camel-imap-message-cache.h
+++ b/camel/providers/imap/camel-imap-message-cache.h
@@ -73,7 +73,7 @@ struct _CamelImapMessageCacheClass {
 /* public methods */
 CamelImapMessageCache *camel_imap_message_cache_new (const gchar *path,
 						     CamelFolderSummary *summary,
-						     CamelException *ex);
+						     GError **error);
 
 void camel_imap_message_cache_set_path (CamelImapMessageCache *cache,
 					const gchar *path);
@@ -85,27 +85,25 @@ CamelStream *camel_imap_message_cache_insert (CamelImapMessageCache *cache,
 					      const gchar *part_spec,
 					      const gchar *data,
 					      gint len,
-					      CamelException *ex);
+					      GError **error);
 void camel_imap_message_cache_insert_stream  (CamelImapMessageCache *cache,
 					      const gchar *uid,
 					      const gchar *part_spec,
-					      CamelStream *data_stream,
-					      CamelException *ex);
+					      CamelStream *data_stream);
 void camel_imap_message_cache_insert_wrapper (CamelImapMessageCache *cache,
 					      const gchar *uid,
 					      const gchar *part_spec,
-					      CamelDataWrapper *wrapper,
-					      CamelException *ex);
+					      CamelDataWrapper *wrapper);
 
 CamelStream *camel_imap_message_cache_get    (CamelImapMessageCache *cache,
 					      const gchar *uid,
 					      const gchar *part_spec,
-					      CamelException *ex);
+					      GError **error);
 
 gchar *       camel_imap_message_cache_get_filename (CamelImapMessageCache *cache,
 					      const gchar *uid,
 					      const gchar *part_spec,
-					      CamelException *ex);
+					      GError **error);
 
 void         camel_imap_message_cache_remove (CamelImapMessageCache *cache,
 					      const gchar *uid);
@@ -115,13 +113,12 @@ void         camel_imap_message_cache_clear  (CamelImapMessageCache *cache);
 void         camel_imap_message_cache_copy   (CamelImapMessageCache *source,
 					      const gchar *source_uid,
 					      CamelImapMessageCache *dest,
-					      const gchar *dest_uid,
-					      CamelException *ex);
+					      const gchar *dest_uid);
 gboolean     camel_imap_message_cache_delete (const gchar *path,
-					      CamelException *ex);
+					      GError **error);
 GPtrArray *  camel_imap_message_cache_filter_cached(CamelImapMessageCache *,
                                               GPtrArray *uids,
-                                              CamelException *ex);
+                                              GError **error);
 
 GType camel_imap_message_cache_get_type (void);
 
diff --git a/camel/providers/imap/camel-imap-search.c b/camel/providers/imap/camel-imap-search.c
index b64b4c0..f6b4af5 100644
--- a/camel/providers/imap/camel-imap-search.c
+++ b/camel/providers/imap/camel-imap-search.c
@@ -243,10 +243,10 @@ save_match(CamelImapSearch *is, struct _match_record *mr)
 	header.lastuid = mr->lastuid;
 	header.validity = mr->validity;
 
-	if (camel_stream_write(stream, (gchar *)&header, sizeof(header)) != sizeof(header)
-	    || camel_stream_write(stream, mr->matches->data, mr->matches->len*sizeof(guint32)) != mr->matches->len*sizeof(guint32)
-	    || camel_seekable_stream_seek((CamelSeekableStream *)stream, 0, CAMEL_STREAM_SET) == -1
-	    || camel_stream_write(stream, (gchar *)&mark, sizeof(mark)) != sizeof(mark)) {
+	if (camel_stream_write(stream, (gchar *)&header, sizeof(header), NULL) != sizeof(header)
+	    || camel_stream_write(stream, mr->matches->data, mr->matches->len*sizeof(guint32), NULL) != mr->matches->len*sizeof(guint32)
+	    || camel_seekable_stream_seek((CamelSeekableStream *)stream, 0, CAMEL_STREAM_SET, NULL) == -1
+	    || camel_stream_write(stream, (gchar *)&mark, sizeof(mark), NULL) != sizeof(mark)) {
 		d(printf(" saving failed, removing cache entry\n"));
 		camel_data_cache_remove(is->cache, "search/body-contains", mr->hash, NULL);
 		ret = -1;
@@ -287,13 +287,13 @@ load_match(CamelImapSearch *is, gchar hash[17], gint argc, struct _ESExpResult *
 		   should be sufficient to key it */
 		/* This check should also handle endianness changes, we just throw away
 		   the data (its only a cache) */
-		if (camel_stream_read(stream, (gchar *)&header, sizeof(header)) == sizeof(header)
+		if (camel_stream_read(stream, (gchar *)&header, sizeof(header), NULL) == sizeof(header)
 		    && header.validity == is->validity
 		    && header.mark == MATCH_MARK
 		    && header.termcount == 0) {
 			d(printf(" found %d matches\n", header.matchcount));
 			g_array_set_size(mr->matches, header.matchcount);
-			camel_stream_read(stream, mr->matches->data, sizeof(guint32)*header.matchcount);
+			camel_stream_read(stream, mr->matches->data, sizeof(guint32)*header.matchcount, NULL);
 		} else {
 			d(printf(" file format invalid/validity changed\n"));
 			memset(&header, 0, sizeof(header));
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index cbc3a24..bd5bc8f 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -68,40 +68,40 @@ static gchar imap_tag_prefix = 'A';
 
 static gboolean construct (CamelService *service, CamelSession *session,
 		       CamelProvider *provider, CamelURL *url,
-		       CamelException *ex);
+		       GError **error);
 
 static gchar *imap_get_name (CamelService *service, gboolean brief);
 
-static gboolean imap_noop (CamelStore *store, CamelException *ex);
-static CamelFolder *imap_get_junk(CamelStore *store, CamelException *ex);
-static CamelFolder *imap_get_trash(CamelStore *store, CamelException *ex);
-static GList *query_auth_types (CamelService *service, CamelException *ex);
+static gboolean imap_noop (CamelStore *store, GError **error);
+static CamelFolder *imap_get_junk(CamelStore *store, GError **error);
+static CamelFolder *imap_get_trash(CamelStore *store, GError **error);
+static GList *query_auth_types (CamelService *service, GError **error);
 static guint hash_folder_name (gconstpointer key);
 static gint compare_folder_name (gconstpointer a, gconstpointer b);
 
-static CamelFolderInfo *create_folder (CamelStore *store, const gchar *parent_name, const gchar *folder_name, CamelException *ex);
-static gboolean delete_folder (CamelStore *store, const gchar *folder_name, CamelException *ex);
-static gboolean rename_folder (CamelStore *store, const gchar *old_name, const gchar *new_name, CamelException *ex);
+static CamelFolderInfo *create_folder (CamelStore *store, const gchar *parent_name, const gchar *folder_name, GError **error);
+static gboolean delete_folder (CamelStore *store, const gchar *folder_name, GError **error);
+static gboolean rename_folder (CamelStore *store, const gchar *old_name, const gchar *new_name, GError **error);
 static gboolean folder_is_subscribed (CamelStore *store, const gchar *folder_name);
 static gboolean subscribe_folder (CamelStore *store, const gchar *folder_name,
-			      CamelException *ex);
+			      GError **error);
 static gboolean unsubscribe_folder (CamelStore *store, const gchar *folder_name,
-				CamelException *ex);
+				GError **error);
 
-static gboolean get_folders_sync(CamelImapStore *imap_store, const gchar *pattern, CamelException *ex);
+static gboolean get_folders_sync(CamelImapStore *imap_store, const gchar *pattern, GError **error);
 
-static gboolean imap_folder_effectively_unsubscribed(CamelImapStore *imap_store, const gchar *folder_name, CamelException *ex);
-static gboolean imap_check_folder_still_extant (CamelImapStore *imap_store, const gchar *full_name,  CamelException *ex);
-static void imap_forget_folder(CamelImapStore *imap_store, const gchar *folder_name, CamelException *ex);
+static gboolean imap_folder_effectively_unsubscribed(CamelImapStore *imap_store, const gchar *folder_name, GError **error);
+static gboolean imap_check_folder_still_extant (CamelImapStore *imap_store, const gchar *full_name,  GError **error);
+static void imap_forget_folder(CamelImapStore *imap_store, const gchar *folder_name, GError **error);
 static void imap_set_server_level (CamelImapStore *store);
 
-static gboolean imap_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, CamelException *ex);
-static gboolean imap_connect (CamelService *service, CamelException *ex);
-static gboolean imap_disconnect (CamelService *service, gboolean clean, CamelException *ex);
-static CamelFolder * get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, CamelException *ex);
-static CamelFolderInfo * get_folder_info (CamelStore *store, const gchar *top, guint32 flags, CamelException *ex);
-static CamelFolder * get_folder_offline (CamelStore *store, const gchar *folder_name, guint32 flags, CamelException *ex);
-static CamelFolderInfo * get_folder_info_offline (CamelStore *store, const gchar *top, guint32 flags, CamelException *ex);
+static gboolean imap_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, GError **error);
+static gboolean imap_connect (CamelService *service, GError **error);
+static gboolean imap_disconnect (CamelService *service, gboolean clean, GError **error);
+static CamelFolder * get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, GError **error);
+static CamelFolderInfo * get_folder_info (CamelStore *store, const gchar *top, guint32 flags, GError **error);
+static CamelFolder * get_folder_offline (CamelStore *store, const gchar *folder_name, guint32 flags, GError **error);
+static CamelFolderInfo * get_folder_info_offline (CamelStore *store, const gchar *top, guint32 flags, GError **error);
 
 G_DEFINE_TYPE (CamelImapStore, camel_imap_store, CAMEL_TYPE_OFFLINE_STORE)
 
@@ -204,7 +204,7 @@ camel_imap_store_init (CamelImapStore *imap_store)
 static gboolean
 construct (CamelService *service, CamelSession *session,
 	   CamelProvider *provider, CamelURL *url,
-	   CamelException *ex)
+	   GError **error)
 {
 	CamelServiceClass *service_class;
 	CamelImapStore *imap_store = CAMEL_IMAP_STORE (service);
@@ -214,10 +214,10 @@ construct (CamelService *service, CamelSession *session,
 
 	/* Chain up to parent's construct() method. */
 	service_class = CAMEL_SERVICE_CLASS (camel_imap_store_parent_class);
-	if (!service_class->construct (service, session, provider, url, ex))
+	if (!service_class->construct (service, session, provider, url, error))
 		return FALSE;
 
-	imap_store->storage_path = camel_session_get_storage_path (session, service, ex);
+	imap_store->storage_path = camel_session_get_storage_path (session, service, error);
 	if (!imap_store->storage_path)
 		return FALSE;
 
@@ -366,7 +366,7 @@ parse_capability(CamelImapStore *store, gchar *capa)
 }
 
 static gboolean
-imap_get_capability (CamelService *service, CamelException *ex)
+imap_get_capability (CamelService *service, GError **error)
 {
 	CamelImapStore *store = CAMEL_IMAP_STORE (service);
 	CamelImapResponse *response;
@@ -376,10 +376,10 @@ imap_get_capability (CamelService *service, CamelException *ex)
 	/* We assume we have utf8 capable search until a failed search tells us otherwise */
 	store->capabilities = IMAP_CAPABILITY_utf8_search;
 	store->authtypes = g_hash_table_new (g_str_hash, g_str_equal);
-	response = camel_imap_command (store, NULL, ex, "CAPABILITY");
+	response = camel_imap_command (store, NULL, error, "CAPABILITY");
 	if (!response)
 		return FALSE;
-	result = camel_imap_response_extract (store, response, "CAPABILITY ", ex);
+	result = camel_imap_response_extract (store, response, "CAPABILITY ", error);
 	if (!result)
 		return FALSE;
 
@@ -420,7 +420,7 @@ enum {
 #endif
 
 static gboolean
-connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, CamelException *ex)
+connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, GError **error)
 {
 	CamelImapStore *store = (CamelImapStore *) service;
 	CamelSession *session;
@@ -440,8 +440,9 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 		else
 			tcp_stream = camel_tcp_stream_ssl_new (service->session, service->url->host, SSL_PORT_FLAGS);
 #else
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
 			_("Could not connect to %s: %s"),
 			service->url->host, _("SSL unavailable"));
 
@@ -459,16 +460,10 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 		g_free (socks_host);
 	}
 
-	if (camel_tcp_stream_connect ((CamelTcpStream *) tcp_stream, ai) == -1) {
-		if (errno == EINTR)
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_USER_CANCEL,
-				_("Connection cancelled"));
-		else
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-				_("Could not connect to %s: %s"),
-				service->url->host, g_strerror (errno));
+	if (camel_tcp_stream_connect ((CamelTcpStream *) tcp_stream, ai, error) == -1) {
+		g_prefix_error (
+			error, _("Could not connect to %s: "),
+			service->url->host);
 		g_object_unref (tcp_stream);
 		return FALSE;
 	}
@@ -491,7 +486,7 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 	camel_tcp_stream_setsockopt((CamelTcpStream *)tcp_stream, &sockopt);
 
 	/* Read the greeting, if any, and deal with PREAUTH */
-	if (camel_imap_store_readline (store, &buf, ex) < 0) {
+	if (camel_imap_store_readline (store, &buf, error) < 0) {
 		if (store->istream) {
 			g_object_unref (store->istream);
 			store->istream = NULL;
@@ -541,7 +536,7 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 	g_free (buf);
 
 	/* get the imap server capabilities */
-	if (!imap_get_capability (service, ex)) {
+	if (!imap_get_capability (service, error)) {
 		if (store->istream) {
 			g_object_unref (store->istream);
 			store->istream = NULL;
@@ -571,15 +566,15 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 	clean_quit = FALSE;
 
 	if (!(store->capabilities & IMAP_CAPABILITY_STARTTLS)) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Failed to connect to IMAP server %s in secure mode: %s"),
 			service->url->host, _("STARTTLS not supported"));
 
 		goto exception;
 	}
 
-	response = camel_imap_command (store, NULL, ex, "STARTTLS");
+	response = camel_imap_command (store, NULL, error, "STARTTLS");
 	if (!response) {
 		g_object_unref (store->istream);
 		g_object_unref (store->ostream);
@@ -591,15 +586,15 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 
 	/* Okay, now toggle SSL/TLS mode */
 	if (camel_tcp_stream_ssl_enable_ssl (CAMEL_TCP_STREAM_SSL (tcp_stream)) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Failed to connect to IMAP server %s in secure mode: %s"),
 			service->url->host, _("SSL negotiations failed"));
 		goto exception;
 	}
 #else
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 		_("Failed to connect to IMAP server %s in secure mode: %s"),
 		service->url->host, _("SSL is not available in this build"));
 	goto exception;
@@ -607,7 +602,7 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 
 	/* rfc2595, section 4 states that after a successful STLS
            command, the client MUST discard prior CAPA responses */
-	if (!imap_get_capability (service, ex)) {
+	if (!imap_get_capability (service, error)) {
 		if (store->istream) {
 			g_object_unref (store->istream);
 			store->istream = NULL;
@@ -625,8 +620,8 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 
 	if (store->capabilities & IMAP_CAPABILITY_LOGINDISABLED ) {
 		clean_quit = TRUE;
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Failed to connect to IMAP server %s in secure mode: %s"),
 			service->url->host, _("Unknown error"));
 		goto exception;
@@ -638,7 +633,7 @@ exception:
 
 	if (clean_quit && store->connected) {
 		/* try to disconnect cleanly */
-		response = camel_imap_command (store, NULL, ex, "LOGOUT");
+		response = camel_imap_command (store, NULL, error, "LOGOUT");
 		if (response)
 			camel_imap_response_free_without_processing (store, response);
 	}
@@ -663,7 +658,7 @@ exception:
 /* Using custom commands to connect to IMAP servers is not supported on Win32 */
 
 static gboolean
-connect_to_server_process (CamelService *service, const gchar *cmd, CamelException *ex)
+connect_to_server_process (CamelService *service, const gchar *cmd, GError **error)
 {
 	CamelImapStore *store = (CamelImapStore *) service;
 	CamelStream *cmd_stream;
@@ -746,12 +741,14 @@ connect_to_server_process (CamelService *service, const gchar *cmd, CamelExcepti
 
 	if (ret == -1) {
 		if (errno == EINTR)
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_USER_CANCEL,
+			g_set_error (
+				error, G_IO_ERROR,
+				G_IO_ERROR_CANCELLED,
 				_("Connection cancelled"));
 		else
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Could not connect with command \"%s\": %s"),
 				full_cmd, g_strerror (errno));
 
@@ -769,7 +766,7 @@ connect_to_server_process (CamelService *service, const gchar *cmd, CamelExcepti
 	store->command = 0;
 
 	/* Read the greeting, if any, and deal with PREAUTH */
-	if (camel_imap_store_readline (store, &buf, ex) < 0) {
+	if (camel_imap_store_readline (store, &buf, error) < 0) {
 		if (store->istream) {
 			g_object_unref (store->istream);
 			store->istream = NULL;
@@ -789,7 +786,7 @@ connect_to_server_process (CamelService *service, const gchar *cmd, CamelExcepti
 	g_free (buf);
 
 	/* get the imap server capabilities */
-	if (!imap_get_capability (service, ex)) {
+	if (!imap_get_capability (service, error)) {
 		if (store->istream) {
 			g_object_unref (store->istream);
 			store->istream = NULL;
@@ -824,20 +821,21 @@ static struct {
 };
 
 static gboolean
-connect_to_server_wrapper (CamelService *service, CamelException *ex)
+connect_to_server_wrapper (CamelService *service, GError **error)
 {
 	const gchar *ssl_mode;
 	struct addrinfo hints, *ai;
 	gint mode, ret, i;
 	const gchar *serv;
 	const gchar *port;
+	GError *local_error = NULL;
 
 #ifndef G_OS_WIN32
 	const gchar *command;
 
 	if (camel_url_get_param(service->url, "use_command")
 	    && (command = camel_url_get_param(service->url, "command")))
-		return connect_to_server_process(service, command, ex);
+		return connect_to_server_process(service, command, error);
 #endif
 
 	if ((ssl_mode = camel_url_get_param (service->url, "use_ssl"))) {
@@ -862,16 +860,18 @@ connect_to_server_wrapper (CamelService *service, CamelException *ex)
 	memset (&hints, 0, sizeof (hints));
 	hints.ai_socktype = SOCK_STREAM;
 	hints.ai_family = PF_UNSPEC;
-	ai = camel_getaddrinfo(service->url->host, serv, &hints, ex);
-	if (ai == NULL && port != NULL && camel_exception_get_id(ex) != CAMEL_EXCEPTION_USER_CANCEL) {
-		camel_exception_clear (ex);
-		ai = camel_getaddrinfo(service->url->host, port, &hints, ex);
+	ai = camel_getaddrinfo(service->url->host, serv, &hints, &local_error);
+	if (ai == NULL && port != NULL && g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+		g_clear_error (&local_error);
+		ai = camel_getaddrinfo(service->url->host, port, &hints, &local_error);
 	}
 
-	if (ai == NULL)
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
 		return FALSE;
+	}
 
-	ret = connect_to_server (service, ai, mode, ex);
+	ret = connect_to_server (service, ai, mode, error);
 
 	camel_freeaddrinfo (ai);
 
@@ -881,7 +881,7 @@ connect_to_server_wrapper (CamelService *service, CamelException *ex)
 extern CamelServiceAuthType camel_imap_password_authtype;
 
 static GList *
-query_auth_types (CamelService *service, CamelException *ex)
+query_auth_types (CamelService *service, GError **error)
 {
 	CamelImapStore *store = CAMEL_IMAP_STORE (service);
 	CamelServiceAuthType *authtype;
@@ -889,8 +889,9 @@ query_auth_types (CamelService *service, CamelException *ex)
 	gboolean connected;
 
 	if (CAMEL_OFFLINE_STORE (store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
 			_("You must be working online to complete this operation"));
 		return NULL;
 	}
@@ -898,7 +899,7 @@ query_auth_types (CamelService *service, CamelException *ex)
 	camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 	connected = store->istream != NULL && store->connected;
 	if (!connected)
-		connected = connect_to_server_wrapper (service, ex);
+		connected = connect_to_server_wrapper (service, error);
 	camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 	if (!connected)
 		return NULL;
@@ -960,7 +961,7 @@ imap_build_folder_info(CamelImapStore *imap_store, const gchar *folder_name)
 static gboolean
 imap_folder_effectively_unsubscribed (CamelImapStore *imap_store,
                                       const gchar *folder_name,
-                                      CamelException *ex)
+                                      GError **error)
 {
 	CamelFolderInfo *fi;
 	CamelStoreInfo *si;
@@ -991,7 +992,7 @@ imap_folder_effectively_unsubscribed (CamelImapStore *imap_store,
 }
 
 static void
-imap_forget_folder (CamelImapStore *imap_store, const gchar *folder_name, CamelException *ex)
+imap_forget_folder (CamelImapStore *imap_store, const gchar *folder_name, GError **error)
 {
 	gchar *state_file;
 	gchar *journal_file;
@@ -1022,8 +1023,8 @@ imap_forget_folder (CamelImapStore *imap_store, const gchar *folder_name, CamelE
 	g_unlink (state_file);
 	g_free (state_file);
 
-	camel_db_delete_folder (((CamelStore *)imap_store)->cdb_w, folder_name, ex);
-	camel_imap_message_cache_delete (folder_dir, ex);
+	camel_db_delete_folder (((CamelStore *)imap_store)->cdb_w, folder_name, NULL);
+	camel_imap_message_cache_delete (folder_dir, NULL);
 
 	state_file = g_strdup_printf("%s/subfolders", folder_dir);
 	g_rmdir(state_file);
@@ -1044,11 +1045,11 @@ imap_forget_folder (CamelImapStore *imap_store, const gchar *folder_name, CamelE
 
 static gboolean
 imap_check_folder_still_extant (CamelImapStore *imap_store, const gchar *full_name,
-				CamelException *ex)
+				GError **error)
 {
 	CamelImapResponse *response;
 
-	response = camel_imap_command (imap_store, NULL, ex, "LIST \"\" %F",
+	response = camel_imap_command (imap_store, NULL, NULL, "LIST \"\" %F",
 				       full_name);
 
 	if (response) {
@@ -1064,80 +1065,30 @@ imap_check_folder_still_extant (CamelImapStore *imap_store, const gchar *full_na
 	return TRUE;
 }
 
-#if 0
-/* This is a little 'hack' to avoid the deadlock conditions that would otherwise
-   ensue when calling camel_folder_refresh_info from inside a lock */
-/* NB: on second thougts this is probably not entirely safe, but it'll do for now */
-/* No, its definetly not safe.  So its been changed to copy the folders first */
-/* the alternative is to:
-   make the camel folder->lock recursive (which should probably be done)
-   or remove it from camel_folder_refresh_info, and use another locking mechanism */
-/* also see get_folder_info_online() for the same hack repeated */
-static void
-imap_store_refresh_folders (CamelImapStore *store, CamelException *ex)
-{
-	GPtrArray *folders;
-	gint i;
-
-	folders = camel_object_bag_list(CAMEL_STORE (store)->folders);
-
-	for (i = 0; i <folders->len; i++) {
-		CamelFolder *folder = folders->pdata[i];
-
-		/* NB: we can have vtrash folders also in our store ... bit hacky */
-		if (!CAMEL_IS_IMAP_FOLDER(folder)) {
-			g_object_unref (folder);
-			continue;
-		}
-
-		CAMEL_IMAP_FOLDER (folder)->need_rescan = TRUE;
-		if (!camel_exception_is_set(ex))
-			CAMEL_FOLDER_GET_CLASS (folder)->refresh_info (folder, ex);
-
-		if (camel_exception_is_set (ex) &&
-		    imap_check_folder_still_extant (store, folder->full_name, ex) == FALSE) {
-			gchar *namedup;
-
-			/* the folder was deleted (may happen when we come back online
-			 * after being offline */
-
-			namedup = g_strdup (folder->full_name);
-			g_object_unref (folder);
-			imap_folder_effectively_unsubscribed (store, namedup, ex);
-			imap_forget_folder (store, namedup, ex);
-			g_free (namedup);
-		} else
-			g_object_unref (folder);
-	}
-
-	g_ptr_array_free (folders, TRUE);
-}
-#endif
-
 static gboolean
-try_auth (CamelImapStore *store, const gchar *mech, CamelException *ex)
+try_auth (CamelImapStore *store, const gchar *mech, GError **error)
 {
 	CamelSasl *sasl;
 	CamelImapResponse *response;
 	gchar *resp;
 	gchar *sasl_resp;
 
-	response = camel_imap_command (store, NULL, ex, "AUTHENTICATE %s", mech);
+	response = camel_imap_command (store, NULL, error, "AUTHENTICATE %s", mech);
 	if (!response)
 		return FALSE;
 
 	sasl = camel_sasl_new ("imap", mech, CAMEL_SERVICE (store));
 	while (!camel_sasl_get_authenticated (sasl)) {
-		resp = camel_imap_response_extract_continuation (store, response, ex);
+		resp = camel_imap_response_extract_continuation (store, response, error);
 		if (!resp)
 			goto lose;
 
-		sasl_resp = camel_sasl_challenge_base64 (sasl, imap_next_word (resp), ex);
+		sasl_resp = camel_sasl_challenge_base64 (sasl, imap_next_word (resp), error);
 		g_free (resp);
-		if (!sasl_resp || camel_exception_is_set (ex))
+		if (!sasl_resp)
 			goto break_and_lose;
 
-		response = camel_imap_command_continuation (store, sasl_resp, strlen (sasl_resp), ex);
+		response = camel_imap_command_continuation (store, sasl_resp, strlen (sasl_resp), error);
 		g_free (sasl_resp);
 		if (!response)
 			goto lose;
@@ -1163,19 +1114,13 @@ try_auth (CamelImapStore *store, const gchar *mech, CamelException *ex)
 		camel_imap_response_free (store, response);
 
  lose:
-	if (!camel_exception_is_set (ex)) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
-			_("Bad authentication response from server."));
-	}
-
 	g_object_unref (sasl);
 
 	return FALSE;
 }
 
 static gboolean
-imap_auth_loop (CamelService *service, CamelException *ex)
+imap_auth_loop (CamelService *service, GError **error)
 {
 	CamelImapStore *store = CAMEL_IMAP_STORE (service);
 	CamelSession *session = camel_service_get_session (service);
@@ -1197,8 +1142,9 @@ imap_auth_loop (CamelService *service, CamelException *ex)
 
 	if (service->url->authmech) {
 		if (!g_hash_table_lookup (store->authtypes, service->url->authmech)) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				_("IMAP server %s does not support requested "
 				  "authentication type %s"),
 				service->url->host,
@@ -1208,21 +1154,24 @@ imap_auth_loop (CamelService *service, CamelException *ex)
 
 		authtype = camel_sasl_authtype (service->url->authmech);
 		if (!authtype) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				_("No support for authentication type %s"),
 				service->url->authmech);
 			return FALSE;
 		}
 
 		if (!authtype->need_password) {
-			authenticated = try_auth (store, authtype->authproto, ex);
+			authenticated = try_auth (store, authtype->authproto, error);
 			if (!authenticated)
 				return FALSE;
 		}
 	}
 
 	while (!authenticated) {
+		GError *local_error = NULL;
+
 		if (errbuf) {
 			/* We need to un-cache the password before prompting again */
 			prompt_flags |= CAMEL_SESSION_PASSWORD_REPROMPT;
@@ -1244,7 +1193,7 @@ imap_auth_loop (CamelService *service, CamelException *ex)
 
 			service->url->passwd = camel_session_get_password (
 				session, service, auth_domain, full_prompt,
-				"password", prompt_flags, ex);
+				"password", prompt_flags, error);
 
 			g_free (base_prompt);
 			g_free (full_prompt);
@@ -1252,8 +1201,9 @@ imap_auth_loop (CamelService *service, CamelException *ex)
 			errbuf = NULL;
 
 			if (!service->url->passwd) {
-				camel_exception_set (
-					ex, CAMEL_EXCEPTION_USER_CANCEL,
+				g_set_error (
+					error, G_IO_ERROR,
+					G_IO_ERROR_CANCELLED,
 					_("You did not enter a password."));
 				return FALSE;
 			}
@@ -1262,14 +1212,14 @@ imap_auth_loop (CamelService *service, CamelException *ex)
 		if (!store->connected) {
 			/* Some servers (eg, courier) will disconnect on
 			 * a bad password. So reconnect here. */
-			if (!connect_to_server_wrapper (service, ex))
+			if (!connect_to_server_wrapper (service, error))
 				return FALSE;
 		}
 
 		if (authtype)
-			authenticated = try_auth (store, authtype->authproto, ex);
+			authenticated = try_auth (store, authtype->authproto, &local_error);
 		else {
-			response = camel_imap_command (store, NULL, ex,
+			response = camel_imap_command (store, NULL, &local_error,
 						       "LOGIN %S %S",
 						       service->url->user,
 						       service->url->passwd);
@@ -1278,16 +1228,17 @@ imap_auth_loop (CamelService *service, CamelException *ex)
 				authenticated = TRUE;
 			}
 		}
-		if (!authenticated) {
-			d(printf("EXCEP %d %d %d\n", camel_exception_get_id(ex), CAMEL_EXCEPTION_USER_CANCEL, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE));
-			if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL ||
-			    camel_exception_get_id (ex) == CAMEL_EXCEPTION_SERVICE_UNAVAILABLE)
+		if (local_error != NULL) {
+			if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ||
+			    g_error_matches (local_error, CAMEL_SERVICE_ERROR, CAMEL_SERVICE_ERROR_UNAVAILABLE)) {
+				g_propagate_error (error, local_error);
 				return FALSE;
+			}
 
 			errbuf = g_markup_printf_escaped (
 				_("Unable to authenticate to IMAP server.\n%s\n\n"),
-				camel_exception_get_description (ex));
-			camel_exception_clear (ex);
+				local_error->message);
+			g_clear_error (&local_error);
 		}
 	}
 
@@ -1295,19 +1246,20 @@ imap_auth_loop (CamelService *service, CamelException *ex)
 }
 
 static gboolean
-imap_connect (CamelService *service, CamelException *ex)
+imap_connect (CamelService *service, GError **error)
 {
 	CamelImapStore *store = CAMEL_IMAP_STORE (service);
 	CamelImapResponse *response;
 	gchar *result, *name;
 	gsize len;
+	GError *local_error = NULL;
 
 	if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
 		return TRUE;
 
 	camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-	if (!connect_to_server_wrapper (service, ex) ||
-	    !imap_auth_loop (service, ex)) {
+	if (!connect_to_server_wrapper (service, error) ||
+	    !imap_auth_loop (service, error)) {
 		camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 		camel_service_disconnect (service, TRUE, NULL);
 		return FALSE;
@@ -1317,11 +1269,11 @@ imap_connect (CamelService *service, CamelException *ex)
 	if (store->capabilities & IMAP_CAPABILITY_NAMESPACE) {
 		struct _namespaces *namespaces;
 
-		response = camel_imap_command (store, NULL, ex, "NAMESPACE");
+		response = camel_imap_command (store, NULL, &local_error, "NAMESPACE");
 		if (!response)
 			goto done;
 
-		result = camel_imap_response_extract (store, response, "NAMESPACE", ex);
+		result = camel_imap_response_extract (store, response, "NAMESPACE", &local_error);
 		if (!result)
 			goto done;
 
@@ -1401,7 +1353,7 @@ imap_connect (CamelService *service, CamelException *ex)
 			/* This idiom means "tell me the hierarchy separator
 			 * for the given path, even if that path doesn't exist.
 			 */
-			response = camel_imap_command (store, NULL, ex,
+			response = camel_imap_command (store, NULL, &local_error,
 						       "LIST %G \"\"",
 						       use_namespace);
 		} else {
@@ -1409,7 +1361,7 @@ imap_connect (CamelService *service, CamelException *ex)
 			 * to "tell me about this folder", which will fail if
 			 * the folder doesn't exist (eg, if namespace is "").
 			 */
-			response = camel_imap_command (store, NULL, ex,
+			response = camel_imap_command (store, NULL, &local_error,
 						       "LIST \"\" %G",
 						       use_namespace);
 		}
@@ -1439,21 +1391,21 @@ imap_connect (CamelService *service, CamelException *ex)
 		CamelStoreInfo *si;
 
 		/* look in all namespaces */
-		if (!get_folders_sync (store, NULL, ex))
+		if (!get_folders_sync (store, NULL, &local_error))
 			goto done;
 
 		/* Make sure INBOX is present/subscribed */
 		si = camel_store_summary_path((CamelStoreSummary *)store->summary, "INBOX");
 		if (si == NULL || (si->flags & CAMEL_FOLDER_SUBSCRIBED) == 0) {
-			response = camel_imap_command (store, NULL, ex, "SUBSCRIBE INBOX");
+			response = camel_imap_command (store, NULL, &local_error, "SUBSCRIBE INBOX");
 			if (response != NULL) {
 				camel_imap_response_free (store, response);
 			}
 			if (si)
 				camel_store_summary_info_free((CamelStoreSummary *)store->summary, si);
-			if (camel_exception_is_set(ex))
+			if (local_error != NULL)
 				goto done;
-			get_folders_sync(store, "INBOX", ex);
+			get_folders_sync(store, "INBOX", &local_error);
 		}
 
 		store->refresh_stamp = time(NULL);
@@ -1465,14 +1417,17 @@ done:
 
 	camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	if (camel_exception_is_set (ex))
+	if (local_error != NULL) {
 		camel_service_disconnect (service, TRUE, NULL);
+		g_propagate_error (error, local_error);
+		return FALSE;
+	}
 
-	return !camel_exception_is_set (ex);
+	return TRUE;
 }
 
 static gboolean
-imap_disconnect (CamelService *service, gboolean clean, CamelException *ex)
+imap_disconnect (CamelService *service, gboolean clean, GError **error)
 {
 	CamelImapStore *store = CAMEL_IMAP_STORE (service);
 
@@ -1484,13 +1439,13 @@ imap_disconnect (CamelService *service, gboolean clean, CamelException *ex)
 	}
 
 	if (store->istream) {
-		camel_stream_close(store->istream);
+		camel_stream_close(store->istream, NULL);
 		g_object_unref (store->istream);
 		store->istream = NULL;
 	}
 
 	if (store->ostream) {
-		camel_stream_close(store->ostream);
+		camel_stream_close(store->ostream, NULL);
 		g_object_unref (store->ostream);
 		store->ostream = NULL;
 	}
@@ -1537,7 +1492,7 @@ imap_summary_is_dirty (CamelFolderSummary *summary)
 
 static gboolean
 imap_noop (CamelStore *store,
-           CamelException *ex)
+           GError **error)
 {
 	CamelImapStore *imap_store = (CamelImapStore *) store;
 	CamelImapResponse *response;
@@ -1546,7 +1501,7 @@ imap_noop (CamelStore *store,
 
 	camel_service_lock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	if (!camel_imap_store_connected(imap_store, ex)) {
+	if (!camel_imap_store_connected(imap_store, error)) {
 		success = FALSE;
 		goto done;
 	}
@@ -1554,9 +1509,9 @@ imap_noop (CamelStore *store,
 	current_folder = imap_store->current_folder;
 	if (current_folder && imap_summary_is_dirty (current_folder->summary)) {
 		/* let's sync the flags instead.  NB: must avoid folder lock */
-		success = CAMEL_FOLDER_GET_CLASS (current_folder)->sync (current_folder, FALSE, ex);
+		success = CAMEL_FOLDER_GET_CLASS (current_folder)->sync (current_folder, FALSE, error);
 	} else {
-		response = camel_imap_command (imap_store, NULL, ex, "NOOP");
+		response = camel_imap_command (imap_store, NULL, error, "NOOP");
 		if (response)
 			camel_imap_response_free (imap_store, response);
 		else
@@ -1569,31 +1524,24 @@ done:
 }
 
 static CamelFolder *
-imap_get_trash(CamelStore *store, CamelException *ex)
+imap_get_trash(CamelStore *store, GError **error)
 {
 	CamelFolder *folder = NULL;
 	CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
 
 	if (imap_store->real_trash_path && *imap_store->real_trash_path) {
-		CamelException ex2;
-
-		camel_exception_init (&ex2);
-
-		folder = camel_store_get_folder (store, imap_store->real_trash_path, 0, &ex2);
+		folder = camel_store_get_folder (store, imap_store->real_trash_path, 0, NULL);
 		if (!folder) {
 			/* cannot find configured folder, just report on console and unset in a store structure to not try again */
-			g_print ("%s: Cannot open '%s': %s", G_STRFUNC, imap_store->real_trash_path, camel_exception_get_description (&ex2) ? camel_exception_get_description (&ex2) : "Unknown error.");
 			g_free (imap_store->real_trash_path);
 			imap_store->real_trash_path = NULL;
 		}
-
-		camel_exception_clear (&ex2);
 	}
 
 	if (folder)
 		return folder;
 
-	folder = CAMEL_STORE_CLASS(camel_imap_store_parent_class)->get_trash(store, ex);
+	folder = CAMEL_STORE_CLASS(camel_imap_store_parent_class)->get_trash(store, error);
 
 	if (folder) {
 		CamelObject *object = CAMEL_OBJECT (folder);
@@ -1609,31 +1557,24 @@ imap_get_trash(CamelStore *store, CamelException *ex)
 }
 
 static CamelFolder *
-imap_get_junk(CamelStore *store, CamelException *ex)
+imap_get_junk(CamelStore *store, GError **error)
 {
 	CamelFolder *folder = NULL;
 	CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
 
 	if (imap_store->real_junk_path && *imap_store->real_junk_path) {
-		CamelException ex2;
-
-		camel_exception_init (&ex2);
-
-		folder = camel_store_get_folder (store, imap_store->real_junk_path, 0, &ex2);
+		folder = camel_store_get_folder (store, imap_store->real_junk_path, 0, NULL);
 		if (!folder) {
 			/* cannot find configured folder, just report on console and unset in a store structure to not try again */
-			g_print ("%s: Cannot open '%s': %s", G_STRFUNC, imap_store->real_junk_path, camel_exception_get_description (&ex2) ? camel_exception_get_description (&ex2) : "Unknown error.");
 			g_free (imap_store->real_junk_path);
 			imap_store->real_junk_path = NULL;
 		}
-
-		camel_exception_clear (&ex2);
 	}
 
 	if (folder)
 		return folder;
 
-	folder = CAMEL_STORE_CLASS(camel_imap_store_parent_class)->get_junk(store, ex);
+	folder = CAMEL_STORE_CLASS(camel_imap_store_parent_class)->get_junk(store, error);
 
 	if (folder) {
 		CamelObject *object = CAMEL_OBJECT (folder);
@@ -1703,14 +1644,10 @@ get_folder_status (CamelImapStore *imap_store, const gchar *folder_name, const g
 				       type);
 
 	if (!response) {
-		CamelException ex;
-
-		camel_exception_init (&ex);
-		if (imap_check_folder_still_extant (imap_store, folder_name, &ex) == FALSE) {
-			imap_folder_effectively_unsubscribed (imap_store, folder_name, &ex);
-			imap_forget_folder (imap_store, folder_name, &ex);
+		if (imap_check_folder_still_extant (imap_store, folder_name, NULL) == FALSE) {
+			imap_folder_effectively_unsubscribed (imap_store, folder_name, NULL);
+			imap_forget_folder (imap_store, folder_name, NULL);
 		}
-		camel_exception_clear (&ex);
 		return NULL;
 	}
 
@@ -1779,31 +1716,33 @@ get_folder_status (CamelImapStore *imap_store, const gchar *folder_name, const g
 }
 
 static CamelFolder *
-get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, CamelException *ex)
+get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, GError **error)
 {
 	CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
 	CamelImapResponse *response;
 	CamelFolder *new_folder;
 	gchar *folder_dir, *storage_path;
+	GError *local_error = NULL;
 
 	/* Try to get it locally first, if it is, then the client will
 	   force a select when necessary */
-	new_folder = get_folder_offline(store, folder_name, flags, ex);
+	new_folder = get_folder_offline(store, folder_name, flags, &local_error);
 	if (new_folder)
 		return new_folder;
 
+	g_clear_error (&local_error);
+
 	if (CAMEL_OFFLINE_STORE (store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
 			_("You must be working online to complete this operation"));
 		return NULL;
 	}
 
-	camel_exception_clear(ex);
-
 	camel_service_lock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	if (!camel_imap_store_connected(imap_store, ex)) {
+	if (!camel_imap_store_connected(imap_store, error)) {
 		camel_service_unlock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 		return NULL;
 	}
@@ -1816,22 +1755,24 @@ get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, CamelExc
 		imap_store->current_folder = NULL;
 	}
 
-	response = camel_imap_command (imap_store, NULL, ex, "SELECT %F", folder_name);
+	response = camel_imap_command (imap_store, NULL, &local_error, "SELECT %F", folder_name);
 	if (!response) {
 		gchar *folder_real, *parent_name, *parent_real;
 		const gchar *c;
 
-		if (camel_exception_get_id(ex) == CAMEL_EXCEPTION_USER_CANCEL) {
+		if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
 			camel_service_unlock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
+			g_propagate_error (error, local_error);
 			return NULL;
 		}
 
-		camel_exception_clear (ex);
+		g_clear_error (&local_error);
 
 		if (!(flags & CAMEL_STORE_FOLDER_CREATE)) {
 			camel_service_unlock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+			g_set_error (
+				error, CAMEL_STORE_ERROR,
+				CAMEL_STORE_ERROR_NO_FOLDER,
 				_("No such folder %s"), folder_name);
 			return NULL;
 		}
@@ -1843,8 +1784,9 @@ get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, CamelExc
 
 		if (*c != '\0') {
 			camel_service_unlock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_FOLDER_INVALID_PATH,
+			g_set_error (
+				error, CAMEL_FOLDER_ERROR,
+				CAMEL_FOLDER_ERROR_INVALID_PATH,
 				_("The folder name \"%s\" is invalid because it contains the character \"%c\""),
 				folder_name, *c);
 			return NULL;
@@ -1863,7 +1805,7 @@ get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, CamelExc
 			gint flags;
 			gint i;
 
-			if (!(response = camel_imap_command (imap_store, NULL, ex, "LIST \"\" %G", parent_real))) {
+			if (!(response = camel_imap_command (imap_store, NULL, error, "LIST \"\" %G", parent_real))) {
 				camel_service_unlock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 				g_free (parent_name);
 				g_free (parent_real);
@@ -1891,7 +1833,6 @@ get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, CamelExc
 			if (need_convert) {
 				struct imap_status_item *items, *item;
 				guint32 messages = 0;
-				CamelException lex;
 				gchar *name;
 
 				item = items = get_folder_status (imap_store, parent_name, "MESSAGES");
@@ -1907,8 +1848,9 @@ get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, CamelExc
 				imap_status_item_free (items);
 
 				if (messages > 0) {
-					camel_exception_set (
-						ex, CAMEL_EXCEPTION_FOLDER_INVALID_STATE,
+					g_set_error (
+						error, CAMEL_FOLDER_ERROR,
+						CAMEL_FOLDER_ERROR_INVALID_STATE,
 						_("The parent folder is not allowed to contain subfolders"));
 					camel_service_unlock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 					g_free (parent_name);
@@ -1917,11 +1859,8 @@ get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, CamelExc
 				}
 
 				/* delete the old parent and recreate it */
-				camel_exception_init (&lex);
-				delete_folder (store, parent_name, &lex);
-				if (camel_exception_is_set (&lex)) {
+				if (!delete_folder (store, parent_name, error)) {
 					camel_service_unlock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-					camel_exception_xfer (ex, &lex);
 					g_free (parent_name);
 					g_free (parent_real);
 					return NULL;
@@ -1929,7 +1868,7 @@ get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, CamelExc
 
 				/* add the dirsep to the end of parent_name */
 				name = g_strdup_printf ("%s%c", parent_real, imap_store->dir_sep);
-				response = camel_imap_command (imap_store, NULL, ex, "CREATE %G",
+				response = camel_imap_command (imap_store, NULL, error, "CREATE %G",
 							       name);
 				g_free (name);
 
@@ -1948,7 +1887,7 @@ get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, CamelExc
 		g_free (parent_name);
 
 		folder_real = camel_imap_store_summary_path_to_full(imap_store->summary, folder_name, imap_store->dir_sep);
-		response = camel_imap_command (imap_store, NULL, ex, "CREATE %G", folder_real);
+		response = camel_imap_command (imap_store, NULL, error, "CREATE %G", folder_real);
 		if (response) {
 			camel_imap_store_summary_add_from_full(imap_store->summary, folder_real, imap_store->dir_sep);
 
@@ -1962,8 +1901,8 @@ get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, CamelExc
 			return NULL;
 		}
 	} else if (flags & CAMEL_STORE_FOLDER_EXCL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot create folder '%s': folder exists."),
 			folder_name);
 
@@ -1977,11 +1916,11 @@ get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, CamelExc
 	storage_path = g_strdup_printf("%s/folders", imap_store->storage_path);
 	folder_dir = imap_path_to_physical (storage_path, folder_name);
 	g_free(storage_path);
-	new_folder = camel_imap_folder_new (store, folder_name, folder_dir, ex);
+	new_folder = camel_imap_folder_new (store, folder_name, folder_dir, error);
 	g_free (folder_dir);
 	if (new_folder) {
 		imap_store->current_folder = g_object_ref (new_folder);
-		if (!camel_imap_folder_selected (new_folder, response, ex)) {
+		if (!camel_imap_folder_selected (new_folder, response, error)) {
 
 			g_object_unref (imap_store->current_folder);
 			imap_store->current_folder = NULL;
@@ -1998,7 +1937,7 @@ get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, CamelExc
 
 static CamelFolder *
 get_folder_offline (CamelStore *store, const gchar *folder_name,
-		    guint32 flags, CamelException *ex)
+		    guint32 flags, GError **error)
 {
 	CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
 	CamelFolder *new_folder = NULL;
@@ -2021,13 +1960,14 @@ get_folder_offline (CamelStore *store, const gchar *folder_name,
 		storage_path = g_strdup_printf("%s/folders", imap_store->storage_path);
 		folder_dir = imap_path_to_physical (storage_path, folder_name);
 		g_free(storage_path);
-		new_folder = camel_imap_folder_new (store, folder_name, folder_dir, ex);
+		new_folder = camel_imap_folder_new (store, folder_name, folder_dir, error);
 		g_free(folder_dir);
 
 		camel_store_summary_info_free((CamelStoreSummary *)imap_store->summary, si);
 	} else {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("No such folder %s"), folder_name);
 	}
 
@@ -2037,7 +1977,7 @@ get_folder_offline (CamelStore *store, const gchar *folder_name,
 static gboolean
 delete_folder (CamelStore *store,
                const gchar *folder_name,
-               CamelException *ex)
+               GError **error)
 {
 	CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
 	CamelImapResponse *response;
@@ -2045,13 +1985,13 @@ delete_folder (CamelStore *store,
 
 	camel_service_lock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	if (!camel_imap_store_connected(imap_store, ex)) {
+	if (!camel_imap_store_connected(imap_store, error)) {
 		success = FALSE;
 		goto fail;
 	}
 
 	/* make sure this folder isn't currently SELECTed */
-	response = camel_imap_command (imap_store, NULL, ex, "SELECT INBOX");
+	response = camel_imap_command (imap_store, NULL, error, "SELECT INBOX");
 	if (!response) {
 		success = FALSE;
 		goto fail;
@@ -2063,10 +2003,10 @@ delete_folder (CamelStore *store,
 	/* no need to actually create a CamelFolder for INBOX */
 	imap_store->current_folder = NULL;
 
-	response = camel_imap_command(imap_store, NULL, ex, "DELETE %F", folder_name);
+	response = camel_imap_command(imap_store, NULL, error, "DELETE %F", folder_name);
 	if (response) {
 		camel_imap_response_free (imap_store, response);
-		imap_forget_folder (imap_store, folder_name, ex);
+		imap_forget_folder (imap_store, folder_name, NULL);
 	} else
 		success = FALSE;
 
@@ -2148,7 +2088,7 @@ static gboolean
 rename_folder (CamelStore *store,
                const gchar *old_name,
                const gchar *new_name_in,
-               CamelException *ex)
+               GError **error)
 {
 	CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
 	CamelImapResponse *response;
@@ -2157,7 +2097,7 @@ rename_folder (CamelStore *store,
 
 	camel_service_lock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	if (!camel_imap_store_connected(imap_store, ex)) {
+	if (!camel_imap_store_connected(imap_store, error)) {
 		success = FALSE;
 		goto fail;
 	}
@@ -2165,7 +2105,7 @@ rename_folder (CamelStore *store,
 	/* make sure this folder isn't currently SELECTed - it's
            actually possible to rename INBOX but if you do another
            INBOX will immediately be created by the server */
-	response = camel_imap_command (imap_store, NULL, ex, "SELECT INBOX");
+	response = camel_imap_command (imap_store, NULL, error, "SELECT INBOX");
 	if (!response) {
 		success = FALSE;
 		goto fail;
@@ -2181,7 +2121,7 @@ rename_folder (CamelStore *store,
 	if (imap_store->parameters & IMAP_PARAM_SUBSCRIPTIONS)
 		manage_subscriptions(store, old_name, FALSE);
 
-	response = camel_imap_command (imap_store, NULL, ex, "RENAME %F %F", old_name, new_name_in);
+	response = camel_imap_command (imap_store, NULL, error, "RENAME %F %F", old_name, new_name_in);
 	if (!response) {
 		if (imap_store->parameters & IMAP_PARAM_SUBSCRIPTIONS)
 			manage_subscriptions(store, old_name, TRUE);
@@ -2240,7 +2180,7 @@ fail:
 
 static CamelFolderInfo *
 create_folder (CamelStore *store, const gchar *parent_name,
-	       const gchar *folder_name, CamelException *ex)
+	       const gchar *folder_name, GError **error)
 {
 	CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
 	gchar *full_name, *resp, *thisone, *parent_real, *real_name;
@@ -2251,8 +2191,9 @@ create_folder (CamelStore *store, const gchar *parent_name,
 	const gchar *c;
 
 	if (CAMEL_OFFLINE_STORE (store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
 			_("You must be working online to complete this operation"));
 		return NULL;
 	}
@@ -2265,8 +2206,9 @@ create_folder (CamelStore *store, const gchar *parent_name,
 		c++;
 
 	if (*c != '\0') {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_FOLDER_INVALID_PATH,
+		g_set_error (
+			error, CAMEL_FOLDER_ERROR,
+			CAMEL_FOLDER_ERROR_INVALID_PATH,
 			_("The folder name \"%s\" is invalid because it contains the character \"%c\""),
 			folder_name, *c);
 		return NULL;
@@ -2277,13 +2219,15 @@ create_folder (CamelStore *store, const gchar *parent_name,
 	/* FIXME: use storesummary directly */
 	parent_real = camel_imap_store_summary_full_from_path(imap_store->summary, parent_name);
 	if (parent_real == NULL) {
-		camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_STATE,
-				     _("Unknown parent folder: %s"), parent_name);
+		g_set_error (
+			error, CAMEL_FOLDER_ERROR,
+			CAMEL_FOLDER_ERROR_INVALID_STATE,
+			_("Unknown parent folder: %s"), parent_name);
 		return NULL;
 	}
 
 	need_convert = FALSE;
-	response = camel_imap_command (imap_store, NULL, ex, "LIST \"\" %G",
+	response = camel_imap_command (imap_store, NULL, error, "LIST \"\" %G",
 				       parent_real);
 	if (!response) /* whoa, this is bad */ {
 		g_free(parent_real);
@@ -2326,20 +2270,21 @@ create_folder (CamelStore *store, const gchar *parent_name,
 		imap_status_item_free (items);
 
 		if (messages > 0) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_FOLDER_INVALID_STATE,
+			g_set_error (
+				error, CAMEL_FOLDER_ERROR,
+				CAMEL_FOLDER_ERROR_INVALID_STATE,
 				_("The parent folder is not allowed to contain subfolders"));
 			g_free(parent_real);
 			return NULL;
 		}
 
 		/* delete the old parent and recreate it */
-		if (!delete_folder (store, parent_name, ex))
+		if (!delete_folder (store, parent_name, error))
 			return NULL;
 
 		/* add the dirsep to the end of parent_name */
 		name = g_strdup_printf ("%s%c", parent_real, imap_store->dir_sep);
-		response = camel_imap_command (imap_store, NULL, ex, "CREATE %G",
+		response = camel_imap_command (imap_store, NULL, error, "CREATE %G",
 					       name);
 		g_free (name);
 
@@ -2356,7 +2301,7 @@ create_folder (CamelStore *store, const gchar *parent_name,
 	real_name = camel_imap_store_summary_path_to_full(imap_store->summary, folder_name, imap_store->dir_sep);
 	full_name = imap_concat (imap_store, parent_real, real_name);
 	g_free(real_name);
-	response = camel_imap_command (imap_store, NULL, ex, "CREATE %G", full_name);
+	response = camel_imap_command (imap_store, NULL, error, "CREATE %G", full_name);
 
 	if (response) {
 		CamelImapStoreInfo *si;
@@ -2512,7 +2457,7 @@ get_folders_free(gpointer k, gpointer v, gpointer d)
 }
 
 static gboolean
-get_folders_sync (CamelImapStore *imap_store, const gchar *ppattern, CamelException *ex)
+get_folders_sync (CamelImapStore *imap_store, const gchar *ppattern, GError **error)
 {
 	CamelImapResponse *response;
 	CamelFolderInfo *fi, *hfi;
@@ -2548,7 +2493,7 @@ get_folders_sync (CamelImapStore *imap_store, const gchar *ppattern, CamelExcept
 			}
 
 			for (j = 0; j < 2; j++) {
-				response = camel_imap_command (imap_store, NULL, ex,
+				response = camel_imap_command (imap_store, NULL, error,
 								"%s \"\" %G", j==1 ? "LSUB" : "LIST",
 								pattern);
 				if (!response) {
@@ -2620,14 +2565,10 @@ get_folders_sync (CamelImapStore *imap_store, const gchar *ppattern, CamelExcept
 				gchar *dup_folder_name = g_strdup (camel_store_info_path (imap_store->summary, si));
 
 				if (dup_folder_name) {
-					CamelException eex;
-
-					camel_exception_init (&eex);
-					imap_folder_effectively_unsubscribed (imap_store, dup_folder_name, &eex);
-					imap_forget_folder (imap_store, dup_folder_name, &eex);
+					imap_folder_effectively_unsubscribed (imap_store, dup_folder_name, NULL);
+					imap_forget_folder (imap_store, dup_folder_name, NULL);
 
 					g_free (dup_folder_name);
-					camel_exception_clear (&eex);
 				} else {
 					camel_store_summary_remove ((CamelStoreSummary *)imap_store->summary, si);
 				}
@@ -2697,7 +2638,7 @@ struct _refresh_msg {
 	CamelSessionThreadMsg msg;
 
 	CamelStore *store;
-	CamelException ex;
+	GError *error;
 };
 
 static void
@@ -2708,18 +2649,18 @@ refresh_refresh(CamelSession *session, CamelSessionThreadMsg *msg)
 
 	camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	if (!camel_imap_store_connected (store, &m->ex))
+	if (!camel_imap_store_connected (store, &m->error))
 		goto done;
 
 	if (store->users_namespace && store->users_namespace[0]) {
-		if (!get_folders_sync (store, "INBOX", &m->ex))
+		if (!get_folders_sync (store, "INBOX", &m->error))
 			goto done;
 	} else {
-		get_folders_sync (store, "*", &m->ex);
+		get_folders_sync (store, "*", NULL);
 	}
 
 	/* look in all namespaces */
-	get_folders_sync (store, NULL, &m->ex);
+	get_folders_sync (store, NULL, &m->error);
 	camel_store_summary_save ((CamelStoreSummary *)store->summary);
 done:
 	camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
@@ -2731,7 +2672,7 @@ refresh_free(CamelSession *session, CamelSessionThreadMsg *msg)
 	struct _refresh_msg *m = (struct _refresh_msg *)msg;
 
 	g_object_unref (m->store);
-	camel_exception_clear(&m->ex);
+	g_clear_error (&m->error);
 }
 
 static CamelSessionThreadOps refresh_ops = {
@@ -2743,7 +2684,7 @@ static CamelFolderInfo *
 get_folder_info (CamelStore *store,
                  const gchar *top,
                  guint32 flags,
-                 CamelException *ex)
+                 GError **error)
 {
 	CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
 	CamelFolderInfo *tree = NULL;
@@ -2759,7 +2700,7 @@ get_folder_info (CamelStore *store,
 		printf("get folder info online\n");
 
 	if (CAMEL_OFFLINE_STORE (store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
-		tree = get_folder_info_offline (store, top, flags, ex);
+		tree = get_folder_info_offline (store, top, flags, error);
 		return tree;
 	}
 
@@ -2780,7 +2721,7 @@ get_folder_info (CamelStore *store,
 
 				m = camel_session_thread_msg_new(((CamelService *)store)->session, &refresh_ops, sizeof(*m));
 				m->store = g_object_ref (store);
-				camel_exception_init(&m->ex);
+				m->error = NULL;
 				camel_session_thread_queue(((CamelService *)store)->session, &m->msg, 0);
 			}
 			camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
@@ -2792,7 +2733,7 @@ get_folder_info (CamelStore *store,
 
 		camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-		if (!camel_imap_store_connected((CamelImapStore *)store, ex))
+		if (!camel_imap_store_connected((CamelImapStore *)store, error))
 			goto fail;
 
 		if (top[0] == 0) {
@@ -2814,19 +2755,19 @@ get_folder_info (CamelStore *store,
 		}
 
 		ns = camel_imap_store_summary_get_main_namespace (imap_store->summary);
-		if (!get_folders_sync (imap_store, pattern, ex))
+		if (!get_folders_sync (imap_store, pattern, error))
 			goto fail;
 		if (pattern[0] != '*' && ns) {
 			pattern[i] = ns->sep;
 			pattern[i+1] = (flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE)?'*':'%';
 			pattern[i+2] = 0;
-			get_folders_sync(imap_store, pattern, ex);
+			get_folders_sync(imap_store, pattern, NULL);
 		}
 		camel_store_summary_save((CamelStoreSummary *)imap_store->summary);
 		camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 	}
 
-	tree = get_folder_info_offline(store, top, flags, ex);
+	tree = get_folder_info_offline(store, top, flags, error);
 	return tree;
 
 fail:
@@ -2836,7 +2777,7 @@ fail:
 
 static CamelFolderInfo *
 get_folder_info_offline (CamelStore *store, const gchar *top,
-			 guint32 flags, CamelException *ex)
+			 guint32 flags, GError **error)
 {
 	CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
 	gboolean include_inbox = FALSE;
@@ -2971,7 +2912,7 @@ folder_is_subscribed (CamelStore *store,
 static gboolean
 subscribe_folder (CamelStore *store,
                   const gchar *folder_name,
-                  CamelException *ex)
+                  GError **error)
 {
 	CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
 	CamelImapResponse *response;
@@ -2981,12 +2922,12 @@ subscribe_folder (CamelStore *store,
 
 	camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	if (!camel_imap_store_connected (imap_store, ex)) {
+	if (!camel_imap_store_connected (imap_store, error)) {
 		success = FALSE;
 		goto done;
 	}
 
-	response = camel_imap_command (imap_store, NULL, ex,
+	response = camel_imap_command (imap_store, NULL, error,
 				       "SUBSCRIBE %F", folder_name);
 	if (!response) {
 		success = FALSE;
@@ -3026,7 +2967,7 @@ done:
 static gboolean
 unsubscribe_folder (CamelStore *store,
                     const gchar *folder_name,
-                    CamelException *ex)
+                    GError **error)
 {
 	CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
 	CamelImapResponse *response;
@@ -3034,12 +2975,12 @@ unsubscribe_folder (CamelStore *store,
 
 	camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	if (!camel_imap_store_connected (imap_store, ex)) {
+	if (!camel_imap_store_connected (imap_store, error)) {
 		success = FALSE;
 		goto done;
 	}
 
-	response = camel_imap_command (imap_store, NULL, ex,
+	response = camel_imap_command (imap_store, NULL, error,
 				       "UNSUBSCRIBE %F", folder_name);
 	if (!response) {
 		success = FALSE;
@@ -3048,7 +2989,7 @@ unsubscribe_folder (CamelStore *store,
 
 	camel_imap_response_free (imap_store, response);
 
-	success = imap_folder_effectively_unsubscribed (imap_store, folder_name, ex);
+	success = imap_folder_effectively_unsubscribed (imap_store, folder_name, error);
 
 done:
 	camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
@@ -3080,7 +3021,7 @@ folder_flags_have_changed (CamelFolder *folder)
 /* Use this whenever you need to ensure you're both connected and
    online. */
 gboolean
-camel_imap_store_connected (CamelImapStore *store, CamelException *ex)
+camel_imap_store_connected (CamelImapStore *store, GError **error)
 {
 	/* This looks stupid ... because it is.
 
@@ -3090,20 +3031,20 @@ camel_imap_store_connected (CamelImapStore *store, CamelException *ex)
 
 	if (store->istream != NULL
 	    || (((CAMEL_OFFLINE_STORE (store)->state == CAMEL_OFFLINE_STORE_NETWORK_AVAIL)
-		&& camel_service_connect((CamelService *)store, ex)
+		&& camel_service_connect((CamelService *)store, NULL)
 		&& store->istream != NULL)))
 		return TRUE;
 
-	if (!camel_exception_is_set(ex))
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-			_("You must be working online to complete this operation"));
+	g_set_error (
+		error, CAMEL_SERVICE_ERROR,
+		CAMEL_SERVICE_ERROR_UNAVAILABLE,
+		_("You must be working online to complete this operation"));
 
 	return FALSE;
 }
 
 gssize
-camel_imap_store_readline (CamelImapStore *store, gchar **dest, CamelException *ex)
+camel_imap_store_readline (CamelImapStore *store, gchar **dest, GError **error)
 {
 	CamelStreamBuffer *stream;
 	gchar linebuf[1024] = {0};
@@ -3120,32 +3061,27 @@ camel_imap_store_readline (CamelImapStore *store, gchar **dest, CamelException *
 	 * meaning if we reconnect, so always set an exception.
 	 */
 
-	if (!camel_imap_store_connected (store, ex))
+	if (!camel_imap_store_connected (store, error))
 		return -1;
 
 	stream = CAMEL_STREAM_BUFFER (store->istream);
 
 	ba = g_byte_array_new ();
-	while ((nread = camel_stream_buffer_gets (stream, linebuf, sizeof (linebuf))) > 0) {
+	while ((nread = camel_stream_buffer_gets (stream, linebuf, sizeof (linebuf), error)) > 0) {
 		g_byte_array_append (ba, (const guint8 *) linebuf, nread);
 		if (linebuf[nread - 1] == '\n')
 			break;
 	}
 
 	if (nread <= 0) {
-		if (errno == EINTR)
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_USER_CANCEL,
-				_("Operation cancelled"));
-		else if (errno == 0)
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+		if (nread == 0)
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_UNAVAILABLE,
 				_("Server unexpectedly disconnected"));
 		else
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-				_("Server unexpectedly disconnected: %s"),
-				g_strerror (errno));
+			g_prefix_error (
+				error, _("Server unexpectedly disconnected: "));
 
 		camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
 		g_byte_array_free (ba, TRUE);
@@ -3175,15 +3111,16 @@ camel_imap_store_readline (CamelImapStore *store, gchar **dest, CamelException *
 static gboolean
 imap_can_refresh_folder (CamelStore *store,
                          CamelFolderInfo *info,
-                         CamelException *ex)
+                         GError **error)
 {
 	gboolean res;
+	GError *local_error = NULL;
 
-	res = CAMEL_STORE_CLASS(camel_imap_store_parent_class)->can_refresh_folder (store, info, ex) ||
+	res = CAMEL_STORE_CLASS(camel_imap_store_parent_class)->can_refresh_folder (store, info, &local_error) ||
 	      (camel_url_get_param (((CamelService *)store)->url, "check_all") != NULL) ||
 	      (camel_url_get_param (((CamelService *)store)->url, "check_lsub") != NULL && (info->flags & CAMEL_FOLDER_SUBSCRIBED) != 0);
 
-	if (!res && !camel_exception_is_set (ex) && CAMEL_IS_IMAP_STORE (store)) {
+	if (!res && local_error == NULL && CAMEL_IS_IMAP_STORE (store)) {
 		CamelStoreInfo *si;
 		CamelStoreSummary *sm = CAMEL_STORE_SUMMARY (((CamelImapStore *)(store))->summary);
 
@@ -3198,5 +3135,8 @@ imap_can_refresh_folder (CamelStore *store,
 		}
 	}
 
+	if (local_error != NULL)
+		g_propagate_error (error, local_error);
+
 	return res;
 }
diff --git a/camel/providers/imap/camel-imap-store.h b/camel/providers/imap/camel-imap-store.h
index 703e976..27410a5 100644
--- a/camel/providers/imap/camel-imap-store.h
+++ b/camel/providers/imap/camel-imap-store.h
@@ -170,9 +170,9 @@ struct _CamelImapStoreClass {
 
 GType camel_imap_store_get_type (void);
 
-gboolean camel_imap_store_connected (CamelImapStore *store, CamelException *ex);
+gboolean camel_imap_store_connected (CamelImapStore *store, GError **error);
 
-gssize camel_imap_store_readline (CamelImapStore *store, gchar **dest, CamelException *ex);
+gssize camel_imap_store_readline (CamelImapStore *store, gchar **dest, GError **error);
 
 G_END_DECLS
 
diff --git a/camel/providers/imap/camel-imap-summary.c b/camel/providers/imap/camel-imap-summary.c
index 575a95a..e067836 100644
--- a/camel/providers/imap/camel-imap-summary.c
+++ b/camel/providers/imap/camel-imap-summary.c
@@ -47,7 +47,7 @@ static gboolean info_set_user_flag (CamelMessageInfo *info, const gchar *id, gbo
 static CamelMessageContentInfo *content_info_migrate (CamelFolderSummary *s, FILE *in);
 
 static gint summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir);
-static CamelFIRecord * summary_header_to_db (CamelFolderSummary *s, CamelException *ex);
+static CamelFIRecord * summary_header_to_db (CamelFolderSummary *s, GError **error);
 static CamelMIRecord * message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info);
 static CamelMessageInfo * message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir);
 static gint content_info_to_db (CamelFolderSummary *s, CamelMessageContentInfo *info, CamelMIRecord *mir);
@@ -152,8 +152,6 @@ camel_imap_summary_new (CamelFolder *folder, const gchar *filename)
 {
 	CamelStore *parent_store;
 	CamelFolderSummary *summary;
-	CamelException ex;
-	camel_exception_init (&ex);
 
 	parent_store = camel_folder_get_parent_store (folder);
 
@@ -171,13 +169,11 @@ camel_imap_summary_new (CamelFolder *folder, const gchar *filename)
 	camel_folder_summary_set_build_content (summary, TRUE);
 	camel_folder_summary_set_filename (summary, filename);
 
-	if (camel_folder_summary_load_from_db (summary, &ex) == -1) {
+	if (camel_folder_summary_load_from_db (summary, NULL) == -1) {
 		/* FIXME: Isn't this dangerous ? We clear the summary
 		if it cannot be loaded, for some random reason.
 		We need to pass the ex and find out why it is not loaded etc. ? */
 		camel_folder_summary_clear_db (summary);
-		g_message ("Unable to load summary: %s\n", camel_exception_get_description (&ex));
-		camel_exception_clear (&ex);
 	}
 
 	g_ptr_array_sort (summary->uids, (GCompareFunc) uid_compare);
@@ -250,12 +246,12 @@ summary_header_load (CamelFolderSummary *s, FILE *in)
 }
 
 static CamelFIRecord *
-summary_header_to_db (CamelFolderSummary *s, CamelException *ex)
+summary_header_to_db (CamelFolderSummary *s, GError **error)
 {
 	CamelImapSummary *ims = CAMEL_IMAP_SUMMARY(s);
 	struct _CamelFIRecord *fir;
 
-	fir = CAMEL_FOLDER_SUMMARY_CLASS (camel_imap_summary_parent_class)->summary_header_to_db (s, ex);
+	fir = CAMEL_FOLDER_SUMMARY_CLASS (camel_imap_summary_parent_class)->summary_header_to_db (s, error);
 	if (!fir)
 		return NULL;
 	fir->bdata = g_strdup_printf ("%d %u", CAMEL_IMAP_SUMMARY_VERSION, ims->validity);
diff --git a/camel/providers/imap/camel-imap-wrapper.c b/camel/providers/imap/camel-imap-wrapper.c
index cb32cb5..d3088e9 100644
--- a/camel/providers/imap/camel-imap-wrapper.c
+++ b/camel/providers/imap/camel-imap-wrapper.c
@@ -91,20 +91,18 @@ imap_wrapper_finalize (GObject *object)
 
 static gssize
 imap_wrapper_write_to_stream (CamelDataWrapper *data_wrapper,
-                              CamelStream *stream)
+                              CamelStream *stream,
+                              GError **error)
 {
 	CamelImapWrapper *imap_wrapper = CAMEL_IMAP_WRAPPER (data_wrapper);
 
 	CAMEL_IMAP_WRAPPER_LOCK (imap_wrapper, lock);
 	if (data_wrapper->offline) {
-		CamelException ex = CAMEL_EXCEPTION_INITIALISER;
 		CamelStream *datastream;
 
 		datastream = camel_imap_folder_fetch_data (
 			imap_wrapper->folder, imap_wrapper->uid,
-			imap_wrapper->part_spec, FALSE, &ex);
-
-		camel_exception_clear (&ex);
+			imap_wrapper->part_spec, FALSE, NULL);
 
 		if (!datastream) {
 			CAMEL_IMAP_WRAPPER_UNLOCK (imap_wrapper, lock);
@@ -114,6 +112,10 @@ imap_wrapper_write_to_stream (CamelDataWrapper *data_wrapper,
 /* FIXME[disk-summary] what errno to use if no ENETUNREACH */
 			errno = EINVAL;
 #endif
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
+				"%s", g_strerror (errno));
 			return -1;
 		}
 
@@ -123,7 +125,7 @@ imap_wrapper_write_to_stream (CamelDataWrapper *data_wrapper,
 	CAMEL_IMAP_WRAPPER_UNLOCK (imap_wrapper, lock);
 
 	return CAMEL_DATA_WRAPPER_CLASS (camel_imap_wrapper_parent_class)->
-		write_to_stream (data_wrapper, stream);
+		write_to_stream (data_wrapper, stream, error);
 }
 
 static void
diff --git a/camel/providers/imapx/Makefile.am b/camel/providers/imapx/Makefile.am
index a479358..6fc3b8c 100644
--- a/camel/providers/imapx/Makefile.am
+++ b/camel/providers/imapx/Makefile.am
@@ -11,7 +11,6 @@ libcamelimapx_la_CPPFLAGS = \
 	-DG_LOG_DOMAIN=\"camel-imapx\"
 
 libcamelimapx_la_SOURCES =			\
-	camel-imapx-exception.c			\
 	camel-imapx-stream.c			\
 	camel-imapx-utils.c			\
 	camel-imapx-provider.c			\
@@ -22,7 +21,6 @@ libcamelimapx_la_SOURCES =			\
 	camel-imapx-server.c			
 
 noinst_HEADERS =				\
-	camel-imapx-exception.h			\
 	camel-imapx-stream.h			\
 	camel-imapx-store-summary.h		\
 	camel-imapx-summary.h			\
diff --git a/camel/providers/imapx/camel-imapx-folder.c b/camel/providers/imapx/camel-imapx-folder.c
index 53c647e..1d529bf 100644
--- a/camel/providers/imapx/camel-imapx-folder.c
+++ b/camel/providers/imapx/camel-imapx-folder.c
@@ -32,7 +32,6 @@
 #include "camel-imapx-store.h"
 #include "camel-imapx-folder.h"
 #include "camel-imapx-summary.h"
-#include "camel-imapx-exception.h"
 #include "camel-imapx-server.h"
 
 #include <stdlib.h>
@@ -43,7 +42,7 @@
 G_DEFINE_TYPE (CamelIMAPXFolder, camel_imapx_folder, CAMEL_TYPE_OFFLINE_FOLDER)
 
 CamelFolder *
-camel_imapx_folder_new(CamelStore *store, const gchar *folder_dir, const gchar *folder_name, CamelException *ex)
+camel_imapx_folder_new(CamelStore *store, const gchar *folder_dir, const gchar *folder_name, GError **error)
 {
 	CamelFolder *folder;
 	CamelIMAPXFolder *ifolder;
@@ -71,17 +70,18 @@ camel_imapx_folder_new(CamelStore *store, const gchar *folder_dir, const gchar *
 	summary_file = g_strdup_printf ("%s/summary", folder_dir);
 	folder->summary = camel_imapx_summary_new(folder, summary_file);
 	if (!folder->summary) {
-		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-				_("Could not create folder summary for %s"),
-				short_name);
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+			_("Could not create folder summary for %s"),
+			short_name);
 		return NULL;
 	}
 
-	ifolder->cache = camel_data_cache_new (folder_dir, ex);
+	ifolder->cache = camel_data_cache_new (folder_dir, error);
 	if (!ifolder->cache) {
-		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-				      _("Could not create cache for %s"),
-				      short_name);
+		g_prefix_error (
+			error, _("Could not create cache for %s: "),
+			short_name);
 		return NULL;
 	}
 
@@ -148,11 +148,12 @@ imapx_folder_finalize (GObject *object)
 }
 
 static gboolean
-imapx_refresh_info (CamelFolder *folder, CamelException *ex)
+imapx_refresh_info (CamelFolder *folder, GError **error)
 {
 	CamelStore *parent_store;
 	CamelIMAPXStore *istore;
 	CamelIMAPXServer *server;
+	gboolean success = FALSE;
 
 	parent_store = camel_folder_get_parent_store (folder);
 	istore = CAMEL_IMAPX_STORE (parent_store);
@@ -160,18 +161,20 @@ imapx_refresh_info (CamelFolder *folder, CamelException *ex)
 	if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
 		return TRUE;
 
-	camel_service_connect((CamelService *)istore, ex);
-	server = camel_imapx_store_get_server(istore, ex);
-	if (server) {
-		camel_imapx_server_refresh_info(server, folder, ex);
+	if (!camel_service_connect((CamelService *)istore, error))
+		return FALSE;
+
+	server = camel_imapx_store_get_server(istore, error);
+	if (server != NULL) {
+		success = camel_imapx_server_refresh_info(server, folder, error);
 		g_object_unref(server);
 	}
 
-	return !camel_exception_is_set (ex);
+	return success;
 }
 
 static gboolean
-imapx_expunge (CamelFolder *folder, CamelException *ex)
+imapx_expunge (CamelFolder *folder, GError **error)
 {
 	CamelStore *parent_store;
 	CamelIMAPXStore *is;
@@ -183,22 +186,22 @@ imapx_expunge (CamelFolder *folder, CamelException *ex)
 	if (CAMEL_OFFLINE_STORE (is)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
 		return TRUE;
 
-	server = camel_imapx_store_get_server(is, ex);
+	server = camel_imapx_store_get_server(is, error);
 	if (server) {
-		camel_imapx_server_expunge(server, folder, ex);
+		camel_imapx_server_expunge(server, folder, error);
 		g_object_unref(server);
+		return TRUE;
 	}
 
-	return !camel_exception_is_set (ex);
+	return FALSE;
 }
 
 static gboolean
-imapx_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
+imapx_sync (CamelFolder *folder, gboolean expunge, GError **error)
 {
 	CamelStore *parent_store;
 	CamelIMAPXStore *is;
 	CamelIMAPXServer *server;
-	CamelException eex = CAMEL_EXCEPTION_INITIALISER;
 
 	parent_store = camel_folder_get_parent_store (folder);
 	is = CAMEL_IMAPX_STORE (parent_store);
@@ -206,29 +209,23 @@ imapx_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
 	if (CAMEL_OFFLINE_STORE (is)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
 		return TRUE;
 
-	if (!ex)
-		ex = &eex;
-
-	server = camel_imapx_store_get_server(is, ex);
+	server = camel_imapx_store_get_server(is, NULL);
 	if (server)
-		camel_imapx_server_sync_changes (server, folder, ex);
+		camel_imapx_server_sync_changes (server, folder, NULL);
 
 	/* Sync twice - make sure deleted flags are written out,
 	   then sync again incase expunge changed anything */
-	camel_exception_clear(ex);
 
-	if (server && expunge) {
-		camel_imapx_server_expunge(server, folder, ex);
-		camel_exception_clear(ex);
-	}
+	if (server && expunge)
+		camel_imapx_server_expunge(server, folder, NULL);
 	if (server)
 		g_object_unref(server);
 
-	return !camel_exception_is_set (ex);
+	return TRUE;
 }
 
 static CamelMimeMessage *
-imapx_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
+imapx_get_message (CamelFolder *folder, const gchar *uid, GError **error)
 {
 	CamelMimeMessage *msg = NULL;
 	CamelStream *stream = NULL;
@@ -252,30 +249,29 @@ imapx_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
 	stream = camel_data_cache_get (ifolder->cache, path, uid, NULL);
 	if (!stream) {
 		if (offline_message) {
-			camel_exception_setv(ex, 2, "Offline message vanished from disk: %s", uid);
+			g_set_error (
+				error, CAMEL_FOLDER_ERROR,
+				CAMEL_FOLDER_ERROR_INVALID_UID,
+				"Offline message vanished from disk: %s", uid);
 			return NULL;
 		}
 
 		if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
 			return NULL;
 
-		server = camel_imapx_store_get_server(istore, ex);
+		server = camel_imapx_store_get_server(istore, error);
 		if (server) {
-			stream = camel_imapx_server_get_message(server, folder, uid, ex);
+			stream = camel_imapx_server_get_message(server, folder, uid, error);
 			g_object_unref(server);
-		} else {
-			/* It should _always_ be set */
-			if (!camel_exception_is_set (ex))
-				camel_exception_setv(ex, 1, "not authenticated");
+		} else
 			return NULL;
-		}
 	}
 
-	if (!camel_exception_is_set (ex) && stream) {
+	if (stream != NULL) {
 		msg = camel_mime_message_new();
 
 		g_mutex_lock (ifolder->stream_lock);
-		if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)msg, stream) == -1) {
+		if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)msg, stream, error) == -1) {
 			g_object_unref (msg);
 			msg = NULL;
 		}
@@ -287,11 +283,12 @@ imapx_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
 }
 
 static gboolean
-imapx_sync_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
+imapx_sync_message (CamelFolder *folder, const gchar *uid, GError **error)
 {
 	CamelStore *parent_store;
 	CamelIMAPXStore *istore;
 	CamelIMAPXServer *server;
+	gboolean success;
 
 	parent_store = camel_folder_get_parent_store (folder);
 	istore = CAMEL_IMAPX_STORE (parent_store);
@@ -299,22 +296,25 @@ imapx_sync_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
 	if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
 		return TRUE;
 
-	server = camel_imapx_store_get_server(istore, ex);
-	if (server) {
-		camel_imapx_server_sync_message (server, folder, uid, ex);
-		g_object_unref(server);
-	}
-	return !camel_exception_is_set (ex);
+	server = camel_imapx_store_get_server(istore, error);
+	if (server == NULL)
+		return FALSE;
+
+	success = camel_imapx_server_sync_message (server, folder, uid, error);
+	g_object_unref(server);
+
+	return success;
 }
 
 static gboolean
 imapx_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
 		      CamelFolder *dest, GPtrArray **transferred_uids,
-		      gboolean delete_originals, CamelException *ex)
+		      gboolean delete_originals, GError **error)
 {
 	CamelStore *parent_store;
 	CamelIMAPXStore *istore;
 	CamelIMAPXServer *server;
+	gboolean success = FALSE;
 
 	parent_store = camel_folder_get_parent_store (source);
 	istore = CAMEL_IMAPX_STORE (parent_store);
@@ -322,23 +322,24 @@ imapx_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
 	if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
 		return TRUE;
 
-	server = camel_imapx_store_get_server(istore, ex);
+	server = camel_imapx_store_get_server(istore, error);
 	if (server) {
-		camel_imapx_server_copy_message (server, source, dest, uids, delete_originals, ex);
+		success = camel_imapx_server_copy_message (server, source, dest, uids, delete_originals, error);
 		g_object_unref(server);
 	}
 
-	imapx_refresh_info (dest, ex);
+	imapx_refresh_info (dest, NULL);
 
-	return !camel_exception_is_set (ex);
+	return success;
 }
 
 static gboolean
-imapx_append_message(CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, gchar **appended_uid, CamelException *ex)
+imapx_append_message(CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, gchar **appended_uid, GError **error)
 {
 	CamelStore *parent_store;
 	CamelIMAPXStore *istore;
 	CamelIMAPXServer *server;
+	gboolean success = FALSE;
 
 	parent_store = camel_folder_get_parent_store (folder);
 	istore = CAMEL_IMAPX_STORE (parent_store);
@@ -349,21 +350,21 @@ imapx_append_message(CamelFolder *folder, CamelMimeMessage *message, const Camel
 	if (appended_uid)
 		*appended_uid = NULL;
 
-	server = camel_imapx_store_get_server(istore, ex);
+	server = camel_imapx_store_get_server(istore, error);
 	if (server) {
-		camel_imapx_server_append_message(server, folder, message, info, ex);
+		success = camel_imapx_server_append_message(server, folder, message, info, error);
 		g_object_unref(server);
 	}
 
-	return !camel_exception_is_set (ex);
+	return success;
 }
 
 gchar *
-imapx_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex)
+imapx_get_filename (CamelFolder *folder, const gchar *uid, GError **error)
 {
 	CamelIMAPXFolder *ifolder = (CamelIMAPXFolder *) folder;
 
-	return camel_data_cache_get_filename (ifolder->cache, "cache", uid, NULL);
+	return camel_data_cache_get_filename (ifolder->cache, "cache", uid, error);
 }
 
 /* Algorithm for selecting a folder:
@@ -437,7 +438,7 @@ imapx_search_free (CamelFolder *folder, GPtrArray *uids)
 }
 
 static GPtrArray *
-imapx_search_by_uids (CamelFolder *folder, const gchar *expression, GPtrArray *uids, CamelException *ex)
+imapx_search_by_uids (CamelFolder *folder, const gchar *expression, GPtrArray *uids, GError **error)
 {
 	CamelIMAPXFolder *ifolder = CAMEL_IMAPX_FOLDER(folder);
 	GPtrArray *matches;
@@ -448,7 +449,7 @@ imapx_search_by_uids (CamelFolder *folder, const gchar *expression, GPtrArray *u
 	g_mutex_lock (ifolder->search_lock);
 
 	camel_folder_search_set_folder(ifolder->search, folder);
-	matches = camel_folder_search_search(ifolder->search, expression, uids, ex);
+	matches = camel_folder_search_search(ifolder->search, expression, uids, error);
 
 	g_mutex_unlock (ifolder->search_lock);
 
@@ -456,7 +457,7 @@ imapx_search_by_uids (CamelFolder *folder, const gchar *expression, GPtrArray *u
 }
 
 static guint32
-imapx_count_by_expression (CamelFolder *folder, const gchar *expression, CamelException *ex)
+imapx_count_by_expression (CamelFolder *folder, const gchar *expression, GError **error)
 {
 	CamelIMAPXFolder *ifolder = CAMEL_IMAPX_FOLDER(folder);
 	guint32 matches;
@@ -464,7 +465,7 @@ imapx_count_by_expression (CamelFolder *folder, const gchar *expression, CamelEx
 	g_mutex_lock (ifolder->search_lock);
 
 	camel_folder_search_set_folder (ifolder->search, folder);
-	matches = camel_folder_search_count (ifolder->search, expression, ex);
+	matches = camel_folder_search_count (ifolder->search, expression, error);
 
 	g_mutex_unlock (ifolder->search_lock);
 
@@ -472,7 +473,7 @@ imapx_count_by_expression (CamelFolder *folder, const gchar *expression, CamelEx
 }
 
 static GPtrArray *
-imapx_search_by_expression (CamelFolder *folder, const gchar *expression, CamelException *ex)
+imapx_search_by_expression (CamelFolder *folder, const gchar *expression, GError **error)
 {
 	CamelIMAPXFolder *ifolder = CAMEL_IMAPX_FOLDER (folder);
 	GPtrArray *matches;
@@ -480,7 +481,7 @@ imapx_search_by_expression (CamelFolder *folder, const gchar *expression, CamelE
 	g_mutex_lock (ifolder->search_lock);
 
 	camel_folder_search_set_folder (ifolder->search, folder);
-	matches = camel_folder_search_search(ifolder->search, expression, NULL, ex);
+	matches = camel_folder_search_search(ifolder->search, expression, NULL, error);
 
 	g_mutex_unlock (ifolder->search_lock);
 
diff --git a/camel/providers/imapx/camel-imapx-folder.h b/camel/providers/imapx/camel-imapx-folder.h
index 1ac0b18..63001c3 100644
--- a/camel/providers/imapx/camel-imapx-folder.h
+++ b/camel/providers/imapx/camel-imapx-folder.h
@@ -78,10 +78,10 @@ GType		camel_imapx_folder_get_type	(void);
 CamelFolder *	camel_imapx_folder_new		(CamelStore *parent,
 						 const gchar *path,
 						 const gchar *raw,
-						 CamelException *ex);
+						 GError **error);
 gchar *		imapx_get_filename		(CamelFolder *folder,
 						 const gchar *uid,
-						 CamelException *ex);
+						 GError **error);
 
 G_END_DECLS
 
diff --git a/camel/providers/imapx/camel-imapx-provider.c b/camel/providers/imapx/camel-imapx-provider.c
index b400892..1c5b71a 100644
--- a/camel/providers/imapx/camel-imapx-provider.c
+++ b/camel/providers/imapx/camel-imapx-provider.c
@@ -115,7 +115,6 @@ CamelServiceAuthType camel_imapx_password_authtype = {
 
 void camel_imapx_module_init(void);
 
-extern void camel_exception_setup(void);
 extern void imapx_utils_init(void);
 
 void
@@ -129,7 +128,6 @@ camel_imapx_module_init(void)
 	imapx_provider.translation_domain = GETTEXT_PACKAGE;
 
 	/* TEMPORARY */
-	camel_exception_setup();
 	imapx_utils_init();
 
 	camel_provider_register(&imapx_provider);
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 6865452..e607b3c 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -21,7 +21,6 @@
 #endif
 
 #include "camel-imapx-utils.h"
-#include "camel-imapx-exception.h"
 #include "camel-imapx-stream.h"
 #include "camel-imapx-server.h"
 #include "camel-imapx-folder.h"
@@ -36,8 +35,6 @@
 #define c(x) camel_imapx_debug(command, x)
 #define e(x) camel_imapx_debug(extra, x)
 
-#define CFS_CLASS(x) ((CamelFolderSummaryClass *)((CamelObject *)x)->klass)
-
 #define CIF(x) ((CamelIMAPXFolder *)x)
 
 #define QUEUE_LOCK(x) (g_static_rec_mutex_lock(&(x)->queue_lock))
@@ -80,8 +77,8 @@ static guint signals[LAST_SIGNAL];
 void imapx_uidset_init(struct _uidset_state *ss, gint total, gint limit);
 gint imapx_uidset_done(struct _uidset_state *ss, struct _CamelIMAPXCommand *ic);
 gint imapx_uidset_add(struct _uidset_state *ss, struct _CamelIMAPXCommand *ic, const gchar *uid);
-static gboolean imapx_command_idle_stop (CamelIMAPXServer *is, CamelException *ex);
-static gint imapx_continuation(CamelIMAPXServer *imap, CamelException *ex, gboolean litplus);
+static gboolean imapx_command_idle_stop (CamelIMAPXServer *is, GError **error);
+static gint imapx_continuation(CamelIMAPXServer *imap, gboolean litplus, GError **error);
 static gboolean imapx_disconnect (CamelIMAPXServer *is);
 static gint imapx_uid_cmp(gconstpointer ap, gconstpointer bp, gpointer data);
 
@@ -131,7 +128,7 @@ struct _CamelIMAPXCommand {
 
 	/* If exception is set, it means we were not able to parse above status, it might be
 	   because user cancelled the operation or io error */
-	CamelException *ex;
+	GError *error;
 
 	guint32 tag;
 
@@ -216,7 +213,7 @@ typedef struct _CamelIMAPXJob CamelIMAPXJob;
 struct _CamelIMAPXJob {
 	CamelMsg msg;
 
-	CamelException *ex;
+	GError *error;
 
 	void (*start)(CamelIMAPXServer *is, struct _CamelIMAPXJob *job);
 
@@ -297,12 +294,12 @@ struct _CamelIMAPXJob {
 };
 
 static void imapx_job_done (CamelIMAPXServer *is, CamelIMAPXJob *job);
-static void imapx_run_job (CamelIMAPXServer *is, CamelIMAPXJob *job);
+static gboolean imapx_run_job (CamelIMAPXServer *is, CamelIMAPXJob *job, GError **error);
 static void imapx_job_fetch_new_messages_start (CamelIMAPXServer *is, CamelIMAPXJob *job);
 static void imapx_command_copy_messages_step_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic);
 static gint imapx_refresh_info_uid_cmp(gconstpointer ap, gconstpointer bp);
 static gint imapx_uids_array_cmp (gconstpointer ap, gconstpointer bp);
-static void imapx_server_sync_changes(CamelIMAPXServer *is, CamelFolder *folder, gint pri, CamelException *ex);
+static gboolean imapx_server_sync_changes(CamelIMAPXServer *is, CamelFolder *folder, gint pri, GError **error);
 
 enum _idle_state {
 	IMAPX_IDLE_OFF,
@@ -332,8 +329,8 @@ static gboolean imapx_idle_supported (CamelIMAPXServer *is);
 static void imapx_start_idle (CamelIMAPXServer *is);
 static void imapx_exit_idle (CamelIMAPXServer *is);
 static void imapx_init_idle (CamelIMAPXServer *is);
-static gboolean imapx_stop_idle (CamelIMAPXServer *is, CamelException *ex);
-static void camel_imapx_server_idle (CamelIMAPXServer *is, CamelFolder *folder, CamelException *ex);
+static gboolean imapx_stop_idle (CamelIMAPXServer *is, GError **error);
+static gboolean camel_imapx_server_idle (CamelIMAPXServer *is, CamelFolder *folder, GError **error);
 
 enum {
 	USE_SSL_NEVER,
@@ -344,7 +341,7 @@ enum {
 #define SSL_PORT_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_SSL2 | CAMEL_TCP_STREAM_SSL_ENABLE_SSL3)
 #define STARTTLS_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_TLS)
 
-static void imapx_select(CamelIMAPXServer *is, CamelFolder *folder, gboolean force, CamelException *ex);
+static gboolean imapx_select(CamelIMAPXServer *is, CamelFolder *folder, gboolean force, GError **error);
 
 G_DEFINE_TYPE (CamelIMAPXServer, camel_imapx_server, CAMEL_TYPE_OBJECT)
 
@@ -446,11 +443,11 @@ imapx_command_add_part(CamelIMAPXCommand *ic, camel_imapx_command_part_t type, g
 		/* TODO: seekable streams we could just seek to the end and back */
 		null = (CamelStreamNull *)camel_stream_null_new();
 		if ( (type & CAMEL_IMAPX_COMMAND_MASK) == CAMEL_IMAPX_COMMAND_DATAWRAPPER) {
-			camel_data_wrapper_write_to_stream((CamelDataWrapper *)ob, (CamelStream *)null);
+			camel_data_wrapper_write_to_stream((CamelDataWrapper *)ob, (CamelStream *)null, NULL);
 		} else {
-			camel_stream_reset((CamelStream *)ob);
-			camel_stream_write_to_stream((CamelStream *)ob, (CamelStream *)null);
-			camel_stream_reset((CamelStream *)ob);
+			camel_stream_reset((CamelStream *)ob, NULL);
+			camel_stream_write_to_stream((CamelStream *)ob, (CamelStream *)null, NULL);
+			camel_stream_reset((CamelStream *)ob, NULL);
 		}
 		type |= CAMEL_IMAPX_COMMAND_LITERAL_PLUS;
 		g_object_ref (ob);
@@ -472,7 +469,7 @@ imapx_command_add_part(CamelIMAPXCommand *ic, camel_imapx_command_part_t type, g
 		gchar *path = o;
 		struct stat st;
 
-		if (stat(path, &st) == 0) {
+		if (g_stat(path, &st) == 0) {
 			o = g_strdup(o);
 			ob_size = st.st_size;
 		} else
@@ -511,7 +508,7 @@ imapx_command_add_part(CamelIMAPXCommand *ic, camel_imapx_command_part_t type, g
 	memcpy(cp->data, byte_array->data, cp->data_size);
 	cp->data[cp->data_size] = 0;
 
-	camel_stream_reset((CamelStream *)ic->mem);
+	camel_stream_reset((CamelStream *)ic->mem, NULL);
 	/* FIXME: hackish? */
 	g_byte_array_set_size(byte_array, 0);
 
@@ -543,7 +540,6 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
 	CamelStore *parent_store;
 	gchar *fname = NULL, *encoded = NULL;
 	const gchar *full_name;
-	CamelException ex = CAMEL_EXCEPTION_INITIALISER;
 
 	c(printf("adding command, fmt = '%s'\n", fmt));
 
@@ -553,11 +549,11 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
 		switch (c) {
 		case '%':
 			if (*p == '%') {
-				camel_stream_write((CamelStream *)ic->mem, ps, p-ps);
+				camel_stream_write((CamelStream *)ic->mem, ps, p-ps, NULL);
 				p++;
 				ps = p;
 			} else {
-				camel_stream_write((CamelStream *)ic->mem, ps, p-ps-1);
+				camel_stream_write((CamelStream *)ic->mem, ps, p-ps-1, NULL);
 				start = p-1;
 				width = 0;
 				left = FALSE;
@@ -610,7 +606,7 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
 					break;
 				case 't': /* token */
 					s = va_arg(ap, gchar *);
-					camel_stream_write((CamelStream *)ic->mem, s, strlen(s));
+					camel_stream_write((CamelStream *)ic->mem, s, strlen(s), NULL);
 					break;
 				case 's': /* simple string */
 					s = va_arg(ap, gchar *);
@@ -620,27 +616,27 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
 						guchar mask = imapx_is_mask(s);
 
 						if (mask & IMAPX_TYPE_ATOM_CHAR)
-							camel_stream_write((CamelStream *)ic->mem, s, strlen(s));
+							camel_stream_write((CamelStream *)ic->mem, s, strlen(s), NULL);
 						else if (mask & IMAPX_TYPE_TEXT_CHAR) {
-							camel_stream_write((CamelStream *)ic->mem, "\"", 1);
+							camel_stream_write((CamelStream *)ic->mem, "\"", 1, NULL);
 							while (*s) {
 								gchar *start = s;
 
 								while (*s && imapx_is_quoted_char(*s))
 									s++;
-								camel_stream_write((CamelStream *)ic->mem, start, s-start);
+								camel_stream_write((CamelStream *)ic->mem, start, s-start, NULL);
 								if (*s) {
-									camel_stream_write((CamelStream *)ic->mem, "\\", 1);
-									camel_stream_write((CamelStream *)ic->mem, s, 1);
+									camel_stream_write((CamelStream *)ic->mem, "\\", 1, NULL);
+									camel_stream_write((CamelStream *)ic->mem, s, 1, NULL);
 									s++;
 								}
 							}
-							camel_stream_write((CamelStream *)ic->mem, "\"", 1);
+							camel_stream_write((CamelStream *)ic->mem, "\"", 1, NULL);
 						} else {
 							imapx_command_add_part(ic, CAMEL_IMAPX_COMMAND_STRING, s);
 						}
 					} else {
-						camel_stream_write((CamelStream *)ic->mem, "\"\"", 2);
+						camel_stream_write((CamelStream *)ic->mem, "\"\"", 2, NULL);
 					}
 					if (encoded) {
 						g_free(encoded);
@@ -663,18 +659,18 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
 						s = encoded;
 						goto output_string;
 					} else 
-						camel_stream_write((CamelStream *)ic->mem, "\"\"", 2);
+						camel_stream_write((CamelStream *)ic->mem, "\"\"", 2, NULL);
 
 					break;
 				case 'F': /* IMAP flags set */
 					f = va_arg(ap, guint32);
 					F = va_arg(ap, CamelFlag *);
-					imapx_write_flags((CamelStream *)ic->mem, f, F, &ex);
+					imapx_write_flags((CamelStream *)ic->mem, f, F, NULL);
 					break;
 				case 'c':
 					d = va_arg(ap, gint);
 					ch = d;
-					camel_stream_write((CamelStream *)ic->mem, &ch, 1);
+					camel_stream_write((CamelStream *)ic->mem, &ch, 1, NULL);
 					break;
 				case 'd': /* int/unsigned */
 				case 'u':
@@ -701,14 +697,14 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
 			c = *p;
 			if (c) {
 				g_assert(c == '\\');
-				camel_stream_write((CamelStream *)ic->mem, ps, p-ps);
+				camel_stream_write((CamelStream *)ic->mem, ps, p-ps, NULL);
 				p++;
 				ps = p;
 			}
 		}
 	}
 
-	camel_stream_write((CamelStream *)ic->mem, ps, p-ps-1);
+	camel_stream_write((CamelStream *)ic->mem, ps, p-ps-1, NULL);
 }
 
 CamelIMAPXCommand *
@@ -725,7 +721,6 @@ camel_imapx_command_new(CamelIMAPXServer *is, const gchar *name, CamelFolder *se
 	ic->select = select;
 	ic->is = is;
 	camel_dlist_init(&ic->parts);
-	ic->ex = camel_exception_new ();
 
 	if (fmt && fmt[0]) {
 		va_start(ap, fmt);
@@ -777,7 +772,10 @@ camel_imapx_command_free(CamelIMAPXCommand *ic)
 		g_free(cp);
 	}
 
-	camel_exception_free (ic->ex);
+	/* Do NOT try to free the GError.  If set it should have been
+	 * propagated to the CamelIMAPXJob, so it's either NULL or the
+	 * CamelIMAPXJob owns it now. */
+
 	g_free(ic);
 }
 
@@ -821,7 +819,9 @@ imapx_command_start (CamelIMAPXServer *imap, CamelIMAPXCommand *ic)
 
 	c(printf("Starting command (active=%d,%s) %c%05u %s\r\n", camel_dlist_length(&imap->active), imap->literal?" literal":"", imap->tagprefix, ic->tag, cp->data));
 	if (!imap->stream || camel_stream_printf((CamelStream *)imap->stream, "%c%05u %s\r\n", imap->tagprefix, ic->tag, cp->data) == -1) {
-		camel_exception_set (ic->ex, 1, "Failed to issue the command");
+		g_set_error (
+			&ic->error, CAMEL_IMAPX_ERROR, 1,
+			"Failed to issue the command");
 	err:
 		g_static_rec_mutex_unlock (&imap->ostream_lock);
 
@@ -833,8 +833,7 @@ imapx_command_start (CamelIMAPXServer *imap, CamelIMAPXCommand *ic)
 	while (imap->literal == ic &&
 	       ic->current->type & CAMEL_IMAPX_COMMAND_LITERAL_PLUS) {
 		/* Sent LITERAL+ continuation immediately */
-		imapx_continuation(imap, ic->ex, TRUE);
-		if (camel_exception_is_set(ic->ex))
+		if (!imapx_continuation(imap, TRUE, &ic->error))
 			goto err;
 	}
 
@@ -862,7 +861,7 @@ imapx_command_start (CamelIMAPXServer *imap, CamelIMAPXCommand *ic)
 	must have QUEUE lock */
 
 static void
-imapx_command_start_next(CamelIMAPXServer *is, CamelException *ex)
+imapx_command_start_next(CamelIMAPXServer *is, GError **error)
 {
 	CamelIMAPXCommand *ic, *nc;
 	gint count = 0;
@@ -905,7 +904,7 @@ imapx_command_start_next(CamelIMAPXServer *is, CamelException *ex)
 			/* if imapx_stop_idle() returns FALSE, it was only
 			   pending and we can go ahead and send a new command
 			   immediately. If it returns TRUE, we must wait. */
-			if (imapx_stop_idle (is, ex)) {
+			if (imapx_stop_idle (is, error)) {
 				c(printf ("waiting for idle to stop \n"));
 				return;
 			}
@@ -971,7 +970,7 @@ imapx_command_start_next(CamelIMAPXServer *is, CamelException *ex)
 	if (ic->select) {
 		c(printf("Selecting folder '%s' for command '%s'(%p)\n",
 			 camel_folder_get_full_name(ic->select), ic->name, ic));
-		imapx_select(is, ic->select, FALSE, ex);
+		imapx_select(is, ic->select, FALSE, error);
 	} else {
 		pri = ic->pri;
 		nc = ic->next;
@@ -1017,7 +1016,9 @@ imapx_command_queue(CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 
 	if (is->state == IMAPX_SHUTDOWN) {
 		c(printf("refuse to queue job on disconnected server\n"));
-		camel_exception_set(ic->ex, 1, "Server disconnected");
+		g_set_error (
+			&ic->error, CAMEL_IMAPX_ERROR, 1,
+			"Server disconnected");
 		QUEUE_UNLOCK(is);
 		if (ic->complete)
 			ic->complete(is, ic);
@@ -1182,7 +1183,7 @@ imapx_expunge_uid_from_summary(CamelIMAPXServer *imap, gchar *uid, gboolean unso
 
 /* handle any untagged responses */
 static gint
-imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
+imapx_untagged(CamelIMAPXServer *imap, GError **error)
 {
 	guint id, len;
 	guchar *token, *p, c;
@@ -1192,17 +1193,21 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
 
 	e(printf("got untagged response\n"));
 	id = 0;
-	tok = camel_imapx_stream_token(imap->stream, &token, &len, ex);
-	if (camel_exception_is_set (ex))
+	tok = camel_imapx_stream_token(imap->stream, &token, &len, error);
+	if (tok < 0)
 		return -1;
 
 	if (tok == IMAPX_TOK_INT) {
 		id = strtoul((gchar *) token, NULL, 10);
-		tok = camel_imapx_stream_token(imap->stream, &token, &len, ex);
+		tok = camel_imapx_stream_token(imap->stream, &token, &len, error);
+		if (tok < 0)
+			return -1;
 	}
 
 	if (tok == '\n') {
-		camel_exception_set (ex, 1, "truncated server response");
+		g_set_error (
+			error, CAMEL_IMAPX_ERROR, 1,
+			"truncated server response");
 		return -1;
 	}
 
@@ -1215,7 +1220,9 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
 	case IMAPX_CAPABILITY:
 		if (imap->cinfo)
 			imapx_free_capability(imap->cinfo);
-		imap->cinfo = imapx_parse_capability(imap->stream, ex);
+		imap->cinfo = imapx_parse_capability(imap->stream, error);
+		if (imap->cinfo == NULL)
+			return -1;
 		c(printf("got capability flags %08x\n", imap->cinfo->capa));
 		return 0;
 	case IMAPX_EXPUNGE: {
@@ -1247,22 +1254,22 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
 		guchar *token;
 		gint tok;
 
-		tok = camel_imapx_stream_token (imap->stream, &token, &len, ex);
-		if (camel_exception_is_set(ex))
+		tok = camel_imapx_stream_token (imap->stream, &token, &len, error);
+		if (tok < 0)
 			return -1;
 		if (tok == '(') {
 			unsolicited = FALSE;
 			while (tok != ')') {
 				/* We expect this to be 'EARLIER' */
-				tok = camel_imapx_stream_token(imap->stream, &token, &len, ex);
-				if (camel_exception_is_set(ex))
+				tok = camel_imapx_stream_token(imap->stream, &token, &len, error);
+				if (tok < 0)
 					return -1;
 			}
 		} else
 			camel_imapx_stream_ungettoken(imap->stream, tok, token, len);
 
-		uids = imapx_parse_uids(imap->stream, ex);
-		if (camel_exception_is_set(ex))
+		uids = imapx_parse_uids(imap->stream, error);
+		if (uids == NULL)
 			return -1;
 		for (i = 0; i < uids->len; i++) {
 			gchar *uid = g_strdup_printf("%u", GPOINTER_TO_UINT(g_ptr_array_index (uids, i)));
@@ -1275,7 +1282,7 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
 	case IMAPX_NAMESPACE: {
 		CamelIMAPXNamespaceList *nsl = NULL;
 
-		nsl = imapx_parse_namespace_list (imap->stream, ex);
+		nsl = imapx_parse_namespace_list (imap->stream, error);
 		if (nsl != NULL) {
 			CamelIMAPXStore *imapx_store = (CamelIMAPXStore *) imap->store;
 			CamelIMAPXStoreNamespace *ns;
@@ -1300,14 +1307,14 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
 
 		if (imapx_idle_supported (imap) && imapx_in_idle (imap)) {
 			if (camel_folder_summary_count (imap->select_folder->summary) < id)
-				imapx_stop_idle (imap, ex);
+				imapx_stop_idle (imap, error);
 		}
 
 		break;
 	case IMAPX_FLAGS: {
 		guint32 flags;
 
-		imapx_parse_flags(imap->stream, &flags, NULL, ex);
+		imapx_parse_flags(imap->stream, &flags, NULL, error);
 
 		c(printf("flags: %08x\n", flags));
 		break;
@@ -1315,8 +1322,8 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
 	case IMAPX_FETCH: {
 		struct _fetch_info *finfo;
 
-		finfo = imapx_parse_fetch(imap->stream, ex);
-		if (camel_exception_is_set (ex)) {
+		finfo = imapx_parse_fetch(imap->stream, error);
+		if (finfo == NULL) {
 			imapx_free_fetch(finfo);
 			return -1;
 		}
@@ -1327,15 +1334,17 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
 			/* This must've been a get-message request, fill out the body stream,
 			   in the right spot */
 
-			if (job && !camel_exception_is_set (job->ex)) {
+			if (job && job->error == NULL) {
 				if (job->u.get_message.use_multi_fetch) {
 					job->u.get_message.body_offset = finfo->offset;
-					camel_seekable_stream_seek((CamelSeekableStream *)job->u.get_message.stream, finfo->offset, CAMEL_STREAM_SET);
+					camel_seekable_stream_seek((CamelSeekableStream *)job->u.get_message.stream, finfo->offset, CAMEL_STREAM_SET, NULL);
 				}
 
-				job->u.get_message.body_len = camel_stream_write_to_stream(finfo->body, job->u.get_message.stream);
+				job->u.get_message.body_len = camel_stream_write_to_stream(finfo->body, job->u.get_message.stream, &job->error);
 				if (job->u.get_message.body_len == -1)
-					camel_exception_setv(job->ex, 1, "error writing to cache stream: %s\n", g_strerror(errno));
+					g_prefix_error (
+						&job->error,
+						_("Error writing to cache stream: "));
 			}
 		}
 
@@ -1421,7 +1430,7 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
 				/* Do we want to save these headers for later too?  Do we care? */
 
 				mp = camel_mime_parser_new();
-				camel_mime_parser_init_with_stream(mp, finfo->header);
+				camel_mime_parser_init_with_stream(mp, finfo->header, NULL);
 				mi = camel_folder_summary_info_new_from_parser(job->folder->summary, mp);
 				g_object_unref (mp);
 
@@ -1507,7 +1516,7 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
 	case IMAPX_LSUB:
 		lsub = TRUE;
 	case IMAPX_LIST: {
-		struct _list_info *linfo = imapx_parse_list(imap->stream, ex);
+		struct _list_info *linfo = imapx_parse_list(imap->stream, error);
 		CamelIMAPXJob *job = imapx_match_active_job(imap, IMAPX_JOB_LIST, linfo->name);
 
 		// TODO: we want to make sure the names match?
@@ -1534,7 +1543,7 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
 		imap->recent = id;
 		break;
 	case IMAPX_STATUS: {
-		struct _state_info *sinfo = imapx_parse_status_info (imap->stream, ex);
+		struct _state_info *sinfo = imapx_parse_status_info (imap->stream, error);
 		if (sinfo) {
 			CamelIMAPXStoreSummary *s = ((CamelIMAPXStore *)imap->store)->summary;
 			CamelIMAPXStoreNamespace *ns;
@@ -1547,7 +1556,7 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
 				path_name = camel_imapx_store_summary_full_to_path(s, sinfo->name, ns->sep);
 				c(printf("Got folder path '%s' for full '%s'\n", path_name, sinfo->name));
 				if (path_name) {
-					ifolder = (void *)camel_store_get_folder(imap->store, path_name, 0, ex);
+					ifolder = (void *)camel_store_get_folder(imap->store, path_name, 0, error);
 					g_free (path_name);
 				}
 			}
@@ -1569,10 +1578,11 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
 	case IMAPX_BYE: {
 		guchar *token;
 
-		camel_imapx_stream_text (imap->stream, &token, ex);
-		if (!camel_exception_is_set(ex)) {
+		if (!camel_imapx_stream_text (imap->stream, &token, NULL)) {
 			c(printf("BYE: %s\n", token));
-			camel_exception_setv(ex, 1, "IMAP server said BYE: %s", token);
+			g_set_error (
+				error, CAMEL_IMAPX_ERROR, 1,
+				"IMAP server said BYE: %s", token);
 		}
 		imap->state = IMAPX_SHUTDOWN;
 		return -1;
@@ -1586,8 +1596,8 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
 		/* TODO: validate which ones of these can happen as unsolicited responses */
 		/* TODO: handle bye/preauth differently */
 		camel_imapx_stream_ungettoken(imap->stream, tok, token, len);
-		sinfo = imapx_parse_status(imap->stream, ex);
-		if (camel_exception_is_set(ex))
+		sinfo = imapx_parse_status(imap->stream, error);
+		if (sinfo == NULL)
 			return -1;
 		switch (sinfo->condition) {
 		case IMAPX_CLOSED:
@@ -1645,13 +1655,13 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
 		c(printf("unknown token: %s\n", token));
 	}
 
-	return camel_imapx_stream_skip(imap->stream, ex);
+	return camel_imapx_stream_skip(imap->stream, error);
 }
 
 /* handle any continuation requests
    either data continuations, or auth continuation */
 static gint
-imapx_continuation(CamelIMAPXServer *imap, CamelException *ex, gboolean litplus)
+imapx_continuation(CamelIMAPXServer *imap, gboolean litplus, GError **error)
 {
 	CamelIMAPXCommand *ic, *newliteral = NULL;
 	CamelIMAPXCommandPart *cp;
@@ -1661,7 +1671,7 @@ imapx_continuation(CamelIMAPXServer *imap, CamelException *ex, gboolean litplus)
 	   ohter lock here.  All other writes go through
 	   queue-lock */
 	if (imapx_idle_supported (imap) && imapx_in_idle (imap)) {
-		camel_imapx_stream_skip (imap->stream, ex);
+		camel_imapx_stream_skip (imap->stream, error);
 
 		c(printf("Got continuation response for IDLE \n"));
 		IDLE_LOCK(imap->idle);
@@ -1672,7 +1682,7 @@ imapx_continuation(CamelIMAPXServer *imap, CamelException *ex, gboolean litplus)
 			/* IDLE got cancelled after we sent the command, while
 			   we were waiting for this continuation. Send DONE
 			   immediately. */
-			imapx_command_idle_stop(imap, ex);
+			imapx_command_idle_stop(imap, error);
 			imap->idle->state = IMAPX_IDLE_OFF;
 		} else {
 			c(printf("idle starts in wrong state %d\n",
@@ -1682,7 +1692,7 @@ imapx_continuation(CamelIMAPXServer *imap, CamelException *ex, gboolean litplus)
 
 		QUEUE_LOCK(imap);
 		imap->literal = NULL;
-		imapx_command_start_next(imap, ex);
+		imapx_command_start_next(imap, error);
 		QUEUE_UNLOCK(imap);
 
 		return 1;
@@ -1691,7 +1701,7 @@ imapx_continuation(CamelIMAPXServer *imap, CamelException *ex, gboolean litplus)
 	ic = imap->literal;
 	if (!litplus) {
 		if (ic == NULL) {
-			camel_imapx_stream_skip(imap->stream, ex);
+			camel_imapx_stream_skip(imap->stream, error);
 			c(printf("got continuation response with no outstanding continuation requests?\n"));
 			return 1;
 		}
@@ -1704,31 +1714,26 @@ imapx_continuation(CamelIMAPXServer *imap, CamelException *ex, gboolean litplus)
 	switch (cp->type & CAMEL_IMAPX_COMMAND_MASK) {
 	case CAMEL_IMAPX_COMMAND_DATAWRAPPER:
 		c(printf("writing data wrapper to literal\n"));
-		camel_data_wrapper_write_to_stream((CamelDataWrapper *)cp->ob, (CamelStream *)imap->stream);
+		camel_data_wrapper_write_to_stream((CamelDataWrapper *)cp->ob, (CamelStream *)imap->stream, NULL);
 		break;
 	case CAMEL_IMAPX_COMMAND_STREAM:
 		c(printf("writing stream to literal\n"));
-		camel_stream_write_to_stream((CamelStream *)cp->ob, (CamelStream *)imap->stream);
+		camel_stream_write_to_stream((CamelStream *)cp->ob, (CamelStream *)imap->stream, NULL);
 		break;
 	case CAMEL_IMAPX_COMMAND_AUTH: {
 		gchar *resp;
 		guchar *token;
 
-		camel_imapx_stream_text (imap->stream, &token, ex);
-		if (camel_exception_is_set(ex))
+		if (!camel_imapx_stream_text (imap->stream, &token, error))
 			return -1;
 		    
-		resp = camel_sasl_challenge_base64((CamelSasl *)cp->ob, (const gchar *) token, ex);
+		resp = camel_sasl_challenge_base64((CamelSasl *)cp->ob, (const gchar *) token, error);
 		g_free(token);
-		if (camel_exception_is_set(ex))
-			return -1;
-		if (!resp) {
-			camel_exception_set (ex, 1, "Authentication mechanism failed");
+		if (resp == NULL)
 			return -1;
-		}
 		c(printf("got auth continuation, feeding token '%s' back to auth mech\n", resp));
 
-		camel_stream_write((CamelStream *)imap->stream, resp, strlen(resp));
+		camel_stream_write((CamelStream *)imap->stream, resp, strlen(resp), NULL);
 		g_free(resp);
 		/* we want to keep getting called until we get a status reponse from the server
 		   ignore what sasl tells us */
@@ -1742,25 +1747,27 @@ imapx_continuation(CamelIMAPXServer *imap, CamelException *ex, gboolean litplus)
 		c(printf("writing file '%s' to literal\n", (gchar *)cp->ob));
 
 		// FIXME: errors
-		if (cp->ob && (file = camel_stream_fs_new_with_name(cp->ob, O_RDONLY, 0))) {
-			camel_stream_write_to_stream(file, (CamelStream *)imap->stream);
+		if (cp->ob && (file = camel_stream_fs_new_with_name(cp->ob, O_RDONLY, 0, NULL))) {
+			camel_stream_write_to_stream(file, (CamelStream *)imap->stream, NULL);
 			g_object_unref (file);
 		} else if (cp->ob_size > 0) {
 			// Server is expecting data ... ummm, send it zeros?  abort?
 		}
 		break; }
 	case CAMEL_IMAPX_COMMAND_STRING:
-		camel_stream_write((CamelStream *)imap->stream, cp->ob, cp->ob_size);
+		camel_stream_write((CamelStream *)imap->stream, cp->ob, cp->ob_size, NULL);
 		break;
 	default:
 		/* should we just ignore? */
 		imap->literal = NULL;
-		camel_exception_set (ex, 1, "continuation response for non-continuation request");
+		g_set_error (
+			error, CAMEL_IMAPX_ERROR, 1,
+			"continuation response for non-continuation request");
 		return -1;
 	}
 
 	if (!litplus)
-		camel_imapx_stream_skip(imap->stream, ex);
+		camel_imapx_stream_skip(imap->stream, error);
  noskip:
 	cp = cp->next;
 	if (cp->next) {
@@ -1781,7 +1788,7 @@ imapx_continuation(CamelIMAPXServer *imap, CamelException *ex, gboolean litplus)
 	imap->literal = newliteral;
 
 	if (!litplus)
-		imapx_command_start_next(imap, ex);
+		imapx_command_start_next(imap, error);
 	QUEUE_UNLOCK(imap);
 
 	return 1;
@@ -1789,13 +1796,15 @@ imapx_continuation(CamelIMAPXServer *imap, CamelException *ex, gboolean litplus)
 
 /* handle a completion line */
 static gint
-imapx_completion(CamelIMAPXServer *imap, guchar *token, gint len, CamelException *ex)
+imapx_completion(CamelIMAPXServer *imap, guchar *token, gint len, GError **error)
 {
 	CamelIMAPXCommand *ic;
 	guint tag;
 
 	if (token[0] != imap->tagprefix) {
-		camel_exception_setv (ex, 1, "Server sent unexpected response: %s", token);
+		g_set_error (
+			error, CAMEL_IMAPX_ERROR, 1,
+			"Server sent unexpected response: %s", token);
 
 		return -1;
 	}
@@ -1803,7 +1812,9 @@ imapx_completion(CamelIMAPXServer *imap, guchar *token, gint len, CamelException
 	tag = strtoul( (const gchar *)token+1, NULL, 10);
 
 	if ((ic = imapx_find_command_tag(imap, tag)) == NULL) {
-		camel_exception_setv (ex, 1, "got response tag unexpectedly: %s", token);
+		g_set_error (
+			error, CAMEL_IMAPX_ERROR, 1,
+			"got response tag unexpectedly: %s", token);
 
 		return -1;
 	}
@@ -1839,57 +1850,55 @@ imapx_completion(CamelIMAPXServer *imap, guchar *token, gint len, CamelException
 
 	if (ic->current->next->next) {
 		QUEUE_UNLOCK(imap);
-		camel_exception_setv (ex, 1, "command still has unsent parts? %s", ic->name);
+		g_set_error (
+			error, CAMEL_IMAPX_ERROR, 1,
+			"command still has unsent parts? %s", ic->name);
 
 		return -1;
 	}
 
-	/* A follow-on command might've already queued a new literal since were were done with ours? */
-//	if (imap->literal != NULL) {
-//		QUEUE_UNLOCK(imap);
-//		camel_exception_throw(1, "command still has outstanding continuation", imap->literal->name);
-//	}
-
 	camel_dlist_remove ((CamelDListNode *) ic);
 	QUEUE_UNLOCK(imap);
 
-	ic->status = imapx_parse_status(imap->stream, ex);
+	ic->status = imapx_parse_status(imap->stream, error);
 
 	if (ic->complete)
 		ic->complete (imap, ic);
 
 	QUEUE_LOCK(imap);
-	imapx_command_start_next(imap, ex);
+	imapx_command_start_next(imap, error);
 	QUEUE_UNLOCK(imap);
 
 	return 1;
 }
 
 static void
-imapx_step(CamelIMAPXServer *is, CamelException *ex)
+imapx_step(CamelIMAPXServer *is, GError **error)
 {
 	guint len;
 	guchar *token;
 	gint tok;
 
 	// poll ?  wait for other stuff? loop?
-	tok = camel_imapx_stream_token (is->stream, &token, &len, ex);
-	if (camel_exception_is_set (ex))
+	tok = camel_imapx_stream_token (is->stream, &token, &len, error);
+	if (tok < 0)
 		return;
 
 	if (tok == '*')
-		imapx_untagged (is, ex);
+		imapx_untagged (is, error);
 	else if (tok == IMAPX_TOK_TOKEN)
-		imapx_completion (is, token, len, ex);
+		imapx_completion (is, token, len, error);
 	else if (tok == '+')
-		imapx_continuation (is, ex, FALSE);
+		imapx_continuation (is, FALSE, error);
 	else
-		camel_exception_set (ex, 1, "unexpected server response:");
+		g_set_error (
+			error, CAMEL_IMAPX_ERROR, 1,
+			"unexpected server response:");
 }
 
 /* Used to run 1 command synchronously,
    use for capa, login, and namespaces only. */
-static void
+static gboolean
 imapx_command_run (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 /* throws IO,PARSE exception */
 {
@@ -1899,8 +1908,8 @@ imapx_command_run (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 	imapx_command_start(is, ic);
 	QUEUE_UNLOCK(is);
 
-	while (ic->status == NULL && !camel_exception_is_set (ic->ex))
-		imapx_step(is, ic->ex);
+	while (ic->status == NULL && ic->error == NULL)
+		imapx_step(is, &ic->error);
 	
 	if (is->literal == ic)
 		is->literal = NULL;
@@ -1908,6 +1917,8 @@ imapx_command_run (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 	QUEUE_LOCK(is);
 	camel_dlist_remove((CamelDListNode *)ic);
 	QUEUE_UNLOCK(is);
+
+	return (ic->error == NULL);
 }
 
 static void
@@ -1946,14 +1957,16 @@ imapx_job_done (CamelIMAPXServer *is, CamelIMAPXJob *job)
 	QUEUE_UNLOCK (is);
 
 	if (job->noreply) {
-		camel_exception_clear(job->ex);
+		g_clear_error (&job->error);
 		g_free(job);
 	} else
 		camel_msgport_reply((CamelMsg *) job);
 }
 
 static gboolean
-imapx_register_job (CamelIMAPXServer *is, CamelIMAPXJob *job)
+imapx_register_job (CamelIMAPXServer *is,
+                    CamelIMAPXJob *job,
+                    GError **error)
 {
 	if (is->state >= IMAPX_INITIALISED) {
 		QUEUE_LOCK (is);
@@ -1962,15 +1975,20 @@ imapx_register_job (CamelIMAPXServer *is, CamelIMAPXJob *job)
 
 	} else {
 		e(printf ("NO connection yet, maybe user cancelled jobs earlier ?"));
-		camel_exception_set (job->ex, CAMEL_EXCEPTION_SERVICE_NOT_CONNECTED, "Not authenticated");
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_NOT_CONNECTED,
+			_("Not authenticated"));
 		return FALSE;
 	}
 
 	return TRUE;
 }
 
-static void
-imapx_run_job (CamelIMAPXServer *is, CamelIMAPXJob *job)
+static gboolean
+imapx_run_job (CamelIMAPXServer *is,
+               CamelIMAPXJob *job,
+               GError **error)
 {
 	CamelMsgPort *reply = NULL;
 
@@ -1990,6 +2008,25 @@ imapx_run_job (CamelIMAPXServer *is, CamelIMAPXJob *job)
 
 		g_assert(completed == (CamelMsg *)job);
 	}
+
+	if (job->error != NULL) {
+		g_propagate_error (error, job->error);
+		job->error = NULL;
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+imapx_submit_job (CamelIMAPXServer *is,
+                  CamelIMAPXJob *job,
+                  GError **error)
+{
+	if (!imapx_register_job (is, job, error))
+		return FALSE;
+
+	return imapx_run_job (is, job, error);
 }
 
 /* ********************************************************************** */
@@ -1998,10 +2035,12 @@ imapx_run_job (CamelIMAPXServer *is, CamelIMAPXJob *job)
 
 /*TODO handle negative cases sanely */
 static gboolean
-imapx_command_idle_stop (CamelIMAPXServer *is, CamelException *ex)
+imapx_command_idle_stop (CamelIMAPXServer *is, GError **error)
 {
 	if (!is->stream || camel_stream_printf((CamelStream *)is->stream, "%s", "DONE\r\n") == -1) {
-		camel_exception_set (ex, 1, "Unable to issue DONE");
+		g_set_error (
+			error, CAMEL_IMAPX_ERROR, 1,
+			"Unable to issue DONE");
 		return FALSE;
 	}
 
@@ -2013,11 +2052,13 @@ imapx_command_idle_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 {
 	CamelIMAPXIdle *idle = is->idle;
 
-	if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
-		if (!camel_exception_is_set (ic->ex))
-			camel_exception_setv(ic->job->ex, 1, "Error performing IDLE: %s", ic->status->text);
+	if (ic->error != NULL || ic->status->result != IMAPX_OK) {
+		if (ic->error == NULL)
+			g_set_error (
+				&ic->job->error, CAMEL_IMAPX_ERROR, 1,
+				"Error performing IDLE: %s", ic->status->text);
 		else
-			camel_exception_xfer (ic->job->ex, ic->ex);
+			g_propagate_error (&ic->job->error, ic->error);
 	}
 
 	IDLE_LOCK (idle);
@@ -2060,50 +2101,56 @@ imapx_job_idle_start(CamelIMAPXServer *is, CamelIMAPXJob *job)
 	QUEUE_UNLOCK (is);
 }
 
-static void
-camel_imapx_server_idle (CamelIMAPXServer *is, CamelFolder *folder, CamelException *ex)
+static gboolean
+camel_imapx_server_idle (CamelIMAPXServer *is, CamelFolder *folder, GError **error)
 {
 	CamelIMAPXJob *job;
+	gboolean success;
 
 	job = g_malloc0 (sizeof(*job));
 	job->type = IMAPX_JOB_IDLE;
 	job->start = imapx_job_idle_start;
 	job->folder = folder;
-	job->ex = ex;
 
-	if (imapx_register_job (is, job))
-		imapx_run_job(is, job);
+	success = imapx_submit_job (is, job, error);
+
 	g_free(job);
+
+	return success;
 }
 
-static void
-imapx_server_fetch_new_messages (CamelIMAPXServer *is, CamelFolder *folder, gboolean async,
-				 gboolean update_unseen, CamelException *ex)
+static gboolean
+imapx_server_fetch_new_messages (CamelIMAPXServer *is,
+                                 CamelFolder *folder,
+                                 gboolean async,
+                                 gboolean update_unseen,
+                                 GError **error)
 {
 	CamelIMAPXJob *job;
+	gboolean success;
 
 	job = g_malloc0(sizeof(*job));
 	job->type = IMAPX_JOB_FETCH_NEW_MESSAGES;
 	job->start = imapx_job_fetch_new_messages_start;
 	job->folder = folder;
 	job->noreply = async;
-	job->ex = ex;
 	job->u.refresh_info.changes = camel_folder_change_info_new();
 	job->u.refresh_info.update_unseen = update_unseen;
 	job->op = camel_operation_registered ();
 
-	if (imapx_register_job (is, job))
-		imapx_run_job (is, job);
+	success = imapx_submit_job (is, job, error);
 
 	if (!async)
 		g_free (job);
+
+	return success;
 }
 
 static gpointer
 imapx_idle_thread (gpointer data)
 {
-	CamelException *ex = camel_exception_new ();
 	CamelIMAPXServer *is = (CamelIMAPXServer *) data;
+	GError *local_error = NULL;
 
 	while (TRUE) {
 		CamelIMAPXFolder *ifolder;
@@ -2123,16 +2170,16 @@ imapx_idle_thread (gpointer data)
 				continue;
 			}
 			IDLE_UNLOCK(is->idle);
-			camel_imapx_server_idle (is, (void *)ifolder, ex);
+			camel_imapx_server_idle (is, (void *)ifolder, &local_error);
 
-			if (!camel_exception_is_set (ex) && ifolder->exists_on_server >
+			if (local_error == NULL && ifolder->exists_on_server >
 			    camel_folder_summary_count (((CamelFolder *) ifolder)->summary) && imapx_is_command_queue_empty (is))
-				imapx_server_fetch_new_messages (is, is->select_folder, TRUE, TRUE, ex);
+				imapx_server_fetch_new_messages (is, is->select_folder, TRUE, TRUE, &local_error);
 
-			if (camel_exception_is_set (ex)) {
-				e(printf ("Caught exception in idle thread:  %s \n", ex->desc));
+			if (local_error != NULL) {
+				e(printf ("Caught exception in idle thread:  %s \n", local_error->message));
 				/* No way to asyncronously notify UI ? */
-				camel_exception_clear (ex);
+				g_clear_error (&local_error);
 			}
 			IDLE_LOCK(is->idle);
 		}
@@ -2144,13 +2191,13 @@ imapx_idle_thread (gpointer data)
 			break;
 	}
 
-	camel_exception_free (ex);
+	g_clear_error (&local_error);
 	is->idle->idle_thread = NULL;
 	return NULL;
 }
 
 static gboolean
-imapx_stop_idle (CamelIMAPXServer *is, CamelException *ex)
+imapx_stop_idle (CamelIMAPXServer *is, GError **error)
 {
 	CamelIMAPXIdle *idle = is->idle;
 	int stopped = FALSE;
@@ -2167,7 +2214,7 @@ imapx_stop_idle (CamelIMAPXServer *is, CamelException *ex)
 		break;
 
 	case IMAPX_IDLE_STARTED:
-		imapx_command_idle_stop (is, ex);
+		imapx_command_idle_stop (is, error);
 		idle->state = IMAPX_IDLE_OFF;
 		stopped = TRUE;
 		c(printf("Stopping idle after %ld seconds\n",
@@ -2269,7 +2316,7 @@ imapx_idle_supported (CamelIMAPXServer *is)
 static void
 imapx_command_select_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 {
-	if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
+	if (ic->error != NULL || ic->status->result != IMAPX_OK) {
 		CamelDList failed;
 		CamelIMAPXCommand *cw, *cn;
 
@@ -2301,13 +2348,14 @@ imapx_command_select_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 			while (cn) {
 				if (ic->status)
 					cw->status = imapx_copy_status(ic->status);
-				if (camel_exception_is_set(ic->ex))
-					camel_exception_xfer (cw->ex, ic->ex);
-				else {
-					camel_exception_setv (cw->ex, 1, "SELECT %s failed: %s",
-							      camel_folder_get_full_name(cw->select),
-							      ic->status->text?:"<unknown reason>");
-				}
+				if (ic->error != NULL)
+					g_propagate_error (&cw->error, ic->error);
+				else
+					g_set_error (
+						&cw->error, CAMEL_IMAPX_ERROR, 1,
+						"SELECT %s failed: %s",
+						camel_folder_get_full_name(cw->select),
+						ic->status->text?:"<unknown reason>");
 				cw->complete(is, cw);
 				cw = cn;
 				cn = cn->next;
@@ -2354,8 +2402,8 @@ imapx_command_select_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 }
 
 /* Should have a queue lock. TODO Change the way select is written */
-static void
-imapx_select (CamelIMAPXServer *is, CamelFolder *folder, gboolean forced, CamelException *ex)
+static gboolean
+imapx_select (CamelIMAPXServer *is, CamelFolder *folder, gboolean forced, GError **error)
 {
 	CamelIMAPXCommand *ic;
 	const gchar *full_name;
@@ -2375,13 +2423,13 @@ imapx_select (CamelIMAPXServer *is, CamelFolder *folder, gboolean forced, CamelE
 	   for another select */
 
 	if (is->select_pending)
-		return;
+		return TRUE;
 
 	if (is->select_folder == folder && !forced)
-		return;
+		return TRUE;
 
 	if (!camel_dlist_empty(&is->active))
-		return;
+		return TRUE;
 
 	is->select_pending = folder;
 	g_object_ref (folder);
@@ -2418,8 +2466,8 @@ imapx_select (CamelIMAPXServer *is, CamelFolder *folder, gboolean forced, CamelE
 		    uid = camel_folder_summary_uid_from_index (folder->summary, 0);
 
 		if (isum->modseq && ifolder->uidvalidity_on_server) {
-			c(printf("SELECT QRESYNC %ld %ld\n", ifolder->uidvalidity_on_server, isum->modseq));
-			camel_imapx_command_add(ic, " (QRESYNC (%ld %ld %s:*", ifolder->uidvalidity_on_server, isum->modseq, uid);
+			c(printf("SELECT QRESYNC %" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT "\n", ifolder->uidvalidity_on_server, isum->modseq));
+			camel_imapx_command_add(ic, " (QRESYNC (%" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " %s:*", ifolder->uidvalidity_on_server, isum->modseq, uid);
 
 			if (total > 10) {
 				int i;
@@ -2469,6 +2517,8 @@ imapx_select (CamelIMAPXServer *is, CamelFolder *folder, gboolean forced, CamelE
 
 	ic->complete = imapx_command_select_done;
 	imapx_command_start (is, ic);
+
+	return TRUE;
 }
 
 #ifndef G_OS_WIN32
@@ -2476,7 +2526,7 @@ imapx_select (CamelIMAPXServer *is, CamelFolder *folder, gboolean forced, CamelE
 /* Using custom commands to connect to IMAP servers is not supported on Win32 */
 
 static gboolean
-connect_to_server_process (CamelIMAPXServer *is, const gchar *cmd, CamelException *ex)
+connect_to_server_process (CamelIMAPXServer *is, const gchar *cmd, GError **error)
 {
 	CamelStream *cmd_stream;
 	gint ret, i = 0;
@@ -2558,12 +2608,16 @@ connect_to_server_process (CamelIMAPXServer *is, const gchar *cmd, CamelExceptio
 
 	if (ret == -1) {
 		if (errno == EINTR)
-			camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
-					     _("Connection cancelled"));
+			g_set_error (
+				error, G_IO_ERROR,
+				G_IO_ERROR_CANCELLED,
+				_("Connection cancelled"));
 		else
-			camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-					      _("Could not connect with command \"%s\": %s"),
-					      full_cmd, g_strerror (errno));
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
+				_("Could not connect with command \"%s\": %s"),
+				full_cmd, g_strerror (errno));
 
 		g_object_unref (cmd_stream);
 		g_free (full_cmd);
@@ -2580,7 +2634,7 @@ connect_to_server_process (CamelIMAPXServer *is, const gchar *cmd, CamelExceptio
 #endif /* !G_OS_WIN32 */
 
 gboolean
-imapx_connect_to_server (CamelIMAPXServer *is, CamelException *ex)
+imapx_connect_to_server (CamelIMAPXServer *is, GError **error)
 {
 	CamelStream * tcp_stream = NULL;
 	gchar *socks_host;
@@ -2598,15 +2652,14 @@ imapx_connect_to_server (CamelIMAPXServer *is, CamelException *ex)
 	const gchar *port = NULL;
 	struct addrinfo *ai, hints = { 0 };
 	CamelIMAPXCommand *ic;
+	GError *local_error = NULL;
 
 #ifndef G_OS_WIN32
 	const gchar *command;
 
 	if (camel_url_get_param(is->url, "use_command") &&
 	    (command = camel_url_get_param(is->url, "command"))) {
-		camel_exception_clear(ex);
-		connect_to_server_process(is, command, ex);
-		if (camel_exception_is_set (ex))
+		if (!connect_to_server_process(is, command, &local_error))
 			goto exit;
 		else
 			goto connected;
@@ -2650,27 +2703,24 @@ imapx_connect_to_server (CamelIMAPXServer *is, CamelException *ex)
 	}
 
 	hints.ai_socktype = SOCK_STREAM;
-	ai = camel_getaddrinfo(is->url->host, serv, &hints, ex);
-	if (ex && ex->id && ex->id != CAMEL_EXCEPTION_USER_CANCEL && port != NULL) {
-		camel_exception_clear(ex);
-		ai = camel_getaddrinfo(is->url->host, port, &hints, ex);
+	ai = camel_getaddrinfo(is->url->host, serv, &hints, &local_error);
+	if (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED) && port != NULL) {
+		g_clear_error (&local_error);
+		ai = camel_getaddrinfo(is->url->host, port, &hints, &local_error);
 	}
 
-	if (ex && ex->id) {
-		e(printf ("Unable to connect %d %s \n", ex->id, ex->desc));
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
 		g_object_unref (tcp_stream);
 		return FALSE;
 	}
 
-	ret = camel_tcp_stream_connect(CAMEL_TCP_STREAM(tcp_stream), ai);
+	ret = camel_tcp_stream_connect(CAMEL_TCP_STREAM(tcp_stream), ai, error);
 	camel_freeaddrinfo(ai);
 	if (ret == -1) {
-		if (errno == EINTR)
-			camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, _("Connection cancelled"));
-		else
-			camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-					_("Could not connect to %s (port %s): %s"),
-					is->url->host, serv, g_strerror(errno));
+		g_prefix_error (
+			error, _("Could not connect to %s (port %s): "),
+			is->url->host, serv);
 		g_object_unref (tcp_stream);
 		return FALSE;
 	}
@@ -2692,25 +2742,24 @@ imapx_connect_to_server (CamelIMAPXServer *is, CamelException *ex)
 	while (1) {
 		// poll ?  wait for other stuff? loop?
 		if (camel_application_is_exiting || is->parser_quit) {
-			camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
-					     "Connection to server cancelled\n");
+			g_set_error (
+				error, G_IO_ERROR,
+				G_IO_ERROR_CANCELLED,
+				"Connection to server cancelled\n");
 			return FALSE;
 		}
 			
-		tok = camel_imapx_stream_token (is->stream, &token, &len, ex);
-		if (camel_exception_is_set (ex)) {
+		tok = camel_imapx_stream_token (is->stream, &token, &len, error);
+		if (tok < 0)
 			return FALSE;
-		}
 
 		if (tok == '*') {
-			imapx_untagged (is, ex);
+			imapx_untagged (is, error);
 			break;
 		}
 		camel_imapx_stream_ungettoken(is->stream, tok, token, len);
-		camel_imapx_stream_text (is->stream, &token, ex);
-		if (camel_exception_is_set (ex)) {
+		if (!camel_imapx_stream_text (is->stream, &token, error))
 			return FALSE;
-		}
 		e(printf("Got unexpected line before greeting:  '%s'\n", token));
 		g_free(token);
 	}
@@ -2719,11 +2768,14 @@ imapx_connect_to_server (CamelIMAPXServer *is, CamelException *ex)
 		ic = camel_imapx_command_new(is, "CAPABILITY", NULL, "CAPABILITY");
 		imapx_command_run(is, ic);
 
-		if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
-			if (!camel_exception_is_set (ic->ex))
-				camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "%s", ic->status->text);
+		if (ic->error != NULL || ic->status->result != IMAPX_OK) {
+			if (ic->error == NULL)
+				g_set_error (
+					error, CAMEL_ERROR,
+					CAMEL_ERROR_GENERIC,
+					"%s", ic->status->text);
 			else
-				camel_exception_xfer (ex, ic->ex);
+				g_propagate_error (error, ic->error);
 
 			camel_imapx_command_free(ic);
 			return FALSE;
@@ -2736,20 +2788,25 @@ imapx_connect_to_server (CamelIMAPXServer *is, CamelException *ex)
 	{
 
 		if (!(is->cinfo->capa & IMAPX_CAPABILITY_STARTTLS)) {
-			camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-					_("Failed to connect to IMAP server %s in secure mode: %s"),
-					is->url->host, _("STARTTLS not supported"));
+			g_set_error (
+				&local_error, CAMEL_ERROR,
+				CAMEL_ERROR_GENERIC,
+				_("Failed to connect to IMAP server %s in secure mode: %s"),
+				is->url->host, _("STARTTLS not supported"));
 			goto exit;
 		}
 
 		ic = camel_imapx_command_new (is, "STARTTLS", NULL, "STARTTLS");
 		imapx_command_run (is, ic);
 
-		if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
-			if (!camel_exception_is_set (ic->ex))
-				camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "%s", ic->status->text);
+		if (ic->error != NULL || ic->status->result != IMAPX_OK) {
+			if (ic->error == NULL)
+				g_set_error (
+					&local_error, CAMEL_ERROR,
+					CAMEL_ERROR_GENERIC,
+					"%s", ic->status->text);
 			else
-				camel_exception_xfer (ex, ic->ex);
+				g_propagate_error (&local_error, ic->error);
 
 			camel_imapx_command_free(ic);
 			goto exit;
@@ -2767,27 +2824,31 @@ imapx_connect_to_server (CamelIMAPXServer *is, CamelException *ex)
 		camel_imapx_command_free(ic);
 
 		if (camel_tcp_stream_ssl_enable_ssl (CAMEL_TCP_STREAM_SSL (tcp_stream)) == -1) {
-			camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-					_("Failed to connect to IMAP server %s in secure mode: %s"),
-					is->url->host, _("SSL negotiations failed"));
+			g_set_error (
+				&local_error, CAMEL_ERROR,
+				CAMEL_ERROR_GENERIC,
+				_("Failed to connect to IMAP server %s in secure mode: %s"),
+				is->url->host, _("SSL negotiations failed"));
 			goto exit;
 		}
 		/* Get new capabilities if they weren't already given */
 		if (!is->cinfo) {
 			ic = camel_imapx_command_new(is, "CAPABILITY", NULL, "CAPABILITY");
-			imapx_command_run (is, ic);
-			camel_exception_xfer (ex, ic->ex);
-			camel_imapx_command_free(ic);
-
-			if (camel_exception_is_set (ex))
+			if (!imapx_command_run (is, ic)) {
+				g_propagate_error (&local_error, ic->error);
+				camel_imapx_command_free (ic);
 				goto exit;
+			}
+
+			camel_imapx_command_free(ic);
 		}
 	}
 #endif
 
 exit:
-	if (camel_exception_is_set (ex)) {
-		e(printf("Unable to connect %d %s \n", ex->id, ex->desc));
+	if (local_error != NULL) {
+		e(printf("Unable to connect %d %s \n", local_error->code, local_error->message));
+		g_propagate_error (error, local_error);
 		g_object_unref (is->stream);
 		is->stream = NULL;
 
@@ -2802,8 +2863,8 @@ exit:
 	return TRUE;
 }
 
-static void
-imapx_reconnect (CamelIMAPXServer *is, CamelException *ex)
+static gboolean
+imapx_reconnect (CamelIMAPXServer *is, GError **error)
 {
 	CamelSasl *sasl;
 	CamelIMAPXCommand *ic;
@@ -2820,11 +2881,9 @@ imapx_reconnect (CamelIMAPXServer *is, CamelException *ex)
 			prompt_flags |= CAMEL_SESSION_PASSWORD_REPROMPT;
 			g_free (service->url->passwd);
 			service->url->passwd = NULL;
-			camel_exception_clear (ex);
 		}
 
-		imapx_connect_to_server (is, ex);
-		if (camel_exception_is_set (ex))
+		if (!imapx_connect_to_server (is, error))
 			goto exception;
 
 		if (is->state == IMAPX_AUTHENTICATED)
@@ -2832,8 +2891,9 @@ imapx_reconnect (CamelIMAPXServer *is, CamelException *ex)
 
 		if (!authtype && service->url->authmech) {
 			if (!g_hash_table_lookup (is->cinfo->auth_types, service->url->authmech)) {
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+				g_set_error (
+					error, CAMEL_SERVICE_ERROR,
+					CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 					_("IMAP server %s does not support requested "
 					  "authentication type %s"),
 					service->url->host,
@@ -2843,8 +2903,9 @@ imapx_reconnect (CamelIMAPXServer *is, CamelException *ex)
 
 			authtype = camel_sasl_authtype (service->url->authmech);
 			if (!authtype) {
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+				g_set_error (
+					error, CAMEL_SERVICE_ERROR,
+					CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 					_("No support for authentication type %s"),
 					service->url->authmech);
 				goto exception;
@@ -2866,7 +2927,7 @@ imapx_reconnect (CamelIMAPXServer *is, CamelException *ex)
 			auth_domain = camel_url_get_param (service->url, "auth-domain");
 			service->url->passwd = camel_session_get_password(is->session, (CamelService *)is->store,
 					auth_domain,
-					full_prompt, "password", prompt_flags, ex);
+					full_prompt, "password", prompt_flags, error);
 
 			g_free (base_prompt);
 			g_free (full_prompt);
@@ -2874,8 +2935,10 @@ imapx_reconnect (CamelIMAPXServer *is, CamelException *ex)
 			errbuf = NULL;
 
 			if (!service->url->passwd) {
-				camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
-						_("You did not enter a password."));
+				g_set_error (
+					error, G_IO_ERROR,
+					G_IO_ERROR_CANCELLED,
+					_("You did not enter a password."));
 				goto exception;
 			}
 		}
@@ -2888,7 +2951,7 @@ imapx_reconnect (CamelIMAPXServer *is, CamelException *ex)
 
 		imapx_command_run (is, ic);
 
-		if (!(camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK)) {
+		if (ic->error == NULL && ic->status->result == IMAPX_OK) {
 			/* Forget old capabilities after login */
 			if (is->cinfo) {
 				imapx_free_capability(is->cinfo);
@@ -2906,8 +2969,8 @@ imapx_reconnect (CamelIMAPXServer *is, CamelException *ex)
 			/* If exception is set, it might be mostly due to cancellation and we would get an
 			   io error, else re-prompt. If authentication fails for other reasons ic->status would be
 			    set with the error message */
-			if (camel_exception_is_set (ic->ex)) {
-				camel_exception_xfer (ex, ic->ex);
+			if (ic->error != NULL) {
+				g_propagate_error (error, ic->error);
 				camel_imapx_command_free(ic);
 				goto exception;
 			}
@@ -2915,25 +2978,21 @@ imapx_reconnect (CamelIMAPXServer *is, CamelException *ex)
 			errbuf = g_markup_printf_escaped (
 					_("Unable to authenticate to IMAP server.\n%s\n\n"),
 					 ic->status->text);
-			camel_exception_clear (ex);
-
 		}
 
 		camel_imapx_command_free(ic);
 	}
 
-	if (camel_exception_is_set (ex))
-		goto exception;
-
 	/* After login we re-capa unless the server already told us */
 	if (!is->cinfo) {
 		ic = camel_imapx_command_new(is, "CAPABILITY", NULL, "CAPABILITY");
-		imapx_command_run (is, ic);
-		camel_exception_xfer (ex, ic->ex);
-		camel_imapx_command_free(ic);
-
-		if (camel_exception_is_set (ex))
+		if (!imapx_command_run (is, ic)) {
+			g_propagate_error (error, ic->error);
+			camel_imapx_command_free(ic);
 			goto exception;
+		}
+
+		camel_imapx_command_free (ic);
 	}
 
 	is->state = IMAPX_AUTHENTICATED;
@@ -2950,22 +3009,25 @@ imapx_reconnect (CamelIMAPXServer *is, CamelException *ex)
 	/* Fetch namespaces */
 	if (is->cinfo->capa & IMAPX_CAPABILITY_NAMESPACE) {
 		ic = camel_imapx_command_new (is, "NAMESPACE", NULL, "NAMESPACE");
-		imapx_command_run (is, ic);
-		camel_exception_xfer (ex, ic->ex);
-		camel_imapx_command_free (ic);
-
-		if (camel_exception_is_set (ex))
+		if (!imapx_command_run (is, ic)) {
+			g_propagate_error (error, ic->error);
+			camel_imapx_command_free (ic);
 			goto exception;
+		}
+
+		camel_imapx_command_free (ic);
 	}
+
 	if (((CamelIMAPXStore *)is->store)->rec_options & IMAPX_USE_QRESYNC &&
 	    is->cinfo->capa & IMAPX_CAPABILITY_QRESYNC) {
 		ic = camel_imapx_command_new (is, "ENABLE", NULL, "ENABLE CONDSTORE QRESYNC");
-		imapx_command_run (is, ic);
-		camel_exception_xfer (ex, ic->ex);
-		camel_imapx_command_free (ic);
-
-		if (camel_exception_is_set (ex))
+		if (!imapx_command_run (is, ic)) {
+			g_propagate_error (error, ic->error);
+			camel_imapx_command_free (ic);
 			goto exception;
+		}
+
+		camel_imapx_command_free (ic);
 
 		is->use_qresync = TRUE;
 	} else
@@ -2989,18 +3051,19 @@ imapx_reconnect (CamelIMAPXServer *is, CamelException *ex)
 		imapx_store->dir_sep = ns->sep;
 	}
 
-	if (!camel_exception_is_set (ex)) {
-		is->state = IMAPX_INITIALISED;
-		return;
-	}
+	is->state = IMAPX_INITIALISED;
+	return TRUE;
 
 exception:
+
 	imapx_disconnect (is);
 
 	if (is->cinfo) {
 		imapx_free_capability(is->cinfo);
 		is->cinfo = NULL;
 	}
+
+	return FALSE;
 }
 
 /* ********************************************************************** */
@@ -3020,7 +3083,7 @@ imapx_command_fetch_message_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 
 	full_name = camel_folder_get_full_name (job->folder);
 
-	if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
+	if (ic->error != NULL || ic->status->result != IMAPX_OK) {
 		failed = TRUE;
 		job->u.get_message.body_len = -1;
 	} else  if (job->u.get_message.use_multi_fetch) {
@@ -3055,10 +3118,12 @@ imapx_command_fetch_message_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 
 		/* return the exception from last command */
 		if (failed) {
-			if (!camel_exception_is_set (ic->ex))
-				camel_exception_setv(job->ex, 1, "Error fetching message: %s", ic->status->text);
+			if (ic->error == NULL)
+				g_set_error (
+					&job->error, CAMEL_IMAPX_ERROR, 1,
+					"Error fetching message: %s", ic->status->text);
 			else
-				camel_exception_xfer (job->ex, ic->ex);
+				g_propagate_error (&job->error, ic->error);
 			g_object_unref (stream);
 			job->u.get_message.stream = NULL;
 		} else {
@@ -3067,7 +3132,7 @@ imapx_command_fetch_message_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 			if (stream) {
 				gchar *tmp = camel_data_cache_get_filename (ifolder->cache, "tmp", job->u.get_message.uid, NULL);
 
-				if (camel_stream_flush (stream) == 0 && camel_stream_close (stream) == 0) {
+				if (camel_stream_flush (stream, &job->error) == 0 && camel_stream_close (stream, &job->error) == 0) {
 					gchar *cache_file = camel_data_cache_get_filename  (ifolder->cache, "cur", job->u.get_message.uid, NULL);
 					gchar *temp = g_strrstr (cache_file, "/"), *dir;
 
@@ -3076,10 +3141,14 @@ imapx_command_fetch_message_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 					g_free (dir);
 
 					if (g_rename (tmp, cache_file) != 0)
-						camel_exception_set (job->ex, 1, "failed to copy the tmp file");
+						g_set_error (
+							&job->error, CAMEL_IMAPX_ERROR, 1,
+							"failed to copy the tmp file");
 					g_free (cache_file);
 				} else
-					camel_exception_setv(job->ex, 1, "closing tmp stream failed: %s", g_strerror(errno));
+					g_prefix_error (
+						&job->error,
+						_("Closing tmp stream failed: "));
 
 				g_free (tmp);
 				job->u.get_message.stream = camel_data_cache_get (ifolder->cache, "cur", job->u.get_message.uid, NULL);
@@ -3166,11 +3235,13 @@ imapx_command_copy_messages_step_done (CamelIMAPXServer *is, CamelIMAPXCommand *
 	gint i = job->u.copy_messages.index;
 	GPtrArray *uids = job->u.copy_messages.uids;
 
-	if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
-		if (!camel_exception_is_set (ic->ex))
-			camel_exception_set (job->ex, 1, "Error copying messages");
+	if (ic->error != NULL || ic->status->result != IMAPX_OK) {
+		if (ic->error == NULL)
+			g_set_error (
+				&job->error, CAMEL_IMAPX_ERROR, 1,
+				"Error copying messages");
 		else
-			camel_exception_xfer (job->ex, ic->ex);
+			g_propagate_error (&job->error, ic->error);
 
 		goto cleanup;
 	}
@@ -3213,8 +3284,7 @@ cleanup:
 static void
 imapx_job_copy_messages_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 {
-	imapx_server_sync_changes (is, job->folder, job->pri, job->ex);
-	if (camel_exception_is_set (job->ex))
+	if (!imapx_server_sync_changes (is, job->folder, job->pri, &job->error))
 		imapx_job_done (is, job);
 
 	g_ptr_array_sort (job->u.copy_messages.uids, (GCompareFunc) imapx_uids_array_cmp);
@@ -3240,7 +3310,7 @@ imapx_command_append_message_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 	mi = camel_message_info_clone (job->u.append_message.info);
 	old_uid = g_strdup (job->u.append_message.info->uid);
 
-	if (!camel_exception_is_set (ic->ex) && ic->status->result == IMAPX_OK) {
+	if (ic->error == NULL && ic->status->result == IMAPX_OK) {
 		if (ic->status->condition == IMAPX_APPENDUID) {
 			c(printf("Got appenduid %d %d\n", (gint)ic->status->u.appenduid.uidvalidity, (gint)ic->status->u.appenduid.uid));
 			if (ic->status->u.appenduid.uidvalidity == ifolder->uidvalidity_on_server) {
@@ -3270,10 +3340,12 @@ imapx_command_append_message_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 			}
 		}
 	} else {
-		if (!camel_exception_is_set (ic->ex))
-			camel_exception_setv(job->ex, 1, "Error appending message: %s", ic->status->text);
+		if (ic->error == NULL)
+			g_set_error (
+				&job->error, CAMEL_IMAPX_ERROR, 1,
+				"Error appending message: %s", ic->status->text);
 		else
-			camel_exception_xfer (job->ex, ic->ex);
+			g_propagate_error (&job->error, ic->error);
 	}
 
 	camel_data_cache_remove (ifolder->cache, "new", old_uid, NULL);
@@ -3376,11 +3448,13 @@ imapx_command_step_fetch_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 	gint i = job->u.refresh_info.index;
 	GArray *infos = job->u.refresh_info.infos;
 
-	if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
-		if (!camel_exception_is_set (ic->ex))
-			camel_exception_set (job->ex, 1, "Error fetching message headers");
+	if (ic->error != NULL || ic->status->result != IMAPX_OK) {
+		if (ic->error == NULL)
+			g_set_error (
+				&job->error, CAMEL_IMAPX_ERROR, 1,
+				"Error fetching message headers");
 		else
-			camel_exception_xfer (job->ex, ic->ex);
+			g_propagate_error (&job->error, ic->error);
 
 		goto cleanup;
 	}
@@ -3467,7 +3541,7 @@ imapx_job_scan_changes_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 	gint i;
 	GArray *infos = job->u.refresh_info.infos;
 
-	if (!camel_exception_is_set (ic->ex) && ic->status->result == IMAPX_OK) {
+	if (ic->error == NULL && ic->status->result == IMAPX_OK) {
 		GCompareDataFunc uid_cmp = imapx_uid_cmp;
 		CamelMessageInfo *s_minfo = NULL;
 		CamelIMAPXMessageInfo *info;
@@ -3602,10 +3676,12 @@ imapx_job_scan_changes_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 			return;
 		}
 	} else {
-		if (!camel_exception_is_set (ic->ex))
-			camel_exception_setv(job->ex, 1, "Error retriving message: %s", ic->status->text);
+		if (ic->error == NULL)
+			g_set_error (
+				&job->error, CAMEL_IMAPX_ERROR, 1,
+				"Error retriving message: %s", ic->status->text);
 		else
-			camel_exception_xfer (job->ex, ic->ex);
+			g_propagate_error (&job->error, ic->error);
 	}
 
 	for (i=0;i<infos->len;i++) {
@@ -3647,11 +3723,13 @@ imapx_command_fetch_new_messages_done (CamelIMAPXServer *is, CamelIMAPXCommand *
 	CamelIMAPXSummary *isum = (CamelIMAPXSummary *)ic->job->folder->summary;
 	CamelIMAPXFolder *ifolder = (CamelIMAPXFolder *)ic->job->folder;
 
-	if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
-		if (!camel_exception_is_set (ic->ex))
-			camel_exception_setv(ic->job->ex, 1, "Error fetching new messages : %s", ic->status->text);
+	if (ic->error != NULL || ic->status->result != IMAPX_OK) {
+		if (ic->error == NULL)
+			g_set_error (
+				&ic->job->error, CAMEL_IMAPX_ERROR, 1,
+				"Error fetching new messages: %s", ic->status->text);
 		else
-			camel_exception_xfer (ic->job->ex, ic->ex);
+			g_propagate_error (&ic->job->error, ic->error);
 		goto exception;
 	}
 	isum->uidnext = ifolder->uidnext_on_server;
@@ -3725,7 +3803,6 @@ imapx_job_refresh_info_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 	CamelIMAPXFolder *ifolder = (CamelIMAPXFolder *) job->folder;
 	CamelIMAPXSummary *isum = (CamelIMAPXSummary *)job->folder->summary;
 	CamelFolder *folder = job->folder;
-	CamelException *ex = job->ex;
 	const gchar *full_name;
 	gboolean need_rescan = FALSE;
 	gboolean is_selected = FALSE;
@@ -3735,8 +3812,7 @@ imapx_job_refresh_info_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 
 	/* Sync changes first, else unread count will not
 	   match. Need to think about better ways for this */
-	imapx_server_sync_changes (is, folder, job->pri, ex);
-	if (camel_exception_is_set (job->ex))
+	if (!imapx_server_sync_changes (is, folder, job->pri, &job->error))
 		goto done;
 
 #if 0 /* There are issues with this still; continue with the buggy behaviour
@@ -3770,18 +3846,15 @@ imapx_job_refresh_info_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 			/* We may not issue STATUS on the current folder. Use SELECT or NOOP instead. */
 			if (0 /* server needs SELECT not just NOOP*/) {
 				if (imapx_idle_supported(is) && imapx_in_idle(is))
-					imapx_stop_idle(is, job->ex);
-				if (camel_exception_is_set(job->ex))
-					goto done;
+					if (!imapx_stop_idle(is, &job->error))
+						goto done;
 				/* This doesn't work -- this is an immediate command, not queued */
-				imapx_select(is, folder, TRUE, job->ex);
-				if (camel_exception_is_set(job->ex))
+				if (!imapx_select(is, folder, TRUE, &job->error))
 					goto done;
 			} else {
 				/* Or maybe just NOOP, unless we're in IDLE in which case do nothing */
 				if (!imapx_idle_supported(is) || !imapx_in_idle(is)) {
-					camel_imapx_server_noop(is, folder, job->ex);
-					if (camel_exception_is_set(job->ex))
+					if (!camel_imapx_server_noop(is, folder, &job->error))
 						goto done;
 				}
 			}
@@ -3796,11 +3869,13 @@ imapx_job_refresh_info_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 
 			imapx_command_run_sync (is, ic);
 
-			if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
-				if (!camel_exception_is_set (ic->ex))
-					camel_exception_setv(job->ex, 1, "Error refreshing folder: %s", ic->status->text);
+			if (ic->error != NULL || ic->status->result != IMAPX_OK) {
+				if (ic->error == NULL)
+					g_set_error (
+						&job->error, CAMEL_IMAPX_ERROR, 1,
+						"Error refreshing folder: %s", ic->status->text);
 				else
-					camel_exception_xfer (job->ex, ic->ex);
+					g_propagate_error (&job->error, ic->error);
 
 				camel_imapx_command_free (ic);
 				goto done;
@@ -3834,8 +3909,7 @@ imapx_job_refresh_info_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 		if (!total)
 			need_rescan = FALSE;
 
-		imapx_server_fetch_new_messages (is, folder, FALSE, FALSE, job->ex);
-		if (camel_exception_is_set (job->ex))
+		if (!imapx_server_fetch_new_messages (is, folder, FALSE, FALSE, &job->error))
 			goto done;
 
 		/* If QRESYNC-capable we'll have got all flags changes in SELECT */
@@ -3848,7 +3922,7 @@ imapx_job_refresh_info_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 
 	if (can_qresync) {
 		/* Actually we only want to select it; no need for the NOOP */
-		camel_imapx_server_noop(is, folder, ex);
+		camel_imapx_server_noop(is, folder, &job->error);
 	qresync_done:
 		isum->modseq = ifolder->modseq_on_server;
 		total = camel_folder_summary_count(job->folder->summary);
@@ -3880,11 +3954,13 @@ done:
 static void
 imapx_command_expunge_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 {
-	if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
-		if (!camel_exception_is_set (ic->ex))
-			camel_exception_setv(ic->job->ex, 1, "Error expunging message : %s", ic->status->text);
+	if (ic->error != NULL || ic->status->result != IMAPX_OK) {
+		if (ic->error == NULL)
+			g_set_error (
+				&ic->job->error, CAMEL_IMAPX_ERROR, 1,
+				"Error expunging message: %s", ic->status->text);
 		else
-			camel_exception_xfer (ic->job->ex, ic->ex);
+			g_propagate_error (&ic->job->error, ic->error);
 	} else {
 		GPtrArray *uids;
 		CamelFolder *folder = ic->job->folder;
@@ -3894,8 +3970,8 @@ imapx_command_expunge_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 		full_name = camel_folder_get_full_name (folder);
 		parent_store = camel_folder_get_parent_store (folder);
 
-		camel_folder_summary_save_to_db (folder->summary, ic->job->ex);
-		uids = camel_db_get_folder_deleted_uids (parent_store->cdb_r, full_name, ic->job->ex);
+		camel_folder_summary_save_to_db (folder->summary, NULL);
+		uids = camel_db_get_folder_deleted_uids (parent_store->cdb_r, full_name, &ic->job->error);
 
 		if (uids && uids->len)	{
 			CamelFolderChangeInfo *changes;
@@ -3917,8 +3993,8 @@ imapx_command_expunge_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 				removed = g_slist_prepend (removed, (gpointer) uids->pdata[i]);
 			}
 
-			camel_db_delete_uids (parent_store->cdb_w, full_name, removed, ic->job->ex);
-			camel_folder_summary_save_to_db (folder->summary, ic->job->ex);
+			camel_db_delete_uids (parent_store->cdb_w, full_name, removed, NULL);
+			camel_folder_summary_save_to_db (folder->summary, NULL);
 			camel_folder_changed (folder, changes);
 			camel_folder_change_info_free (changes);
 
@@ -3937,7 +4013,7 @@ imapx_job_expunge_start(CamelIMAPXServer *is, CamelIMAPXJob *job)
 {
 	CamelIMAPXCommand *ic;
 
-	imapx_server_sync_changes (is, job->folder, job->pri, job->ex);
+	imapx_server_sync_changes (is, job->folder, job->pri, &job->error);
 
 	/* TODO handle UIDPLUS capability */
 	ic = camel_imapx_command_new(is, "EXPUNGE", job->folder, "EXPUNGE");
@@ -3952,11 +4028,13 @@ imapx_job_expunge_start(CamelIMAPXServer *is, CamelIMAPXJob *job)
 static void
 imapx_command_list_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 {
-	if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
-		if (!camel_exception_is_set (ic->ex))
-			camel_exception_setv(ic->job->ex, 1, "Error fetching folders : %s", ic->status->text);
+	if (ic->error != NULL || ic->status->result != IMAPX_OK) {
+		if (ic->error == NULL)
+			g_set_error (
+				&ic->job->error, CAMEL_IMAPX_ERROR, 1,
+				"Error fetching folders: %s", ic->status->text);
 		else
-			camel_exception_xfer (ic->job->ex, ic->ex);
+			g_propagate_error (&ic->job->error, ic->error);
 	}
 
 	e(printf ("==== list or lsub completed ==== \n"));
@@ -4002,11 +4080,13 @@ imapx_encode_folder_name (CamelIMAPXStore *istore, const gchar *folder_name)
 static void
 imapx_command_subscription_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 {
-	if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
-		if (!camel_exception_is_set (ic->ex))
-			camel_exception_setv(ic->job->ex, 1, "Error subscribing to folder : %s", ic->status->text);
+	if (ic->error != NULL || ic->status->result != IMAPX_OK) {
+		if (ic->error == NULL)
+			g_set_error (
+				&ic->job->error, CAMEL_IMAPX_ERROR, 1,
+				"Error subscribing to folder : %s", ic->status->text);
 		else
-			camel_exception_xfer (ic->job->ex, ic->ex);
+			g_propagate_error (&ic->job->error, ic->error);
 	}
 
 	imapx_job_done (is, ic->job);
@@ -4041,11 +4121,13 @@ imapx_job_manage_subscription_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 static void
 imapx_command_create_folder_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 {
-	if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
-		if (!camel_exception_is_set (ic->ex))
-			camel_exception_setv(ic->job->ex, 1, "Error creating to folder : %s", ic->status->text);
+	if (ic->error != NULL || ic->status->result != IMAPX_OK) {
+		if (ic->error == NULL)
+			g_set_error (
+				&ic->job->error, CAMEL_IMAPX_ERROR, 1,
+				"Error creating to folder: %s", ic->status->text);
 		else
-			camel_exception_xfer (ic->job->ex, ic->ex);
+			g_propagate_error (&ic->job->error, ic->error);
 	}
 
 	imapx_job_done (is, ic->job);
@@ -4073,11 +4155,13 @@ imapx_job_create_folder_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 static void
 imapx_command_delete_folder_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 {
-	if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
-		if (!camel_exception_is_set (ic->ex))
-			camel_exception_setv(ic->job->ex, 1, "Error deleting to folder : %s", ic->status->text);
+	if (ic->error != NULL || ic->status->result != IMAPX_OK) {
+		if (ic->error == NULL)
+			g_set_error (
+				&ic->job->error, CAMEL_IMAPX_ERROR, 1,
+				"Error deleting to folder : %s", ic->status->text);
 		else
-			camel_exception_xfer (ic->job->ex, ic->ex);
+			g_propagate_error (&ic->job->error, ic->error);
 	}
 
 	imapx_job_done (is, ic->job);
@@ -4092,7 +4176,7 @@ imapx_job_delete_folder_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 
 	encoded_fname = imapx_encode_folder_name ((CamelIMAPXStore *) is->store, job->u.folder_name);
 
-	job->folder = camel_store_get_folder(is->store, "INBOX", 0, job->ex);
+	job->folder = camel_store_get_folder(is->store, "INBOX", 0, &job->error);
 
 	/* make sure to-be-deleted folder is not selected by selecting INBOX for this operation */
 	ic = camel_imapx_command_new (is, "DELETE", job->folder, "DELETE %s", encoded_fname);
@@ -4106,14 +4190,16 @@ imapx_job_delete_folder_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 
 /* ********************************************************************** */
 
-	static void
+static void
 imapx_command_rename_folder_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 {
-	if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
-		if (!camel_exception_is_set (ic->ex))
-			camel_exception_setv(ic->job->ex, 1, "Error renaming to folder : %s", ic->status->text);
+	if (ic->error != NULL || ic->status->result != IMAPX_OK) {
+		if (ic->error == NULL)
+			g_set_error (
+				&ic->job->error, CAMEL_IMAPX_ERROR, 1,
+				"Error renaming to folder: %s", ic->status->text);
 		else
-			camel_exception_xfer (ic->job->ex, ic->ex);
+			g_propagate_error (&ic->job->error, ic->error);
 	}
 
 	imapx_job_done (is, ic->job);
@@ -4126,7 +4212,7 @@ imapx_job_rename_folder_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 	CamelIMAPXCommand *ic;
 	gchar *en_ofname = NULL, *en_nfname = NULL;
 
-	job->folder = camel_store_get_folder(is->store, "INBOX", 0, job->ex);
+	job->folder = camel_store_get_folder(is->store, "INBOX", 0, &job->error);
 
 	en_ofname = imapx_encode_folder_name ((CamelIMAPXStore *) is->store, job->u.rename_folder.ofolder_name);
 	en_nfname = imapx_encode_folder_name ((CamelIMAPXStore *) is->store, job->u.rename_folder.nfolder_name);
@@ -4146,11 +4232,13 @@ imapx_job_rename_folder_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 static void
 imapx_command_noop_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 {
-	if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
-		if (!camel_exception_is_set (ic->ex))
-			camel_exception_setv(ic->job->ex, 1, "Error performing NOOP: %s", ic->status->text);
+	if (ic->error != NULL || ic->status->result != IMAPX_OK) {
+		if (ic->error == NULL)
+			g_set_error (
+				&ic->job->error, CAMEL_IMAPX_ERROR, 1,
+				"Error performing NOOP: %s", ic->status->text);
 		else
-			camel_exception_xfer (ic->job->ex, ic->ex);
+			g_propagate_error (&ic->job->error, ic->error);
 	}
 
 	imapx_job_done (is, ic->job);
@@ -4222,11 +4310,13 @@ imapx_command_sync_changes_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 	   that what we just set is actually what is on the server now .. but
 	   if it isn't, i guess we'll fix up next refresh */
 
-	if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) {
-		if (!camel_exception_is_set (ic->ex))
-			camel_exception_setv(job->ex, 1, "Error syncing changes: %s", ic->status->text);
+	if (ic->error != NULL || ic->status->result != IMAPX_OK) {
+		if (ic->error == NULL)
+			g_set_error (
+				&job->error, CAMEL_IMAPX_ERROR, 1,
+				"Error syncing changes: %s", ic->status->text);
 		else
-			camel_exception_xfer (job->ex, ic->ex);
+			g_propagate_error (&job->error, ic->error);
 		failed = TRUE;
 	}
 
@@ -4273,7 +4363,7 @@ imapx_command_sync_changes_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 			}
 		}
 
-		camel_folder_summary_save_to_db (job->folder->summary, job->ex);
+		camel_folder_summary_save_to_db (job->folder->summary, &job->error);
 		camel_store_summary_save((CamelStoreSummary *)((CamelIMAPXStore *) parent_store)->summary);
 
 		imapx_job_done (is, job);
@@ -4383,7 +4473,7 @@ imapx_job_sync_changes_start(CamelIMAPXServer *is, CamelIMAPXJob *job)
 
 /* we cancel all the commands and their jobs, so associated jobs will be notified */
 static void
-cancel_all_jobs (CamelIMAPXServer *is, CamelException *ex)
+cancel_all_jobs (CamelIMAPXServer *is, GError *error)
 {
 	CamelIMAPXCommand **cw, *ic;
 	gint i = 0;
@@ -4400,7 +4490,7 @@ cancel_all_jobs (CamelIMAPXServer *is, CamelException *ex)
 			camel_dlist_remove ((CamelDListNode *)ic);
 			QUEUE_UNLOCK(is);
 
-			camel_exception_set (ic->ex, ex->id, ex->desc);
+			ic->error = g_error_copy (error);
 			ic->complete (is, ic);
 
 			QUEUE_LOCK(is);
@@ -4413,16 +4503,20 @@ cancel_all_jobs (CamelIMAPXServer *is, CamelException *ex)
 /* ********************************************************************** */
 
 static void
-parse_contents (CamelIMAPXServer *is, CamelException *ex)
+parse_contents (CamelIMAPXServer *is, GError **error)
 {
 	gint buffered = 0;
+	GError *local_error = NULL;
 
 	do {
-		imapx_step(is, ex);
+		imapx_step (is, &local_error);
 
 		buffered = camel_imapx_stream_buffered (is->stream);
 
-	} while (buffered && !camel_exception_is_set (ex));
+	} while (buffered && local_error == NULL);
+
+	if (local_error != NULL)
+		g_propagate_error (error, local_error);
 }
 
 /*
@@ -4436,14 +4530,14 @@ static gpointer
 imapx_parser_thread (gpointer d)
 {
 	CamelIMAPXServer *is = d;
-	CamelException ex = CAMEL_EXCEPTION_INITIALISER;
 	CamelOperation *op;
+	GError *local_error = NULL;
 
 	op = camel_operation_new (NULL, NULL);
 	op = camel_operation_register (op);
 	is->op = op;
 
-	while (!camel_exception_is_set (&ex) && is->stream) {
+	while (local_error == NULL && is->stream) {
 		camel_operation_uncancel (op);
 #ifdef HAVE_SSL
 		if (is->is_ssl_stream)	{
@@ -4463,7 +4557,7 @@ imapx_parser_thread (gpointer d)
 			else if (res == 0) {
 				/* timed out */
 			} else if ((pollfds[0].out_flags & PR_POLL_READ)) {
-				parse_contents (is, &ex);
+				parse_contents (is, &local_error);
 			} else if (pollfds[1].out_flags & PR_POLL_READ)
 				errno = EINTR;
 		}
@@ -4483,7 +4577,7 @@ imapx_parser_thread (gpointer d)
 			else if (res == 0)
 				/* timed out */;
 			else if (fds[0].revents & G_IO_IN) {
-				parse_contents (is, &ex);
+				parse_contents (is, &local_error);
 			} else if (fds[1].revents & G_IO_IN)
 				errno = EINTR;
 		}
@@ -4504,13 +4598,16 @@ imapx_parser_thread (gpointer d)
 			else if (res == 0)
 				/* timed out */;
 			else if (fds[0].revents & G_IO_IN) {
-				parse_contents (is, &ex);
+				parse_contents (is, &local_error);
 			} else if (fds[1].revents & G_IO_IN)
 				errno = EINTR;
 		}
 
 		if (is->parser_quit) {
-			camel_exception_setv (&ex, CAMEL_EXCEPTION_USER_CANCEL, "Operation Cancelled: %s", g_strerror(errno));
+			g_set_error (
+				&local_error, G_IO_ERROR,
+				G_IO_ERROR_CANCELLED,
+				_("Cancelled"));
 			break;
 		}
 
@@ -4524,7 +4621,10 @@ imapx_parser_thread (gpointer d)
 			if ((is_empty || (imapx_idle_supported (is) && imapx_in_idle (is))))
 				camel_operation_uncancel (op);
 			else
-				camel_exception_setv (&ex, CAMEL_EXCEPTION_USER_CANCEL, "Operation Cancelled: %s", g_strerror(errno));
+				g_set_error (
+					&local_error, G_IO_ERROR,
+					G_IO_ERROR_CANCELLED,
+					_("Cancelled"));
 		}
 	}
 
@@ -4532,9 +4632,9 @@ imapx_parser_thread (gpointer d)
 	is->state = IMAPX_SHUTDOWN;
 	QUEUE_UNLOCK(is);
 
-	cancel_all_jobs (is, &ex);
+	cancel_all_jobs (is, local_error);
 
-	camel_exception_clear (&ex);
+	g_clear_error (&local_error);
 
 	if (op) {
 		camel_operation_unregister (op);
@@ -4690,7 +4790,7 @@ imapx_disconnect (CamelIMAPXServer *is)
 	g_static_rec_mutex_lock (&is->ostream_lock);
 
 	if (is->stream) {
-		if (camel_stream_close (is->stream->source) == -1)
+		if (camel_stream_close (is->stream->source, NULL) == -1)
 			ret = FALSE;
 
 		g_object_unref (CAMEL_OBJECT (is->stream));
@@ -4722,8 +4822,10 @@ imapx_disconnect (CamelIMAPXServer *is)
 
 /* Client commands */
 gboolean
-camel_imapx_server_connect (CamelIMAPXServer *is, CamelException *ex)
+camel_imapx_server_connect (CamelIMAPXServer *is, GError **error)
 {
+	gboolean success;
+
 	if (is->state == IMAPX_SHUTDOWN)
 		return FALSE;
 
@@ -4731,10 +4833,10 @@ camel_imapx_server_connect (CamelIMAPXServer *is, CamelException *ex)
 		return TRUE;
 
 	g_static_rec_mutex_lock (&is->ostream_lock);
-	imapx_reconnect (is, ex);
+	success = imapx_reconnect (is, error);
 	g_static_rec_mutex_unlock (&is->ostream_lock);
 
-	if (camel_exception_is_set (ex))
+	if (!success)
 		return FALSE;
 
 	is->parser_thread = g_thread_create((GThreadFunc) imapx_parser_thread, is, TRUE, NULL);
@@ -4742,7 +4844,7 @@ camel_imapx_server_connect (CamelIMAPXServer *is, CamelException *ex)
 }
 
 static CamelStream *
-imapx_server_get_message (CamelIMAPXServer *is, CamelFolder *folder, CamelOperation *op, const gchar *uid, gint pri, CamelException *ex)
+imapx_server_get_message (CamelIMAPXServer *is, CamelFolder *folder, CamelOperation *op, const gchar *uid, gint pri, GError **error)
 {
 	CamelStream *stream = NULL, *tmp_stream;
 	CamelIMAPXFolder *ifolder = (CamelIMAPXFolder *) folder;
@@ -4751,6 +4853,7 @@ imapx_server_get_message (CamelIMAPXServer *is, CamelFolder *folder, CamelOperat
 	CamelMessageInfo *mi;
 	gboolean registered;
 	EFlag *flag = NULL;
+	gboolean success;
 
 	cache_file = camel_data_cache_get_filename  (ifolder->cache, "cur", uid, NULL);
 	if (g_file_test (cache_file, G_FILE_TEST_EXISTS)) {
@@ -4773,16 +4876,19 @@ imapx_server_get_message (CamelIMAPXServer *is, CamelFolder *folder, CamelOperat
 
 		stream = camel_data_cache_get (ifolder->cache, "cur", uid, NULL);
 		if (!stream)
-			camel_exception_set (ex, 1, "Could not retrieve the message");
+			g_set_error (
+				error, CAMEL_IMAPX_ERROR, 1,
+				"Could not retrieve the message");
 		return stream;
 	}
 
 	mi = camel_folder_summary_uid (folder->summary, uid);
 	if (!mi) {
-		camel_exception_setv (
-				ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
-				_("Cannot get message with message ID %s: %s"),
-				uid, _("No such message available."));
+		g_set_error (
+			error, CAMEL_FOLDER_ERROR,
+			CAMEL_FOLDER_ERROR_INVALID_UID,
+			_("Cannot get message with message ID %s: %s"),
+			uid, _("No such message available."));
 		QUEUE_UNLOCK (is);
 		return NULL;
 	}
@@ -4797,24 +4903,23 @@ imapx_server_get_message (CamelIMAPXServer *is, CamelFolder *folder, CamelOperat
 	job->op = op;
 	job->u.get_message.uid = (gchar *)uid;
 	job->u.get_message.stream = tmp_stream;
-	job->ex = ex;
 
 	if (((CamelMessageInfoBase *) mi)->size > MULTI_SIZE)
 		job->u.get_message.use_multi_fetch = TRUE;
 
 	job->u.get_message.size = ((CamelMessageInfoBase *) mi)->size;
 	camel_message_info_free (mi);
-	registered = imapx_register_job (is, job);
+	registered = imapx_register_job (is, job, error);
 	flag = e_flag_new ();
 	g_hash_table_insert (is->uid_eflags, g_strdup (uid), flag);
 
 	QUEUE_UNLOCK (is);
 
-	if (registered)
-		imapx_run_job(is, job);
+	success = registered && imapx_run_job (is, job, error);
 
 	e_flag_set (flag);
-	if (!camel_exception_is_set (job->ex))
+
+	if (success)
 		stream = job->u.get_message.stream;
 
 	g_free(job);
@@ -4828,20 +4933,20 @@ imapx_server_get_message (CamelIMAPXServer *is, CamelFolder *folder, CamelOperat
 }
 
 CamelStream *
-camel_imapx_server_get_message(CamelIMAPXServer *is, CamelFolder *folder, const gchar *uid, CamelException *ex)
+camel_imapx_server_get_message(CamelIMAPXServer *is, CamelFolder *folder, const gchar *uid, GError **error)
 {
 	CamelStream *stream;
 	CamelOperation *op = camel_operation_registered ();
 
-	stream = imapx_server_get_message(is, folder, op, uid, IMAPX_PRIORITY_GET_MESSAGE, ex);
+	stream = imapx_server_get_message(is, folder, op, uid, IMAPX_PRIORITY_GET_MESSAGE, error);
 	if (op)
 		camel_operation_unref (op);
 
 	return stream;
 }
 
-void
-camel_imapx_server_sync_message (CamelIMAPXServer *is, CamelFolder *folder, const gchar *uid, CamelException *ex)
+gboolean
+camel_imapx_server_sync_message (CamelIMAPXServer *is, CamelFolder *folder, const gchar *uid, GError **error)
 {
 	gchar *cache_file = NULL;
 	CamelIMAPXFolder *ifolder = (CamelIMAPXFolder *) folder;
@@ -4850,16 +4955,21 @@ camel_imapx_server_sync_message (CamelIMAPXServer *is, CamelFolder *folder, cons
 	cache_file = camel_data_cache_get_filename  (ifolder->cache, "cur", uid, NULL);
 	if (g_file_test (cache_file, G_FILE_TEST_EXISTS)) {
 		g_free (cache_file);
-		return;
+		return TRUE;
 	}
 
-	stream = imapx_server_get_message (is, folder, NULL, uid, IMAPX_PRIORITY_SYNC_MESSAGE, ex);
-	if (stream)
-		g_object_unref (stream);
+	stream = imapx_server_get_message (is, folder, NULL, uid, IMAPX_PRIORITY_SYNC_MESSAGE, error);
+
+	if (stream == NULL)
+		return FALSE;
+
+	g_object_unref (stream);
+
+	return TRUE;
 }
 
-void
-camel_imapx_server_copy_message (CamelIMAPXServer *is, CamelFolder *source, CamelFolder *dest, GPtrArray *uids, gboolean delete_originals, CamelException *ex)
+gboolean
+camel_imapx_server_copy_message (CamelIMAPXServer *is, CamelFolder *source, CamelFolder *dest, GPtrArray *uids, gboolean delete_originals, GError **error)
 {
 	CamelIMAPXJob *job;
 
@@ -4871,17 +4981,15 @@ camel_imapx_server_copy_message (CamelIMAPXServer *is, CamelFolder *source, Came
 	job->u.copy_messages.dest = dest;
 	job->u.copy_messages.uids = uids;
 	job->u.copy_messages.delete_originals = delete_originals;
-	job->ex = ex;
 
 	g_object_ref (source);
 	g_object_ref (dest);
 
-	if (imapx_register_job (is, job))
-		imapx_run_job (is, job);
+	return imapx_submit_job (is, job, error);
 }
 
-void
-camel_imapx_server_append_message(CamelIMAPXServer *is, CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *mi, CamelException *ex)
+gboolean
+camel_imapx_server_append_message(CamelIMAPXServer *is, CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *mi, GError **error)
 {
 	gchar *uid = NULL, *tmp = NULL;
 	CamelStream *stream, *filter;
@@ -4900,22 +5008,27 @@ camel_imapx_server_append_message(CamelIMAPXServer *is, CamelFolder *folder, Cam
 	uid = imapx_get_temp_uid ();
 	stream = camel_data_cache_add (ifolder->cache, "new", uid, NULL);
 	if (stream == NULL) {
-		camel_exception_setv(ex, 2, "Cannot create spool file: %s", g_strerror((gint) errno));
-		return;
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			_("Cannot create spool file: %s"),
+			g_strerror (errno));
+		return FALSE;
 	}
 
 	filter = camel_stream_filter_new (stream);
 	g_object_unref (stream);
 	canon = camel_mime_filter_canon_new(CAMEL_MIME_FILTER_CANON_CRLF);
 	camel_stream_filter_add((CamelStreamFilter *)filter, canon);
-	res = camel_data_wrapper_write_to_stream((CamelDataWrapper *)message, filter);
+	res = camel_data_wrapper_write_to_stream (
+		(CamelDataWrapper *)message, filter, error);
 	g_object_unref (canon);
 	g_object_unref (filter);
 
 	if (res == -1) {
-		camel_exception_setv(ex, 2, "Cannot create spool file: %s", g_strerror(errno));
+		g_prefix_error (error, _("Cannot create spool file: "));
 		camel_data_cache_remove (ifolder->cache, "new", uid, NULL);
-		return;
+		return FALSE;
 	}
 
 	tmp = camel_data_cache_get_filename (ifolder->cache, "new", uid, NULL);
@@ -4931,43 +5044,41 @@ camel_imapx_server_append_message(CamelIMAPXServer *is, CamelFolder *folder, Cam
 
 	job = g_malloc0(sizeof(*job));
 	job->pri = IMAPX_PRIORITY_APPEND_MESSAGE;
-	job->ex = ex;
 	job->type = IMAPX_JOB_APPEND_MESSAGE;
 	job->start = imapx_job_append_message_start;
-	job->folder = folder;
-	g_object_ref (folder);
+	job->folder = g_object_ref (folder);
 	job->u.append_message.info = info;
 	job->u.append_message.path = tmp;
 
-	if (imapx_register_job (is, job))
-		imapx_run_job(is, job);
-	return;
+	return imapx_submit_job (is, job, error);
 }
 
-void
-camel_imapx_server_noop (CamelIMAPXServer *is, CamelFolder *folder, CamelException *ex)
+gboolean
+camel_imapx_server_noop (CamelIMAPXServer *is, CamelFolder *folder, GError **error)
 {
 	CamelIMAPXJob *job;
+	gboolean success;
 
 	job = g_malloc0(sizeof(*job));
 	job->type = IMAPX_JOB_NOOP;
 	job->start = imapx_job_noop_start;
 	job->folder = folder;
-	job->ex = ex;
 	job->pri = IMAPX_PRIORITY_NOOP;
 
-	if (imapx_register_job (is, job))
-		imapx_run_job(is, job);
+	success = imapx_submit_job (is, job, error);
 
 	g_free(job);
+
+	return success;
 }
 
-void
-camel_imapx_server_refresh_info (CamelIMAPXServer *is, CamelFolder *folder, CamelException *ex)
+gboolean
+camel_imapx_server_refresh_info (CamelIMAPXServer *is, CamelFolder *folder, GError **error)
 {
 	CamelIMAPXJob *job;
 	gboolean registered = TRUE;
 	const gchar *full_name;
+	gboolean success = TRUE;
 
 	full_name = camel_folder_get_full_name (folder);
 
@@ -4975,14 +5086,13 @@ camel_imapx_server_refresh_info (CamelIMAPXServer *is, CamelFolder *folder, Came
 
 	if (imapx_is_job_in_queue (is, folder, IMAPX_JOB_REFRESH_INFO, NULL)) {
 		QUEUE_UNLOCK (is);
-		return;
+		return TRUE;
 	}
 
 	job = g_malloc0(sizeof(*job));
 	job->type = IMAPX_JOB_REFRESH_INFO;
 	job->start = imapx_job_refresh_info_start;
 	job->folder = folder;
-	job->ex = ex;
 	job->op = camel_operation_registered ();
 	job->u.refresh_info.changes = camel_folder_change_info_new();
 	job->pri = IMAPX_PRIORITY_REFRESH_INFO;
@@ -4990,22 +5100,22 @@ camel_imapx_server_refresh_info (CamelIMAPXServer *is, CamelFolder *folder, Came
 	if (g_ascii_strcasecmp(full_name, "INBOX") == 0)
 		job->pri += 10;
 
-	registered = imapx_register_job (is, job);
+	registered = imapx_register_job (is, job, error);
 
 	QUEUE_UNLOCK (is);
 
-	if (registered) {
-		imapx_run_job (is, job);
+	success = registered && imapx_run_job (is, job, error);
 
-		if (camel_folder_change_info_changed(job->u.refresh_info.changes))
-			camel_folder_changed (folder, job->u.refresh_info.changes);
-	}
+	if (success && camel_folder_change_info_changed(job->u.refresh_info.changes))
+		camel_folder_changed (folder, job->u.refresh_info.changes);
 
 	camel_folder_change_info_free(job->u.refresh_info.changes);
 
 	if (job->op)
 		camel_operation_unref (job->op);
 	g_free(job);
+
+	return success;
 }
 
 static void
@@ -5030,8 +5140,8 @@ imapx_sync_free_user(GArray *user_set)
 	g_array_free(user_set, TRUE);
 }
 
-static void
-imapx_server_sync_changes(CamelIMAPXServer *is, CamelFolder *folder, gint pri, CamelException *ex)
+static gboolean
+imapx_server_sync_changes(CamelIMAPXServer *is, CamelFolder *folder, gint pri, GError **error)
 {
 	guint i, on_orset, off_orset;
 	GPtrArray *uids;
@@ -5039,6 +5149,7 @@ imapx_server_sync_changes(CamelIMAPXServer *is, CamelFolder *folder, gint pri, C
 	CamelIMAPXMessageInfo *info;
 	CamelIMAPXJob *job;
 	gboolean registered;
+	gboolean success = TRUE;
 
 	/* We calculate two masks, a mask of all flags which have been
 	   turned off and a mask of all flags which have been turned
@@ -5054,7 +5165,7 @@ imapx_server_sync_changes(CamelIMAPXServer *is, CamelFolder *folder, gint pri, C
 
 	if (uids->len == 0) {
 		g_ptr_array_free (uids, TRUE);
-		return;
+		return TRUE;
 	}
 
 	off_orset = on_orset = 0;
@@ -5139,7 +5250,7 @@ imapx_server_sync_changes(CamelIMAPXServer *is, CamelFolder *folder, gint pri, C
 	}
 
 	if ((on_orset|off_orset) == 0 && on_user == NULL && off_user == NULL)
-		return;
+		return TRUE;
 
 	/* TODO above code should go into changes_start */
 
@@ -5158,19 +5269,17 @@ imapx_server_sync_changes(CamelIMAPXServer *is, CamelFolder *folder, gint pri, C
 	job->start = imapx_job_sync_changes_start;
 	job->pri = pri;
 	job->folder = folder;
-	job->ex = ex;
 	job->u.sync_changes.changed_uids = uids;
 	job->u.sync_changes.on_set = on_orset;
 	job->u.sync_changes.off_set = off_orset;
 	job->u.sync_changes.on_user = on_user;
 	job->u.sync_changes.off_user = off_user;
 
-	registered = imapx_register_job (is, job);
+	registered = imapx_register_job (is, job, error);
 
 	QUEUE_UNLOCK (is);
 
-	if (registered)
-		imapx_run_job(is, job);
+	success = registered && imapx_run_job (is, job, error);
 
 	g_free(job);
 
@@ -5179,27 +5288,30 @@ done:
 	imapx_sync_free_user(off_user);
 
 	camel_folder_free_uids (folder, uids);
+
+	return success;
 }
 
-void
-camel_imapx_server_sync_changes(CamelIMAPXServer *is, CamelFolder *folder, CamelException *ex)
+gboolean
+camel_imapx_server_sync_changes(CamelIMAPXServer *is, CamelFolder *folder, GError **error)
 {
-	imapx_server_sync_changes (is, folder, IMAPX_PRIORITY_SYNC_CHANGES, ex);
+	return imapx_server_sync_changes (is, folder, IMAPX_PRIORITY_SYNC_CHANGES, error);
 }
 
 /* expunge-uids? */
-void
-camel_imapx_server_expunge(CamelIMAPXServer *is, CamelFolder *folder, CamelException *ex)
+gboolean
+camel_imapx_server_expunge(CamelIMAPXServer *is, CamelFolder *folder, GError **error)
 {
 	CamelIMAPXJob *job;
 	gboolean registered;
+	gboolean success;
 
 	/* Do we really care to wait for this one to finish? */
 	QUEUE_LOCK (is);
 
 	if (imapx_is_job_in_queue (is, folder, IMAPX_JOB_EXPUNGE, NULL)) {
 		QUEUE_UNLOCK (is);
-		return;
+		return TRUE;
 	}
 
 	job = g_malloc0(sizeof(*job));
@@ -5207,16 +5319,16 @@ camel_imapx_server_expunge(CamelIMAPXServer *is, CamelFolder *folder, CamelExcep
 	job->start = imapx_job_expunge_start;
 	job->pri = IMAPX_PRIORITY_EXPUNGE;
 	job->folder = folder;
-	job->ex = ex;
 
-	registered = imapx_register_job (is, job);
+	registered = imapx_register_job (is, job, error);
 
 	QUEUE_UNLOCK (is);
 
-	if (registered)
-		imapx_run_job(is, job);
+	success = registered && imapx_run_job (is, job, error);
 
 	g_free(job);
+
+	return success;
 }
 
 static guint
@@ -5258,8 +5370,11 @@ imapx_list_cmp(gconstpointer ap, gconstpointer bp)
 }
 
 GPtrArray *
-camel_imapx_server_list(CamelIMAPXServer *is, const gchar *top, guint32 flags,
-			const gchar *ext, CamelException *ex)
+camel_imapx_server_list (CamelIMAPXServer *is,
+                         const gchar *top,
+                         guint32 flags,
+                         const gchar *ext,
+                         GError **error)
 {
 	CamelIMAPXJob *job;
 	GPtrArray *folders = NULL;
@@ -5271,7 +5386,6 @@ camel_imapx_server_list(CamelIMAPXServer *is, const gchar *top, guint32 flags,
 	job->type = IMAPX_JOB_LIST;
 	job->start = imapx_job_list_start;
 	job->pri = IMAPX_PRIORITY_LIST;
-	job->ex = ex;
 	job->u.list.ext = ext;
 	job->u.list.flags = flags;
 	job->u.list.folders = g_hash_table_new(imapx_name_hash, imapx_name_equal);
@@ -5285,9 +5399,7 @@ camel_imapx_server_list(CamelIMAPXServer *is, const gchar *top, guint32 flags,
 	if (flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST)
 		job->pri += 300;
 
-	if (imapx_register_job (is, job)) {
-		imapx_run_job (is, job);
-
+	if (imapx_submit_job (is, job, error)) {
 		folders = g_ptr_array_new();
 		g_hash_table_foreach(job->u.list.folders, imapx_list_flatten, folders);
 		qsort(folders->pdata, folders->len, sizeof(folders->pdata[0]), imapx_list_cmp);
@@ -5300,79 +5412,82 @@ camel_imapx_server_list(CamelIMAPXServer *is, const gchar *top, guint32 flags,
 	return folders;
 }
 
-void
-camel_imapx_server_manage_subscription (CamelIMAPXServer *is, const gchar *folder_name, gboolean subscribe, CamelException *ex)
+gboolean
+camel_imapx_server_manage_subscription (CamelIMAPXServer *is, const gchar *folder_name, gboolean subscribe, GError **error)
 {
 	CamelIMAPXJob *job;
+	gboolean success;
 
 	job = g_malloc0(sizeof(*job));
 	job->type = IMAPX_JOB_MANAGE_SUBSCRIPTION;
 	job->start = imapx_job_manage_subscription_start;
 	job->pri = IMAPX_PRIORITY_MANAGE_SUBSCRIPTION;
-	job->ex = ex;
 	job->u.manage_subscriptions.subscribe = subscribe;
 	job->u.manage_subscriptions.folder_name = folder_name;
 
-	if (imapx_register_job (is, job))
-		imapx_run_job (is, job);
+	success = imapx_submit_job (is, job, error);
 
 	g_free (job);
+
+	return success;
 }
 
-void
-camel_imapx_server_create_folder (CamelIMAPXServer *is, const gchar *folder_name, CamelException *ex)
+gboolean
+camel_imapx_server_create_folder (CamelIMAPXServer *is, const gchar *folder_name, GError **error)
 {
 	CamelIMAPXJob *job;
+	gboolean success;
 
 	job = g_malloc0(sizeof(*job));
 	job->type = IMAPX_JOB_CREATE_FOLDER;
 	job->start = imapx_job_create_folder_start;
 	job->pri = IMAPX_PRIORITY_CREATE_FOLDER;
-	job->ex = ex;
 	job->u.folder_name = folder_name;
 
-	if (imapx_register_job (is, job))
-		imapx_run_job (is, job);
+	success = imapx_submit_job (is, job, error);
 
 	g_free (job);
+
+	return success;
 }
 
-void
-camel_imapx_server_delete_folder (CamelIMAPXServer *is, const gchar *folder_name, CamelException *ex)
+gboolean
+camel_imapx_server_delete_folder (CamelIMAPXServer *is, const gchar *folder_name, GError **error)
 {
 	CamelIMAPXJob *job;
+	gboolean success;
 
 	job = g_malloc0(sizeof(*job));
 	job->type = IMAPX_JOB_DELETE_FOLDER;
 	job->start = imapx_job_delete_folder_start;
 	job->pri = IMAPX_PRIORITY_DELETE_FOLDER;
-	job->ex = ex;
 	job->u.folder_name = folder_name;
 
-	if (imapx_register_job (is, job))
-		imapx_run_job (is, job);
+	success = imapx_submit_job (is, job, error);
 
 	g_free (job);
+
+	return success;
 }
 
-void
-camel_imapx_server_rename_folder (CamelIMAPXServer *is, const gchar *old_name, const gchar *new_name, CamelException *ex)
+gboolean
+camel_imapx_server_rename_folder (CamelIMAPXServer *is, const gchar *old_name, const gchar *new_name, GError **error)
 {
 	CamelIMAPXJob *job;
+	gboolean success;
 
 	job = g_malloc0(sizeof(*job));
 	job->type = IMAPX_JOB_RENAME_FOLDER;
 	job->start = imapx_job_rename_folder_start;
 	job->pri = IMAPX_PRIORITY_RENAME_FOLDER;
-	job->ex = ex;
 	job->u.rename_folder.ofolder_name = old_name;
 	job->u.rename_folder.nfolder_name = new_name;
 
-	if (imapx_register_job (is, job))
-		imapx_run_job (is, job);
+	success = imapx_submit_job (is, job, error);
 
 	g_free (job);
 
+	return success;
 }
 
 IMAPXJobQueueInfo *
diff --git a/camel/providers/imapx/camel-imapx-server.h b/camel/providers/imapx/camel-imapx-server.h
index 24393a6..2713c6b 100644
--- a/camel/providers/imapx/camel-imapx-server.h
+++ b/camel/providers/imapx/camel-imapx-server.h
@@ -142,61 +142,61 @@ CamelIMAPXServer *
 		camel_imapx_server_new		(CamelStore *store,
 						 CamelURL *url);
 gboolean	camel_imapx_server_connect	(CamelIMAPXServer *is,
-						 CamelException *ex);
+						 GError **error);
 gboolean	imapx_connect_to_server		(CamelIMAPXServer *is,
-						 CamelException *ex);
+						 GError **error);
 GPtrArray *	camel_imapx_server_list		(CamelIMAPXServer *is,
 						 const gchar *top,
 						 guint32 flags,
 						 const gchar *ext,
-						 CamelException *ex);
-void		camel_imapx_server_refresh_info	(CamelIMAPXServer *is,
+						 GError **error);
+gboolean	camel_imapx_server_refresh_info	(CamelIMAPXServer *is,
 						 CamelFolder *folder,
-						 CamelException *ex);
-void		camel_imapx_server_sync_changes	(CamelIMAPXServer *is,
+						 GError **error);
+gboolean	camel_imapx_server_sync_changes	(CamelIMAPXServer *is,
 						 CamelFolder *folder,
-						 CamelException *ex);
-void		camel_imapx_server_expunge	(CamelIMAPXServer *is,
+						 GError **error);
+gboolean	camel_imapx_server_expunge	(CamelIMAPXServer *is,
 						 CamelFolder *folder,
-						 CamelException *ex);
-void		camel_imapx_server_noop		(CamelIMAPXServer *is,
+						 GError **error);
+gboolean	camel_imapx_server_noop		(CamelIMAPXServer *is,
 						 CamelFolder *folder,
-						 CamelException *ex);
+						 GError **error);
 CamelStream *	camel_imapx_server_get_message	(CamelIMAPXServer *is,
 						 CamelFolder *folder,
 						 const gchar *uid,
-						 CamelException *ex);
-void		camel_imapx_server_copy_message	(CamelIMAPXServer *is,
+						 GError **error);
+gboolean	camel_imapx_server_copy_message	(CamelIMAPXServer *is,
 						 CamelFolder *source,
 						 CamelFolder *dest,
 						 GPtrArray *uids,
 						 gboolean delete_originals,
-						 CamelException *ex);
-void		camel_imapx_server_append_message
+						 GError **error);
+gboolean	camel_imapx_server_append_message
 						(CamelIMAPXServer *is,
 						 CamelFolder *folder,
 						 CamelMimeMessage *message,
 						 const CamelMessageInfo *mi,
-						 CamelException *ex);
-void		camel_imapx_server_sync_message (CamelIMAPXServer *is,
+						 GError **error);
+gboolean	camel_imapx_server_sync_message (CamelIMAPXServer *is,
 						 CamelFolder *folder,
 						 const gchar *uid,
-						 CamelException *ex);
-void		camel_imapx_server_manage_subscription
+						 GError **error);
+gboolean	camel_imapx_server_manage_subscription
 						(CamelIMAPXServer *is,
 						 const gchar *folder_name,
 						 gboolean subscribe,
-						 CamelException *ex);
-void		camel_imapx_server_create_folder(CamelIMAPXServer *is,
+						 GError **error);
+gboolean	camel_imapx_server_create_folder(CamelIMAPXServer *is,
 						 const gchar *folder_name,
-						 CamelException *ex);
-void		camel_imapx_server_delete_folder(CamelIMAPXServer *is,
+						 GError **error);
+gboolean	camel_imapx_server_delete_folder(CamelIMAPXServer *is,
 						 const gchar *folder_name,
-						 CamelException *ex);
-void		camel_imapx_server_rename_folder(CamelIMAPXServer *is,
+						 GError **error);
+gboolean	camel_imapx_server_rename_folder(CamelIMAPXServer *is,
 						 const gchar *old_name,
 						 const gchar *new_name,
-						 CamelException *ex);
+						 GError **error);
 struct _IMAPXJobQueueInfo *	
 		camel_imapx_server_get_job_queue_info
 						(CamelIMAPXServer *is);
diff --git a/camel/providers/imapx/camel-imapx-store.c b/camel/providers/imapx/camel-imapx-store.c
index 367ed66..88de8a4 100644
--- a/camel/providers/imapx/camel-imapx-store.c
+++ b/camel/providers/imapx/camel-imapx-store.c
@@ -43,7 +43,6 @@
 
 #include "camel-imapx-store.h"
 #include "camel-imapx-folder.h"
-#include "camel-imapx-exception.h"
 #include "camel-imapx-utils.h"
 #include "camel-imapx-server.h"
 #include "camel-imapx-summary.h"
@@ -130,14 +129,14 @@ imapx_store_finalize (GObject *object)
 }
 
 static gboolean
-imapx_construct(CamelService *service, CamelSession *session, CamelProvider *provider, CamelURL *url, CamelException *ex)
+imapx_construct(CamelService *service, CamelSession *session, CamelProvider *provider, CamelURL *url, GError **error)
 {
 	gchar *summary;
 	CamelIMAPXStore *store = (CamelIMAPXStore *)service;
 	CamelServiceClass *service_class;
 
 	service_class = CAMEL_SERVICE_CLASS (camel_imapx_store_parent_class);
-	if (!service_class->construct (service, session, provider, url, ex))
+	if (!service_class->construct (service, session, provider, url, error))
 		return FALSE;
 
 	store->base_url = camel_url_to_string (service->url, (CAMEL_URL_HIDE_PASSWORD |
@@ -146,7 +145,7 @@ imapx_construct(CamelService *service, CamelSession *session, CamelProvider *pro
 	imapx_parse_receiving_options (store, service->url);
 
 	store->summary = camel_imapx_store_summary_new();
-	store->storage_path = camel_session_get_storage_path(session, service, ex);
+	store->storage_path = camel_session_get_storage_path(session, service, error);
 
 	if (store->storage_path == NULL)
 		return FALSE;
@@ -163,7 +162,7 @@ imapx_construct(CamelService *service, CamelSession *session, CamelProvider *pro
 extern CamelServiceAuthType camel_imapx_password_authtype;
 
 static GList *
-imapx_query_auth_types (CamelService *service, CamelException *ex)
+imapx_query_auth_types (CamelService *service, GError **error)
 {
 	CamelIMAPXStore *istore = CAMEL_IMAPX_STORE (service);
 	CamelServiceAuthType *authtype;
@@ -171,8 +170,10 @@ imapx_query_auth_types (CamelService *service, CamelException *ex)
 	gboolean connected;
 
 	if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
-		camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-				     _("You must be working online to complete this operation"));
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
+			_("You must be working online to complete this operation"));
 		return NULL;
 	}
 
@@ -183,7 +184,7 @@ imapx_query_auth_types (CamelService *service, CamelException *ex)
 
 	connected = istore->server->stream != NULL;
 	if (!connected)
-		connected = imapx_connect_to_server (istore->server, ex);
+		connected = imapx_connect_to_server (istore->server, error);
 	camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
 	if (!connected)
 		return NULL;
@@ -213,13 +214,13 @@ imapx_get_name (CamelService *service, gboolean brief)
 }
 
 CamelIMAPXServer *
-camel_imapx_store_get_server(CamelIMAPXStore *store, CamelException *ex)
+camel_imapx_store_get_server(CamelIMAPXStore *store, GError **error)
 {
 	CamelIMAPXServer *server = NULL;
 
 	camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	if (store->server && camel_imapx_server_connect(store->server, ex)) {
+	if (store->server && camel_imapx_server_connect(store->server, NULL)) {
 		g_object_ref(store->server);
 		server = store->server;
 	} else {
@@ -229,7 +230,7 @@ camel_imapx_store_get_server(CamelIMAPXStore *store, CamelException *ex)
 		}
 
 		server = camel_imapx_server_new(CAMEL_STORE(store), CAMEL_SERVICE(store)->url);
-		if (camel_imapx_server_connect(server, ex)) {
+		if (camel_imapx_server_connect(server, error)) {
 			store->server = server;
 			g_object_ref(server);
 		} else {
@@ -242,12 +243,12 @@ camel_imapx_store_get_server(CamelIMAPXStore *store, CamelException *ex)
 }
 
 static gboolean
-imapx_connect (CamelService *service, CamelException *ex)
+imapx_connect (CamelService *service, GError **error)
 {
 	CamelIMAPXStore *istore = (CamelIMAPXStore *)service;
 	CamelIMAPXServer *server;
 
-	server = camel_imapx_store_get_server(istore, ex);
+	server = camel_imapx_store_get_server(istore, error);
 	if (server) {
 		g_object_unref(server);
 		return TRUE;
@@ -257,13 +258,14 @@ imapx_connect (CamelService *service, CamelException *ex)
 }
 
 static gboolean
-imapx_disconnect (CamelService *service, gboolean clean, CamelException *ex)
+imapx_disconnect (CamelService *service, gboolean clean, GError **error)
 {
 	CamelIMAPXStore *istore = CAMEL_IMAPX_STORE (service);
 	CamelServiceClass *service_class;
 
 	service_class = CAMEL_SERVICE_CLASS (camel_imapx_store_parent_class);
-	service_class->disconnect (service, clean, ex);
+	if (!service_class->disconnect (service, clean, error))
+		return FALSE;
 
 	camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
 
@@ -278,13 +280,13 @@ imapx_disconnect (CamelService *service, gboolean clean, CamelException *ex)
 }
 
 static CamelFolder *
-imapx_get_junk(CamelStore *store, CamelException *ex)
+imapx_get_junk(CamelStore *store, GError **error)
 {
 	CamelFolder *folder;
 	CamelStoreClass *store_class;
 
 	store_class = CAMEL_STORE_CLASS (camel_imapx_store_parent_class);
-	folder = store_class->get_junk (store, ex);
+	folder = store_class->get_junk (store, error);
 
 	if (folder) {
 		CamelObject *object = CAMEL_OBJECT (folder);
@@ -300,13 +302,13 @@ imapx_get_junk(CamelStore *store, CamelException *ex)
 }
 
 static CamelFolder *
-imapx_get_trash (CamelStore *store, CamelException *ex)
+imapx_get_trash (CamelStore *store, GError **error)
 {
 	CamelFolder *folder;
 	CamelStoreClass *store_class;
 
 	store_class = CAMEL_STORE_CLASS (camel_imapx_store_parent_class);
-	folder = store_class->get_trash (store, ex);
+	folder = store_class->get_trash (store, error);
 
 	if (folder) {
 		CamelObject *object = CAMEL_OBJECT (folder);
@@ -322,20 +324,22 @@ imapx_get_trash (CamelStore *store, CamelException *ex)
 }
 
 static gboolean
-imapx_noop (CamelStore *store, CamelException *ex)
+imapx_noop (CamelStore *store, GError **error)
 {
 	CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
 	CamelIMAPXServer *server;
+	gboolean success = FALSE;
 
 	if (CAMEL_OFFLINE_STORE(store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
 		return TRUE;
 
-	server = camel_imapx_store_get_server(istore, ex);
+	server = camel_imapx_store_get_server(istore, error);
 	if (server) {
-		camel_imapx_server_noop (server, NULL, ex);
+		success = camel_imapx_server_noop (server, NULL, error);
 		g_object_unref(server);
 	}
-	return TRUE;
+
+	return success;
 }
 
 static guint
@@ -361,7 +365,7 @@ imapx_compare_folder_name (gconstpointer a, gconstpointer b)
 
 static CamelFolder *
 get_folder_offline (CamelStore *store, const gchar *folder_name,
-		    guint32 flags, CamelException *ex)
+		    guint32 flags, GError **error)
 {
 	CamelIMAPXStore *imapx_store = CAMEL_IMAPX_STORE (store);
 	CamelFolder *new_folder = NULL;
@@ -385,40 +389,37 @@ get_folder_offline (CamelStore *store, const gchar *folder_name,
 		folder_dir = imapx_path_to_physical (storage_path, folder_name);
 		g_free(storage_path);
 		/* FIXME */
-		new_folder = camel_imapx_folder_new (store, folder_dir, folder_name, ex);
+		new_folder = camel_imapx_folder_new (store, folder_dir, folder_name, error);
 
 		g_free(folder_dir);
 		camel_store_summary_info_free((CamelStoreSummary *)imapx_store->summary, si);
 	} else {
-		camel_exception_setv (ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
-				      _("No such folder %s"), folder_name);
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
+			_("No such folder %s"), folder_name);
 	}
 
 	return new_folder;
 }
 
 static CamelFolder *
-imapx_get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, CamelException *ex)
+imapx_get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, GError **error)
 {
 	CamelFolder *folder;
 
-	folder = get_folder_offline(store, folder_name, flags, ex);
+	folder = get_folder_offline(store, folder_name, flags, NULL);
 	if (folder == NULL) {
-		camel_exception_setv(ex, 2, "No such folder: %s", folder_name);
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
+			_("No such folder: %s"), folder_name);
 		return NULL;
 	}
 
 	return folder;
 }
 
-static CamelFolder *
-imapx_get_inbox(CamelStore *store, CamelException *ex)
-{
-	camel_exception_setv(ex, 1, "get_inbox::unimplemented");
-
-	return NULL;
-}
-
 /* folder_name is path name */
 static CamelFolderInfo *
 imapx_build_folder_info (CamelIMAPXStore *imapx_store, const gchar *folder_name)
@@ -540,7 +541,7 @@ imapx_match_pattern(CamelIMAPXStoreNamespace *ns, const gchar *pattern, const gc
 }
 
 static void
-imapx_unmark_folder_subscribed (CamelIMAPXStore *istore, const gchar *folder_name, gboolean emit_signal, CamelException *ex)
+imapx_unmark_folder_subscribed (CamelIMAPXStore *istore, const gchar *folder_name, gboolean emit_signal)
 {
 	CamelStoreInfo *si;
 
@@ -564,7 +565,7 @@ imapx_unmark_folder_subscribed (CamelIMAPXStore *istore, const gchar *folder_nam
 }
 
 static void
-imapx_mark_folder_subscribed (CamelIMAPXStore *istore, const gchar *folder_name, gboolean emit_signal, CamelException *ex)
+imapx_mark_folder_subscribed (CamelIMAPXStore *istore, const gchar *folder_name, gboolean emit_signal)
 {
 	CamelStoreInfo *si;
 
@@ -588,72 +589,65 @@ imapx_mark_folder_subscribed (CamelIMAPXStore *istore, const gchar *folder_name,
 }
 
 static gboolean
-imapx_subscribe_folder (CamelStore *store, const gchar *folder_name, gboolean emit_signal, CamelException *ex)
+imapx_subscribe_folder (CamelStore *store, const gchar *folder_name, gboolean emit_signal, GError **error)
 {
 	CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
 	CamelIMAPXServer *server;
+	gboolean success;
 
 	if (CAMEL_OFFLINE_STORE(store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
 		return TRUE;
 
-	server = camel_imapx_store_get_server(istore, ex);
+	server = camel_imapx_store_get_server(istore, error);
 	if (!server)
 		return FALSE;
 
-	camel_imapx_server_manage_subscription (server, folder_name, TRUE, ex);
+	success = camel_imapx_server_manage_subscription (server, folder_name, TRUE, error);
 	g_object_unref(server);
 
-	if (!camel_exception_is_set (ex)) {
-		imapx_mark_folder_subscribed (istore, folder_name, emit_signal, ex);
-		return TRUE;
-	}
+	if (success)
+		imapx_mark_folder_subscribed (istore, folder_name, emit_signal);
 
-	return FALSE;
+	return success;
 }
 
 static gboolean
-imapx_unsubscribe_folder (CamelStore *store, const gchar *folder_name, gboolean emit_signal, CamelException *ex)
+imapx_unsubscribe_folder (CamelStore *store, const gchar *folder_name, gboolean emit_signal, GError **error)
 {
 	CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
 	CamelIMAPXServer *server;
+	gboolean success;
 
 	if (CAMEL_OFFLINE_STORE(store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
 		return TRUE;
 
-	server = camel_imapx_store_get_server(istore, ex);
+	server = camel_imapx_store_get_server(istore, error);
 	if (!server)
 		return FALSE;
 
-	camel_imapx_server_manage_subscription (server, folder_name, FALSE, ex);
+	success = camel_imapx_server_manage_subscription (server, folder_name, FALSE, error);
 	g_object_unref(server);
 
-	if (!camel_exception_is_set (ex)) {
-		imapx_unmark_folder_subscribed (istore, folder_name, emit_signal, ex);
-		return TRUE;
-	}
+	if (success)
+		imapx_unmark_folder_subscribed (istore, folder_name, emit_signal);
 
-	return FALSE;
+	return success;
 }
 
 static gboolean
-imapx_store_subscribe_folder (CamelStore *store, const gchar *folder_name, CamelException *ex)
+imapx_store_subscribe_folder (CamelStore *store, const gchar *folder_name, GError **error)
 {
-	return imapx_subscribe_folder (store, folder_name, TRUE, ex);
+	return imapx_subscribe_folder (store, folder_name, TRUE, error);
 }
 
 static gboolean
-imapx_store_unsubscribe_folder (CamelStore *store, const gchar *folder_name, CamelException *ex)
+imapx_store_unsubscribe_folder (CamelStore *store, const gchar *folder_name, GError **error)
 {
-	CamelException eex = CAMEL_EXCEPTION_INITIALISER;
-
-	if (!ex)
-		ex = &eex;
-
-	return imapx_unsubscribe_folder (store, folder_name, TRUE, ex);
+	return imapx_unsubscribe_folder (store, folder_name, TRUE, error);
 }
 
 static void
-imapx_delete_folder_from_cache (CamelIMAPXStore *istore, const gchar *folder_name, CamelException *ex)
+imapx_delete_folder_from_cache (CamelIMAPXStore *istore, const gchar *folder_name)
 {
 	gchar *state_file;
 	gchar *folder_dir, *storage_path;
@@ -672,7 +666,7 @@ imapx_delete_folder_from_cache (CamelIMAPXStore *istore, const gchar *folder_nam
 	g_unlink (state_file);
 	g_free (state_file);
 
-	camel_db_delete_folder (((CamelStore *)istore)->cdb_w, folder_name, ex);
+	camel_db_delete_folder (((CamelStore *)istore)->cdb_w, folder_name, NULL);
 	g_rmdir (folder_dir);
 
 	state_file = g_strdup_printf("%s/subfolders", folder_dir);
@@ -692,33 +686,34 @@ imapx_delete_folder_from_cache (CamelIMAPXStore *istore, const gchar *folder_nam
 }
 
 static gboolean
-imapx_delete_folder (CamelStore *store, const gchar *folder_name, CamelException *ex)
+imapx_delete_folder (CamelStore *store, const gchar *folder_name, GError **error)
 {
 	CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
 	CamelIMAPXServer *server;
+	gboolean success;
 
 	if (CAMEL_OFFLINE_STORE (store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
-		camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-				     _("You must be working online to complete this operation"));
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
+			_("You must be working online to complete this operation"));
 		return FALSE;
 	}
-	server = camel_imapx_store_get_server(istore, ex);
+	server = camel_imapx_store_get_server(istore, error);
 	if (!server)
 		return FALSE;
 
-	camel_imapx_server_delete_folder (server, folder_name, ex);
+	success = camel_imapx_server_delete_folder (server, folder_name, error);
 	g_object_unref(server);
 
-	if (!camel_exception_is_set (ex)) {
-		imapx_delete_folder_from_cache (istore, folder_name, ex);
-		return FALSE;
-	}
+	if (success)
+		imapx_delete_folder_from_cache (istore, folder_name);
 
-	return TRUE;
+	return success;
 }
 
 static void
-rename_folder_info (CamelIMAPXStore *istore, const gchar *old_name, const gchar *new_name, CamelException *ex)
+rename_folder_info (CamelIMAPXStore *istore, const gchar *old_name, const gchar *new_name)
 {
 	gint i, count;
 	CamelStoreInfo *si;
@@ -751,37 +746,40 @@ rename_folder_info (CamelIMAPXStore *istore, const gchar *old_name, const gchar
 }
 
 static gboolean
-imapx_rename_folder (CamelStore *store, const gchar *old, const gchar *new, CamelException *ex)
+imapx_rename_folder (CamelStore *store, const gchar *old, const gchar *new, GError **error)
 {
 	CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
 	CamelIMAPXServer *server;
 	gchar *oldpath, *newpath, *storage_path;
+	gboolean success = FALSE;
 
 	if (CAMEL_OFFLINE_STORE (store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
-		camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-				     _("You must be working online to complete this operation"));
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
+			_("You must be working online to complete this operation"));
 		return FALSE;
 	}
 
 	if (istore->rec_options & IMAPX_SUBSCRIPTIONS)
-		imapx_unsubscribe_folder (store, old, FALSE, ex);
+		imapx_unsubscribe_folder (store, old, FALSE, NULL);
 
-	server = camel_imapx_store_get_server(istore, ex);
+	server = camel_imapx_store_get_server(istore, error);
 	if (server) {
-		camel_imapx_server_rename_folder (server, old, new, ex);
+		success = camel_imapx_server_rename_folder (server, old, new, error);
 		g_object_unref(server);
 	}
 
-	if (camel_exception_is_set (ex)) {
-		imapx_subscribe_folder (store, old, FALSE, ex);
+	if (!success) {
+		imapx_subscribe_folder (store, old, FALSE, NULL);
 		return FALSE;
 	}
 
 	/* rename summary, and handle broken server */
-	rename_folder_info(istore, old, new, ex);
+	rename_folder_info(istore, old, new);
 
 	if (istore->rec_options & IMAPX_SUBSCRIPTIONS)
-		imapx_subscribe_folder (store, new, FALSE, ex);
+		success = imapx_subscribe_folder (store, new, FALSE, error);
 
 	storage_path = g_strdup_printf("%s/folders", istore->storage_path);
 	oldpath = imapx_path_to_physical (storage_path, old);
@@ -797,11 +795,11 @@ imapx_rename_folder (CamelStore *store, const gchar *old, const gchar *new, Came
 	g_free (oldpath);
 	g_free (newpath);
 
-	return !camel_exception_is_set (ex);
+	return success;
 }
 
 static CamelFolderInfo *
-imapx_create_folder (CamelStore *store, const gchar *parent_name, const gchar *folder_name, CamelException *ex)
+imapx_create_folder (CamelStore *store, const gchar *parent_name, const gchar *folder_name, GError **error)
 {
 	CamelStoreInfo *si;
 	CamelIMAPXStoreNamespace *ns;
@@ -810,14 +808,17 @@ imapx_create_folder (CamelStore *store, const gchar *parent_name, const gchar *f
 	gchar *real_name, *full_name, *parent_real;
 	CamelFolderInfo *fi = NULL;
 	gchar dir_sep;
+	gboolean success;
 
 	if (CAMEL_OFFLINE_STORE (store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
-		camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-				     _("You must be working online to complete this operation"));
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
+			_("You must be working online to complete this operation"));
 		return NULL;
 	}
 
-	server = camel_imapx_store_get_server(istore, ex);
+	server = camel_imapx_store_get_server(istore, error);
 	if (!server)
 		return NULL;
 
@@ -831,25 +832,31 @@ imapx_create_folder (CamelStore *store, const gchar *parent_name, const gchar *f
 		dir_sep = '/';
 
 	if (strchr(folder_name, dir_sep)) {
-		camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_PATH,
-				      _("The folder name \"%s\" is invalid because it contains the character \"%c\""),
-				      folder_name, dir_sep);
+		g_set_error (
+			error, CAMEL_FOLDER_ERROR,
+			CAMEL_FOLDER_ERROR_INVALID_PATH,
+			_("The folder name \"%s\" is invalid because it contains the character \"%c\""),
+			folder_name, dir_sep);
 		g_object_unref(server);
 		return NULL;
 	}
 
 	parent_real = camel_imapx_store_summary_full_from_path(istore->summary, parent_name);
 	if (parent_real == NULL) {
-		camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_STATE,
-				     _("Unknown parent folder: %s"), parent_name);
+		g_set_error (
+			error, CAMEL_FOLDER_ERROR,
+			CAMEL_FOLDER_ERROR_INVALID_STATE,
+			_("Unknown parent folder: %s"), parent_name);
 		g_object_unref(server);
 		return NULL;
 	}
 
 	si = camel_store_summary_path ((CamelStoreSummary *)istore->summary, parent_name);
 	if (si && si->flags & CAMEL_STORE_INFO_FOLDER_NOINFERIORS) {
-		camel_exception_set (ex, CAMEL_EXCEPTION_FOLDER_INVALID_STATE,
-				_("The parent folder is not allowed to contain subfolders"));
+		g_set_error (
+			error, CAMEL_FOLDER_ERROR,
+			CAMEL_FOLDER_ERROR_INVALID_STATE,
+			_("The parent folder is not allowed to contain subfolders"));
 		g_object_unref(server);
 		return NULL;
 	}
@@ -861,10 +868,10 @@ imapx_create_folder (CamelStore *store, const gchar *parent_name, const gchar *f
 	full_name = imapx_concat (istore, parent_real, real_name);
 	g_free(real_name);
 
-	camel_imapx_server_create_folder (server, full_name, ex);
+	success = camel_imapx_server_create_folder (server, full_name, error);
 	g_object_unref(server);
 
-	if (!camel_exception_is_set (ex)) {
+	if (!success) {
 		CamelIMAPXStoreInfo *si;
 
 		si = camel_imapx_store_summary_add_from_full(istore->summary, full_name, dir_sep);
@@ -882,7 +889,7 @@ imapx_create_folder (CamelStore *store, const gchar *parent_name, const gchar *f
 
 static CamelFolderInfo *
 get_folder_info_offline (CamelStore *store, const gchar *top,
-			 guint32 flags, CamelException *ex)
+			 guint32 flags, GError **error)
 {
 	CamelIMAPXStore *imapx_store = CAMEL_IMAPX_STORE (store);
 	gboolean include_inbox = FALSE;
@@ -1071,20 +1078,27 @@ imapx_get_folders_free(gpointer k, gpointer v, gpointer d)
 	camel_folder_info_free(v);
 }
 
-static void
-fetch_folders_for_pattern (CamelIMAPXStore *istore, CamelIMAPXServer *server, const gchar *pattern, guint32 flags,
-			   const gchar *ext, GHashTable *table, CamelException *ex)
+static gboolean
+fetch_folders_for_pattern (CamelIMAPXStore *istore,
+                           CamelIMAPXServer *server,
+                           const gchar *pattern,
+                           guint32 flags,
+                           const gchar *ext,
+                           GHashTable *table,
+                           GError **error)
 {
-	GPtrArray *folders = NULL;
+	GPtrArray *folders;
 
-	folders = camel_imapx_server_list (server, pattern, flags, ext, ex);
-	if (camel_exception_is_set (ex))
-		return;
+	folders = camel_imapx_server_list (server, pattern, flags, ext, error);
+	if (folders == NULL)
+		return FALSE;
 
 	add_folders_to_summary (istore, server, folders, table, (flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED));
 
 	g_ptr_array_foreach (folders, free_list, folders);
 	g_ptr_array_free (folders, TRUE);
+
+	return TRUE;
 }
 
 static GSList *
@@ -1106,13 +1120,13 @@ get_namespaces (CamelIMAPXStore *istore)
 }
 
 static GHashTable *
-fetch_folders_for_namespaces (CamelIMAPXStore *istore, const gchar *pattern, gboolean sync, CamelException *ex)
+fetch_folders_for_namespaces (CamelIMAPXStore *istore, const gchar *pattern, gboolean sync, GError **error)
 {
 	CamelIMAPXServer *server;
 	GHashTable *folders = NULL;
 	GSList *namespaces = NULL, *l;
 
-	server = camel_imapx_store_get_server(istore, ex);
+	server = camel_imapx_store_get_server(istore, error);
 	if (!server)
 		return NULL;
 
@@ -1143,8 +1157,7 @@ fetch_folders_for_namespaces (CamelIMAPXStore *istore, const gchar *pattern, gbo
 				list_ext = "RETURN (SUBSCRIBED)";
 
 			flags |= CAMEL_STORE_FOLDER_INFO_RECURSIVE;
-			fetch_folders_for_pattern (istore, server, pat, flags, list_ext, folders, ex);
-			if (camel_exception_is_set (ex)) {
+			if (!fetch_folders_for_pattern (istore, server, pat, flags, list_ext, folders, error)) {
 				g_free (pat);
 				goto exception;
 			}
@@ -1152,8 +1165,7 @@ fetch_folders_for_namespaces (CamelIMAPXStore *istore, const gchar *pattern, gbo
 				/* If the server doesn't support LIST-EXTENDED then we have to
 				   issue LSUB to list the subscribed folders separately */
 				flags |= CAMEL_STORE_FOLDER_INFO_SUBSCRIBED;
-				fetch_folders_for_pattern (istore, server, pat, flags, NULL, folders, ex);
-				if (camel_exception_is_set (ex)) {
+				if (!fetch_folders_for_pattern (istore, server, pat, flags, NULL, folders, error)) {
 					g_free (pat);
 					goto exception;
 				}
@@ -1176,15 +1188,15 @@ exception:
 	return NULL;
 }
 
-static void
-sync_folders (CamelIMAPXStore *istore, const gchar *pattern, gboolean sync, CamelException *ex)
+static gboolean
+sync_folders (CamelIMAPXStore *istore, const gchar *pattern, gboolean sync, GError **error)
 {
 	GHashTable *folders_from_server;
 	gint i, total;
 
-	folders_from_server = fetch_folders_for_namespaces (istore, pattern, sync, ex);
-	if (camel_exception_is_set (ex))
-		return;
+	folders_from_server = fetch_folders_for_namespaces (istore, pattern, sync, error);
+	if (folders_from_server == NULL)
+		return FALSE;
 
 	total = camel_store_summary_count ((CamelStoreSummary *) istore->summary);
 	for (i = 0; i < total; i++) {
@@ -1215,14 +1227,9 @@ sync_folders (CamelIMAPXStore *istore, const gchar *pattern, gboolean sync, Came
 				gchar *dup_folder_name = g_strdup (camel_store_info_path (istore->summary, si));
 
 				if (dup_folder_name) {
-					CamelException eex;
-
-					camel_exception_init (&eex);
-					imapx_unmark_folder_subscribed (istore,dup_folder_name, TRUE, &eex);
-					imapx_delete_folder_from_cache (istore, dup_folder_name, &eex);
-
+					imapx_unmark_folder_subscribed (istore,dup_folder_name, TRUE);
+					imapx_delete_folder_from_cache (istore, dup_folder_name);
 					g_free (dup_folder_name);
-					camel_exception_clear (&eex);
 				} else {
 					camel_store_summary_remove ((CamelStoreSummary *)istore->summary, si);
 				}
@@ -1236,13 +1243,15 @@ sync_folders (CamelIMAPXStore *istore, const gchar *pattern, gboolean sync, Came
 
 	g_hash_table_foreach (folders_from_server, imapx_get_folders_free, NULL);
 	g_hash_table_destroy (folders_from_server);
+
+	return TRUE;
 }
 
 struct _imapx_refresh_msg {
 	CamelSessionThreadMsg msg;
 
 	CamelStore *store;
-	CamelException ex;
+	GError *error;
 };
 
 static void
@@ -1254,11 +1263,11 @@ imapx_refresh_finfo (CamelSession *session, CamelSessionThreadMsg *msg)
 	if (CAMEL_OFFLINE_STORE(istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
 		return;
 
-	if (!camel_service_connect((CamelService *)istore, &m->ex))
+	if (!camel_service_connect((CamelService *)istore, &m->error))
 		return;
 
 	/* look in all namespaces */
-	sync_folders (istore, "", FALSE, &m->ex);
+	sync_folders (istore, "", FALSE, &m->error);
 	camel_store_summary_save ((CamelStoreSummary *)istore->summary);
 }
 
@@ -1268,7 +1277,7 @@ imapx_refresh_free(CamelSession *session, CamelSessionThreadMsg *msg)
 	struct _imapx_refresh_msg *m = (struct _imapx_refresh_msg *)msg;
 
 	g_object_unref (m->store);
-	camel_exception_clear(&m->ex);
+	g_clear_error (&m->error);
 }
 
 static CamelSessionThreadOps imapx_refresh_ops = {
@@ -1277,17 +1286,15 @@ static CamelSessionThreadOps imapx_refresh_ops = {
 };
 
 static void
-discover_inbox (CamelStore *store, CamelException *ex)
+discover_inbox (CamelStore *store)
 {
 	CamelStoreInfo *si;
 	CamelIMAPXStore *istore = (CamelIMAPXStore *)store;
 
 	si = camel_store_summary_path((CamelStoreSummary *) istore->summary, "INBOX");
 	if (si == NULL || (si->flags & CAMEL_FOLDER_SUBSCRIBED) == 0) {
-		imapx_subscribe_folder (store, "INBOX", FALSE, ex);
-
-		if (!camel_exception_is_set(ex) && !si)
-			sync_folders (istore, "INBOX", TRUE, ex);
+		if (imapx_subscribe_folder (store, "INBOX", FALSE, NULL) && !si)
+			sync_folders (istore, "INBOX", TRUE, NULL);
 
 		if (si)
 			camel_store_summary_info_free((CamelStoreSummary *) istore->summary, si);
@@ -1295,7 +1302,7 @@ discover_inbox (CamelStore *store, CamelException *ex)
 }
 
 static CamelFolderInfo *
-imapx_get_folder_info(CamelStore *store, const gchar *top, guint32 flags, CamelException *ex)
+imapx_get_folder_info(CamelStore *store, const gchar *top, guint32 flags, GError **error)
 {
 	CamelIMAPXStore *istore = (CamelIMAPXStore *)store;
 	CamelFolderInfo * fi= NULL;
@@ -1308,7 +1315,7 @@ imapx_get_folder_info(CamelStore *store, const gchar *top, guint32 flags, CamelE
 	g_mutex_lock (istore->get_finfo_lock);
 
 	if (CAMEL_OFFLINE_STORE(store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
-		fi = get_folder_info_offline (store, top, flags, ex);
+		fi = get_folder_info_offline (store, top, flags, error);
 
 		g_mutex_unlock (istore->get_finfo_lock);
 		return fi;
@@ -1325,24 +1332,22 @@ imapx_get_folder_info(CamelStore *store, const gchar *top, guint32 flags, CamelE
 
 			istore->last_refresh_time = time (NULL);
 			m = camel_session_thread_msg_new(((CamelService *)store)->session, &imapx_refresh_ops, sizeof(*m));
-			m->store = store;
-			g_object_ref (store);
-			camel_exception_init(&m->ex);
+			m->store = g_object_ref (store);
 			camel_session_thread_queue(((CamelService *)store)->session, &m->msg, 0);
 		}
 
-		fi = get_folder_info_offline (store, top, flags, ex);
+		fi = get_folder_info_offline (store, top, flags, error);
 		g_mutex_unlock (istore->get_finfo_lock);
 		return fi;
 	}
 
-	if (!camel_service_connect((CamelService *)store, ex)) {
+	if (!camel_service_connect((CamelService *)store, error)) {
 		g_mutex_unlock (istore->get_finfo_lock);
 		return NULL;
 	}
 
 	if (*top && flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST) {
-		fi = get_folder_info_offline (store, top, flags, ex);
+		fi = get_folder_info_offline (store, top, flags, error);
 		g_mutex_unlock (istore->get_finfo_lock);
 		return fi;
 	}
@@ -1364,8 +1369,7 @@ imapx_get_folder_info(CamelStore *store, const gchar *top, guint32 flags, CamelE
 		pattern[0] = '\0';
 	}
 
-	sync_folders (istore, pattern, TRUE, ex);
-	if (camel_exception_is_set (ex)) {
+	if (!sync_folders (istore, pattern, TRUE, error)) {
 		g_mutex_unlock (istore->get_finfo_lock);
 		return NULL;
 	}
@@ -1374,26 +1378,27 @@ imapx_get_folder_info(CamelStore *store, const gchar *top, guint32 flags, CamelE
 
 	/* ensure the INBOX is subscribed if lsub was preferred*/
 	if (initial_setup && istore->rec_options & IMAPX_SUBSCRIPTIONS)
-		discover_inbox (store, ex);
+		discover_inbox (store);
 
-	fi = get_folder_info_offline (store, top, flags, ex);
+	fi = get_folder_info_offline (store, top, flags, error);
 	g_mutex_unlock (istore->get_finfo_lock);
 	return fi;
 }
 
 static gboolean
-imapx_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, CamelException *ex)
+imapx_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, GError **error)
 {
 	CamelStoreClass *store_class;
 	gboolean res;
+	GError *local_error = NULL;
 
 	store_class = CAMEL_STORE_CLASS (camel_imapx_store_parent_class);
 
-	res = store_class->can_refresh_folder (store, info, ex) ||
+	res = store_class->can_refresh_folder (store, info, &local_error) ||
 	      (camel_url_get_param (((CamelService *)store)->url, "check_all") != NULL) ||
 	      (camel_url_get_param (((CamelService *)store)->url, "check_lsub") != NULL && (info->flags & CAMEL_FOLDER_SUBSCRIBED) != 0);
 
-	if (!res && !camel_exception_is_set (ex) && CAMEL_IS_IMAPX_STORE (store)) {
+	if (!res && local_error == NULL && CAMEL_IS_IMAPX_STORE (store)) {
 		CamelStoreInfo *si;
 		CamelStoreSummary *sm = CAMEL_STORE_SUMMARY (((CamelIMAPXStore *)(store))->summary);
 
@@ -1408,6 +1413,9 @@ imapx_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, CamelExcepti
 		}
 	}
 
+	if (local_error != NULL)
+		g_propagate_error (error, local_error);
+
 	return res;
 }
 
@@ -1450,7 +1458,6 @@ camel_imapx_store_class_init(CamelIMAPXStoreClass *class)
 	store_class->get_junk = imapx_get_junk;
 	store_class->noop = imapx_noop;
 	store_class->get_folder = imapx_get_folder;
-	store_class->get_inbox = imapx_get_inbox;
 	store_class->hash_folder_name = imapx_hash_folder_name;
 	store_class->compare_folder_name = imapx_compare_folder_name;
 	store_class->can_refresh_folder = imapx_can_refresh_folder;
diff --git a/camel/providers/imapx/camel-imapx-store.h b/camel/providers/imapx/camel-imapx-store.h
index 732e6b4..922c5f2 100644
--- a/camel/providers/imapx/camel-imapx-store.h
+++ b/camel/providers/imapx/camel-imapx-store.h
@@ -92,7 +92,7 @@ struct _CamelIMAPXStoreClass {
 };
 
 GType		camel_imapx_store_get_type (void);
-CamelIMAPXServer *camel_imapx_store_get_server(CamelIMAPXStore *store, CamelException *ex);
+CamelIMAPXServer *camel_imapx_store_get_server(CamelIMAPXStore *store, GError **error);
 
 G_END_DECLS
 
diff --git a/camel/providers/imapx/camel-imapx-stream.c b/camel/providers/imapx/camel-imapx-stream.c
index 0874d44..d1bd9b3 100644
--- a/camel/providers/imapx/camel-imapx-stream.c
+++ b/camel/providers/imapx/camel-imapx-stream.c
@@ -29,11 +29,10 @@
 #include <ctype.h>
 #include <errno.h>
 
-#include <glib.h>
+#include <glib/gi18n-lib.h>
 
 #include "camel-imapx-utils.h"
 #include "camel-imapx-stream.h"
-#include "camel-imapx-exception.h"
 
 #define t(x) camel_imapx_debug(token, x)
 #define io(x) camel_imapx_debug(io, x)
@@ -44,7 +43,8 @@
 G_DEFINE_TYPE (CamelIMAPXStream, camel_imapx_stream, CAMEL_TYPE_STREAM)
 
 static gint
-imapx_stream_fill (CamelIMAPXStream *is)
+imapx_stream_fill (CamelIMAPXStream *is,
+                   GError **error)
 {
 	gint left = 0;
 
@@ -53,7 +53,9 @@ imapx_stream_fill (CamelIMAPXStream *is)
 		memcpy(is->buf, is->ptr, left);
 		is->end = is->buf + left;
 		is->ptr = is->buf;
-		left = camel_stream_read(is->source, (gchar *) is->end, CAMEL_IMAPX_STREAM_SIZE - (is->end - is->buf));
+		left = camel_stream_read (
+			is->source, (gchar *) is->end,
+			CAMEL_IMAPX_STREAM_SIZE - (is->end - is->buf), error);
 		if (left > 0) {
 			is->end += left;
 			io(printf("camel_imapx_read: buffer is '%.*s'\n", (gint)(is->end - is->ptr), is->ptr));
@@ -66,6 +68,10 @@ imapx_stream_fill (CamelIMAPXStream *is)
 
 	io(printf("camel_imapx_read: -1\n"));
 
+	g_set_error (
+		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+		_("Source stream unavailable"));
+
 	return -1;
 }
 
@@ -97,7 +103,8 @@ imapx_stream_finalize (GObject *object)
 static gssize
 imapx_stream_read (CamelStream *stream,
                    gchar *buffer,
-                   gsize n)
+                   gsize n,
+                   GError **error)
 {
 	CamelIMAPXStream *is = (CamelIMAPXStream *)stream;
 	gssize max;
@@ -113,7 +120,7 @@ imapx_stream_read (CamelStream *stream,
 		is->ptr += max;
 	} else {
 		max = MIN(is->literal, n);
-		max = camel_stream_read(is->source, buffer, max);
+		max = camel_stream_read (is->source, buffer, max, error);
 		if (max <= 0)
 			return max;
 	}
@@ -128,24 +135,27 @@ imapx_stream_read (CamelStream *stream,
 static gssize
 imapx_stream_write (CamelStream *stream,
                     const gchar *buffer,
-                    gsize n)
+                    gsize n,
+                    GError **error)
 {
 	CamelIMAPXStream *is = (CamelIMAPXStream *)stream;
 
 	io(printf("camel_imapx_write: '%.*s'\n", (gint)n, buffer));
 
-	return camel_stream_write(is->source, buffer, n);
+	return camel_stream_write (is->source, buffer, n, error);
 }
 
 static gint
-imapx_stream_close (CamelStream *stream)
+imapx_stream_close (CamelStream *stream,
+                    GError **error)
 {
 	/* nop? */
 	return 0;
 }
 
 static gint
-imapx_stream_flush (CamelStream *stream)
+imapx_stream_flush (CamelStream *stream,
+                    GError **error)
 {
 	/* nop? */
 	return 0;
@@ -160,7 +170,8 @@ imapx_stream_eos (CamelStream *stream)
 }
 
 static gint
-imapx_stream_reset (CamelStream *stream)
+imapx_stream_reset (CamelStream *stream,
+                    GError **error)
 {
 	/* nop?  reset literal mode? */
 	return 0;
@@ -213,6 +224,19 @@ camel_imapx_stream_new(CamelStream *source)
 	return (CamelStream *)is;
 }
 
+GQuark
+camel_imapx_error_quark (void)
+{
+	static GQuark quark = 0;
+
+	if (G_UNLIKELY (quark == 0)) {
+		const gchar *string = "camel-imapx-error-quark";
+		quark = g_quark_from_static_string (string);
+	}
+
+	return quark;
+}
+
 /* Returns if there is any data buffered that is ready for processing */
 gint
 camel_imapx_stream_buffered(CamelIMAPXStream *is)
@@ -234,7 +258,7 @@ skip_ws(CamelIMAPXStream *is, guchar *pp, guchar *pe)
 	do {
 		while (p >= e ) {
 			is->ptr = p;
-			if (imapx_stream_fill(is) == IMAPX_TOK_ERROR)
+			if (imapx_stream_fill(is, NULL) == IMAPX_TOK_ERROR)
 				return IMAPX_TOK_ERROR;
 			p = is->ptr;
 			e = is->end;
@@ -252,12 +276,12 @@ skip_ws(CamelIMAPXStream *is, guchar *pp, guchar *pe)
 /* FIXME: these should probably handle it themselves,
    and get rid of the token interface? */
 gint
-camel_imapx_stream_atom(CamelIMAPXStream *is, guchar **data, guint *lenp, CamelException *ex)
+camel_imapx_stream_atom(CamelIMAPXStream *is, guchar **data, guint *lenp, GError **error)
 {
 	guchar *p, c;
 
 	/* this is only 'approximate' atom */
-	switch (camel_imapx_stream_token(is, data, lenp, ex)) {
+	switch (camel_imapx_stream_token(is, data, lenp, NULL)) {
 	case IMAPX_TOK_TOKEN:
 		p = *data;
 		while ((c = *p))
@@ -267,7 +291,7 @@ camel_imapx_stream_atom(CamelIMAPXStream *is, guchar **data, guint *lenp, CamelE
 	case IMAPX_TOK_ERROR:
 		return IMAPX_TOK_ERROR;
 	default:
-		camel_exception_set (ex, 1, "expecting atom");
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "expecting atom");
 		io(printf("expecting atom!\n"));
 		return IMAPX_TOK_PROTOCOL;
 	}
@@ -275,13 +299,13 @@ camel_imapx_stream_atom(CamelIMAPXStream *is, guchar **data, guint *lenp, CamelE
 
 /* gets an atom, a quoted_string, or a literal */
 gint
-camel_imapx_stream_astring(CamelIMAPXStream *is, guchar **data, CamelException *ex)
+camel_imapx_stream_astring(CamelIMAPXStream *is, guchar **data, GError **error)
 {
 	guchar *p, *start;
 	guint len, inlen;
 	gint ret;
 
-	switch (camel_imapx_stream_token(is, data, &len, ex)) {
+	switch (camel_imapx_stream_token(is, data, &len, NULL)) {
 	case IMAPX_TOK_TOKEN:
 	case IMAPX_TOK_INT:
 	case IMAPX_TOK_STRING:
@@ -289,7 +313,7 @@ camel_imapx_stream_astring(CamelIMAPXStream *is, guchar **data, CamelException *
 	case IMAPX_TOK_LITERAL:
 		/* FIXME: just grow buffer */
 		if (len >= CAMEL_IMAPX_STREAM_TOKEN) {
-			camel_exception_set (ex, 1, "astring: literal too long");
+			g_set_error (error, CAMEL_IMAPX_ERROR, 1, "astring: literal too long");
 			io(printf("astring too long\n"));
 			return IMAPX_TOK_PROTOCOL;
 		}
@@ -309,7 +333,7 @@ camel_imapx_stream_astring(CamelIMAPXStream *is, guchar **data, CamelException *
 		/* wont get unless no exception hanlder*/
 		return IMAPX_TOK_ERROR;
 	default:
-		camel_exception_set (ex, 1, "expecting astring");
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "expecting astring");
 		io(printf("expecting astring!\n"));
 		return IMAPX_TOK_PROTOCOL;
 	}
@@ -317,19 +341,19 @@ camel_imapx_stream_astring(CamelIMAPXStream *is, guchar **data, CamelException *
 
 /* check for NIL or (small) quoted_string or literal */
 gint
-camel_imapx_stream_nstring(CamelIMAPXStream *is, guchar **data, CamelException *ex)
+camel_imapx_stream_nstring(CamelIMAPXStream *is, guchar **data, GError **error)
 {
 	guchar *p, *start;
 	guint len, inlen;
 	gint ret;
 
-	switch (camel_imapx_stream_token(is, data, &len, ex)) {
+	switch (camel_imapx_stream_token(is, data, &len, NULL)) {
 	case IMAPX_TOK_STRING:
 		return 0;
 	case IMAPX_TOK_LITERAL:
 		/* FIXME: just grow buffer */
 		if (len >= CAMEL_IMAPX_STREAM_TOKEN) {
-			camel_exception_set (ex, 1, "nstring: literal too long");
+			g_set_error (error, CAMEL_IMAPX_ERROR, 1, "nstring: literal too long");
 			return IMAPX_TOK_PROTOCOL;
 		}
 		p = is->tokenptr;
@@ -351,7 +375,7 @@ camel_imapx_stream_nstring(CamelIMAPXStream *is, guchar **data, CamelException *
 			return 0;
 		}
 	default:
-		camel_exception_set (ex, 1, "expecting nstring");
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "expecting nstring");
 		return IMAPX_TOK_PROTOCOL;
 	case IMAPX_TOK_ERROR:
 		/* we'll never get this unless there are no exception  handlers anyway */
@@ -362,7 +386,7 @@ camel_imapx_stream_nstring(CamelIMAPXStream *is, guchar **data, CamelException *
 
 /* parse an nstring as a stream */
 gint
-camel_imapx_stream_nstring_stream(CamelIMAPXStream *is, CamelStream **stream, CamelException *ex)
+camel_imapx_stream_nstring_stream(CamelIMAPXStream *is, CamelStream **stream, GError **error)
 /* throws IO,PARSE exception */
 {
 	guchar *token;
@@ -372,7 +396,7 @@ camel_imapx_stream_nstring_stream(CamelIMAPXStream *is, CamelStream **stream, Ca
 
 	*stream = NULL;
 
-	switch (camel_imapx_stream_token(is, &token, &len, ex)) {
+	switch (camel_imapx_stream_token(is, &token, &len, NULL)) {
 		case IMAPX_TOK_STRING:
 			mem = camel_stream_mem_new_with_buffer((gchar *)token, len);
 			*stream = mem;
@@ -381,13 +405,12 @@ camel_imapx_stream_nstring_stream(CamelIMAPXStream *is, CamelStream **stream, Ca
 			/* if len is big, we could automatically use a file backing */
 			camel_imapx_stream_set_literal(is, len);
 			mem = camel_stream_mem_new();
-			if (camel_stream_write_to_stream((CamelStream *)is, mem) == -1) {
-				camel_exception_setv (ex, 1, "nstring: io error: %s", strerror(errno));
+			if (camel_stream_write_to_stream((CamelStream *)is, mem, error) == -1) {
 				g_object_unref (mem);
 				ret = -1;
 				break;
 			}
-			camel_stream_reset(mem);
+			camel_stream_reset(mem, NULL);
 			*stream = mem;
 			break;
 		case IMAPX_TOK_TOKEN:
@@ -397,20 +420,20 @@ camel_imapx_stream_nstring_stream(CamelIMAPXStream *is, CamelStream **stream, Ca
 			}
 		default:
 			ret = -1;
-			camel_exception_set (ex, 1, "nstring: token not string");
+			g_set_error (error, CAMEL_IMAPX_ERROR, 1, "nstring: token not string");
 	}
 
 	return ret;
 }
 
 guint64
-camel_imapx_stream_number(CamelIMAPXStream *is, CamelException *ex)
+camel_imapx_stream_number(CamelIMAPXStream *is, GError **error)
 {
 	guchar *token;
 	guint len;
 
-	if (camel_imapx_stream_token(is, &token, &len, ex) != IMAPX_TOK_INT) {
-		camel_exception_set (ex, 1, "expecting number");
+	if (camel_imapx_stream_token(is, &token, &len, NULL) != IMAPX_TOK_INT) {
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "expecting number");
 		return 0;
 	}
 
@@ -418,7 +441,7 @@ camel_imapx_stream_number(CamelIMAPXStream *is, CamelException *ex)
 }
 
 gint
-camel_imapx_stream_text(CamelIMAPXStream *is, guchar **text, CamelException *ex)
+camel_imapx_stream_text(CamelIMAPXStream *is, guchar **text, GError **error)
 {
 	GByteArray *build = g_byte_array_new();
 	guchar *token;
@@ -441,7 +464,7 @@ camel_imapx_stream_text(CamelIMAPXStream *is, guchar **text, CamelException *ex)
 	do {
 		tok = camel_imapx_stream_gets(is, &token, &len);
 		if (tok < 0) {
-			camel_exception_setv (ex, 1, "io error: %s", strerror(errno));
+			g_set_error (error, CAMEL_IMAPX_ERROR, 1, "io error: %s", strerror(errno));
 			*text = NULL;
 			g_byte_array_free(build, TRUE);
 			return -1;
@@ -460,7 +483,7 @@ camel_imapx_stream_text(CamelIMAPXStream *is, guchar **text, CamelException *ex)
 /* Get one token from the imap stream */
 camel_imapx_token_t
 /* throws IO,PARSE exception */
-camel_imapx_stream_token(CamelIMAPXStream *is, guchar **data, guint *len, CamelException *ex)
+camel_imapx_stream_token(CamelIMAPXStream *is, guchar **data, guint *len, GError **error)
 {
 	register guchar c, *p, *o, *oe;
 	guchar *e;
@@ -485,8 +508,8 @@ camel_imapx_stream_token(CamelIMAPXStream *is, guchar **data, guint *len, CamelE
 	do {
 		while (p >= e ) {
 			is->ptr = p;
-			if (imapx_stream_fill(is) == IMAPX_TOK_ERROR)
-				goto io_error;
+			if (imapx_stream_fill (is, error) == IMAPX_TOK_ERROR)
+				return IMAPX_TOK_ERROR;
 			p = is->ptr;
 			e = is->end;
 		}
@@ -519,8 +542,8 @@ camel_imapx_stream_token(CamelIMAPXStream *is, guchar **data, guint *len, CamelE
 							}
 						}
 						is->ptr = p;
-						if (imapx_stream_fill(is) == IMAPX_TOK_ERROR)
-							goto io_error;
+						if (imapx_stream_fill (is, error) == IMAPX_TOK_ERROR)
+							return IMAPX_TOK_ERROR;
 						p = is->ptr;
 						e = is->end;
 					}
@@ -534,8 +557,8 @@ camel_imapx_stream_token(CamelIMAPXStream *is, guchar **data, guint *len, CamelE
 				}
 			}
 			is->ptr = p;
-			if (imapx_stream_fill(is) == IMAPX_TOK_ERROR)
-				goto io_error;
+			if (imapx_stream_fill (is, error) == IMAPX_TOK_ERROR)
+				return IMAPX_TOK_ERROR;
 			p = is->ptr;
 			e = is->end;
 		}
@@ -548,8 +571,8 @@ camel_imapx_stream_token(CamelIMAPXStream *is, guchar **data, guint *len, CamelE
 				if (c == '\\') {
 					while (p >= e) {
 						is->ptr = p;
-						if (imapx_stream_fill(is) == IMAPX_TOK_ERROR)
-							goto io_error;
+						if (imapx_stream_fill (is, error) == IMAPX_TOK_ERROR)
+							return IMAPX_TOK_ERROR;
 						p = is->ptr;
 						e = is->end;
 					}
@@ -577,8 +600,8 @@ camel_imapx_stream_token(CamelIMAPXStream *is, guchar **data, guint *len, CamelE
 				}
 			}
 			is->ptr = p;
-			if (imapx_stream_fill(is) == IMAPX_TOK_ERROR)
-				goto io_error;
+			if (imapx_stream_fill (is, error) == IMAPX_TOK_ERROR)
+				return IMAPX_TOK_ERROR;
 			p = is->ptr;
 			e = is->end;
 		}
@@ -610,18 +633,13 @@ camel_imapx_stream_token(CamelIMAPXStream *is, guchar **data, guint *len, CamelE
 				}
 			}
 			is->ptr = p;
-			if (imapx_stream_fill(is) == IMAPX_TOK_ERROR)
-				goto io_error;
+			if (imapx_stream_fill (is, error) == IMAPX_TOK_ERROR)
+				return IMAPX_TOK_ERROR;
 			p = is->ptr;
 			e = is->end;
 		}
 	}
 
-	/* Had an i/o erorr */
-io_error:
-	camel_exception_set (ex, 1, "io error");
-	return IMAPX_TOK_ERROR;
-
 	/* Protocol error, skip until next lf? */
 protocol_error:
 	io(printf("Got protocol error\n"));
@@ -631,7 +649,7 @@ protocol_error:
 	else
 		is->ptr = p;
 
-	camel_exception_set (ex, 1, "protocol error");
+	g_set_error (error, CAMEL_IMAPX_ERROR, 1, "protocol error");
 	return IMAPX_TOK_PROTOCOL;
 }
 
@@ -655,7 +673,7 @@ gint camel_imapx_stream_gets(CamelIMAPXStream *is, guchar **start, guint *len)
 
 	max = is->end - is->ptr;
 	if (max == 0) {
-		max = imapx_stream_fill(is);
+		max = imapx_stream_fill(is, NULL);
 		if (max <= 0)
 			return max;
 	}
@@ -686,7 +704,7 @@ gint camel_imapx_stream_getl(CamelIMAPXStream *is, guchar **start, guint *len)
 	if (is->literal > 0) {
 		max = is->end - is->ptr;
 		if (max == 0) {
-			max = imapx_stream_fill(is);
+			max = imapx_stream_fill(is, NULL);
 			if (max <= 0)
 				return max;
 		}
@@ -706,14 +724,14 @@ gint camel_imapx_stream_getl(CamelIMAPXStream *is, guchar **start, guint *len)
 
 /* skip the rest of the line of tokens */
 gint
-camel_imapx_stream_skip(CamelIMAPXStream *is, CamelException *ex)
+camel_imapx_stream_skip(CamelIMAPXStream *is, GError **error)
 {
 	gint tok;
 	guchar *token;
 	guint len;
 
 	do {
-		tok = camel_imapx_stream_token(is, &token, &len, ex);
+		tok = camel_imapx_stream_token(is, &token, &len, error);
 		if (tok == IMAPX_TOK_LITERAL) {
 			camel_imapx_stream_set_literal(is, len);
 			while ((tok = camel_imapx_stream_getl(is, &token, &len)) > 0) {
diff --git a/camel/providers/imapx/camel-imapx-stream.h b/camel/providers/imapx/camel-imapx-stream.h
index e7e71c6..4b0f6a2 100644
--- a/camel/providers/imapx/camel-imapx-stream.h
+++ b/camel/providers/imapx/camel-imapx-stream.h
@@ -42,6 +42,9 @@
 	(G_TYPE_INSTANCE_GET_CLASS \
 	((obj), CAMEL_TYPE_IMAPX_STREAM, CamelIMAPXStreamClass))
 
+#define CAMEL_IMAPX_ERROR \
+	(camel_imapx_error_quark ())
+
 G_BEGIN_DECLS
 
 typedef struct _CamelIMAPXStream CamelIMAPXStream;
@@ -78,6 +81,7 @@ struct _CamelIMAPXStreamClass {
 };
 
 GType		camel_imapx_stream_get_type	(void);
+GQuark		camel_imapx_error_quark		(void) G_GNUC_CONST;
 CamelStream *	camel_imapx_stream_new		(CamelStream *source);
 gint		camel_imapx_stream_buffered	(CamelIMAPXStream *is);
 
@@ -86,7 +90,7 @@ camel_imapx_token_t
 		camel_imapx_stream_token	(CamelIMAPXStream *is,
 						 guchar **start,
 						 guint *len,
-						 CamelException *ex);
+						 GError **error);
 
 void		camel_imapx_stream_ungettoken	(CamelIMAPXStream *is,
 						 camel_imapx_token_t tok,
@@ -107,32 +111,32 @@ gint		 camel_imapx_stream_getl	(CamelIMAPXStream *is,
 gint		camel_imapx_stream_atom		(CamelIMAPXStream *is,
 						 guchar **start,
 						 guint *len,
-						 CamelException *ex);
+						 GError **error);
 /* gets an atom or string */
 gint		camel_imapx_stream_astring	(CamelIMAPXStream *is,
 						 guchar **start,
-						 CamelException *ex);
+						 GError **error);
 /* gets a NIL or a string, start==NULL if NIL */
 gint		camel_imapx_stream_nstring	(CamelIMAPXStream *is,
 						 guchar **start,
-						 CamelException *ex);
+						 GError **error);
 /* gets a NIL or string into a stream, stream==NULL if NIL */
 gint		camel_imapx_stream_nstring_stream
 						(CamelIMAPXStream *is,
 						 CamelStream **stream,
-						 CamelException *ex);
+						 GError **error);
 /* gets 'text' */
 gint		camel_imapx_stream_text		(CamelIMAPXStream *is,
 						 guchar **text,
-						 CamelException *ex);
+						 GError **error);
 
 /* gets a 'number' */
 guint64		 camel_imapx_stream_number	(CamelIMAPXStream *is,
-						 CamelException *ex);
+						 GError **error);
 
 /* skips the rest of a line, including literals, etc */
 gint		camel_imapx_stream_skip		(CamelIMAPXStream *is,
-						 CamelException *ex);
+						 GError **error);
 
 G_END_DECLS
 
diff --git a/camel/providers/imapx/camel-imapx-summary.c b/camel/providers/imapx/camel-imapx-summary.c
index e512722..18440e1 100644
--- a/camel/providers/imapx/camel-imapx-summary.c
+++ b/camel/providers/imapx/camel-imapx-summary.c
@@ -46,7 +46,7 @@ static gboolean info_set_user_flag (CamelMessageInfo *info, const gchar *id, gbo
 static CamelMessageContentInfo *content_info_migrate (CamelFolderSummary *s, FILE *in);
 
 static gint summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir);
-static CamelFIRecord * summary_header_to_db (CamelFolderSummary *s, CamelException *ex);
+static CamelFIRecord * summary_header_to_db (CamelFolderSummary *s, GError **error);
 static CamelMIRecord * message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info);
 static CamelMessageInfo * message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir);
 static gint content_info_to_db (CamelFolderSummary *s, CamelMessageContentInfo *info, CamelMIRecord *mir);
@@ -156,8 +156,7 @@ camel_imapx_summary_new (CamelFolder *folder, const gchar *filename)
 {
 	CamelStore *parent_store;
 	CamelFolderSummary *summary;
-	CamelException ex;
-	camel_exception_init (&ex);
+	GError *local_error = NULL;
 
 	parent_store = camel_folder_get_parent_store (folder);
 
@@ -174,13 +173,13 @@ camel_imapx_summary_new (CamelFolder *folder, const gchar *filename)
 	camel_folder_summary_set_build_content (summary, TRUE);
 	camel_folder_summary_set_filename (summary, filename);
 
-	if (camel_folder_summary_load_from_db (summary, &ex) == -1) {
+	if (camel_folder_summary_load_from_db (summary, &local_error) == -1) {
 		/* FIXME: Isn't this dangerous ? We clear the summary
 		if it cannot be loaded, for some random reason.
-		We need to pass the ex and find out why it is not loaded etc. ? */
+		We need to pass the error and find out why it is not loaded etc. ? */
 		camel_folder_summary_clear_db (summary);
-		g_message ("Unable to load summary: %s\n", camel_exception_get_description (&ex));
-		camel_exception_clear (&ex);
+		g_message ("Unable to load summary: %s\n", local_error->message);
+		g_clear_error (&local_error);
 	}
 
 	g_ptr_array_sort (summary->uids, (GCompareFunc) uid_compare);
@@ -277,7 +276,7 @@ summary_header_load (CamelFolderSummary *s, FILE *in)
 }
 
 static CamelFIRecord *
-summary_header_to_db (CamelFolderSummary *s, CamelException *ex)
+summary_header_to_db (CamelFolderSummary *s, GError **error)
 {
 	CamelIMAPXSummary *ims = CAMEL_IMAPX_SUMMARY(s);
 	CamelFolderSummaryClass *folder_summary_class;
@@ -286,7 +285,7 @@ summary_header_to_db (CamelFolderSummary *s, CamelException *ex)
 	folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (
 		camel_imapx_summary_parent_class);
 
-	fir = folder_summary_class->summary_header_to_db (s, ex);
+	fir = folder_summary_class->summary_header_to_db (s, error);
 	if (!fir)
 		return NULL;
 	fir->bdata = g_strdup_printf ("%d %llu %u %llu", CAMEL_IMAPX_SUMMARY_VERSION,
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index 3c43cfb..77d746d 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -8,7 +8,6 @@
 #include "camel-imapx-summary.h"
 #include "camel-imapx-store-summary.h"
 #include "camel-imapx-utils.h"
-#include "camel-imapx-exception.h"
 
 /* high-level parser state */
 #define p(x) camel_imapx_debug(parse, x)
@@ -77,7 +76,7 @@ static struct {
    shoudl this be part of imapx-driver? */
 /* mabye this should be a stream op? */
 void
-imapx_parse_flags(CamelIMAPXStream *stream, guint32 *flagsp, CamelFlag **user_flagsp, CamelException *ex)
+imapx_parse_flags(CamelIMAPXStream *stream, guint32 *flagsp, CamelFlag **user_flagsp, GError **error)
 /* throws IO,PARSE exception */
 {
 	gint tok, i;
@@ -87,10 +86,10 @@ imapx_parse_flags(CamelIMAPXStream *stream, guint32 *flagsp, CamelFlag **user_fl
 
 	*flagsp = flags;
 
-	tok = camel_imapx_stream_token(stream, &token, &len, ex);
+	tok = camel_imapx_stream_token(stream, &token, &len, NULL);
 	if (tok == '(') {
 		do {
-			tok = camel_imapx_stream_token(stream, &token, &len, ex);
+			tok = camel_imapx_stream_token(stream, &token, &len, NULL);
 			if (tok == IMAPX_TOK_TOKEN) {
 				p = token;
 				// FIXME: ascii_toupper
@@ -110,12 +109,12 @@ imapx_parse_flags(CamelIMAPXStream *stream, guint32 *flagsp, CamelFlag **user_fl
 			found:
 				tok = tok; /* fixes stupid warning */
 			} else if (tok != ')') {
-				camel_exception_set (ex, 1, "expecting flag");
+				g_set_error (error, CAMEL_IMAPX_ERROR, 1, "expecting flag");
 				return;
 			}
 		} while (tok != ')');
 	} else {
-		camel_exception_set (ex, 1, "expecting flag list");
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "execting flag list");
 		return;
 	}
 
@@ -158,14 +157,13 @@ rename_label_flag (const gchar *flag, gint len, gboolean server_to_evo)
 }
 
 void
-imapx_write_flags(CamelStream *stream, guint32 flags, CamelFlag *user_flags, CamelException *ex)
+imapx_write_flags(CamelStream *stream, guint32 flags, CamelFlag *user_flags, GError **error)
 /* throws IO exception */
 {
 	gint i;
 	gboolean first = TRUE;
 
-	if (camel_stream_write(stream, "(", 1) == -1) {
-		camel_exception_setv (ex, 1, "io error: %s", strerror(errno));
+	if (camel_stream_write(stream, "(", 1, error) == -1) {
 		return;
 	}
 
@@ -173,13 +171,11 @@ imapx_write_flags(CamelStream *stream, guint32 flags, CamelFlag *user_flags, Cam
 		if (flag_table[i].flag & flags) {
 			if (flags & CAMEL_IMAPX_MESSAGE_RECENT)
 				continue;
-			if (!first && camel_stream_write(stream, " ", 1) == -1) {
-				camel_exception_setv (ex, 1, "io error: %s", strerror(errno));
+			if (!first && camel_stream_write(stream, " ", 1, error) == -1) {
 				return;
 			}
 			first = FALSE;
-			if (camel_stream_write (stream, flag_table[i].name, strlen(flag_table[i].name)) == -1) {
-				camel_exception_setv (ex,1, "io error: %s", strerror(errno));
+			if (camel_stream_write (stream, flag_table[i].name, strlen(flag_table[i].name), error) == -1) {
 				return;
 			}
 
@@ -190,21 +186,18 @@ imapx_write_flags(CamelStream *stream, guint32 flags, CamelFlag *user_flags, Cam
 	while (user_flags) {
 		const gchar *flag_name = rename_label_flag (user_flags->name, strlen (user_flags->name), FALSE);
 
-		if (!first && camel_stream_write(stream, " ", 1) == -1) {
-			camel_exception_setv (ex, 1, "io error: %s", strerror(errno));
+		if (!first && camel_stream_write(stream, " ", 1, error) == -1) {
 			return;
 		}
 		first = FALSE;
-		if (camel_stream_write(stream, flag_name, strlen (flag_name)) == -1) {
-			camel_exception_setv (ex, 1, "io error: %s", strerror(errno));
+		if (camel_stream_write(stream, flag_name, strlen (flag_name), error) == -1) {
 			return;
 		}
 
 		user_flags = user_flags->next;
 	}
 
-	if (camel_stream_write(stream, ")", 1) == -1) {
-		camel_exception_setv (ex, 1, "io error: %s", strerror(errno));
+	if (camel_stream_write(stream, ")", 1, error) == -1) {
 		return;
 	}
 }
@@ -428,20 +421,21 @@ struct {
 };
 
 struct _capability_info *
-imapx_parse_capability(CamelIMAPXStream *stream, CamelException *ex)
+imapx_parse_capability(CamelIMAPXStream *stream, GError **error)
 {
 	gint tok, i;
 	guint len;
 	guchar *token, *p, c;
 	gboolean free_token = FALSE;
 	struct _capability_info * cinfo;
+	GError *local_error = NULL;
 
 	cinfo = g_malloc0(sizeof(*cinfo));
 	cinfo->auth_types = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL);
 
 	/* FIXME: handle auth types */
-	while ((tok = camel_imapx_stream_token(stream, &token, &len, ex)) != '\n' &&
-	       !camel_exception_is_set (ex)) {
+	while ((tok = camel_imapx_stream_token(stream, &token, &len, &local_error)) != '\n' &&
+		local_error == NULL) {
 		switch (tok) {
 			case ']':
 				/* Put it back so that imapx_untagged() isn't unhappy */
@@ -473,12 +467,13 @@ imapx_parse_capability(CamelIMAPXStream *stream, CamelException *ex)
 				free_token = FALSE;
 				break;
 			default:
-				camel_exception_set (ex, 1, "capability: expecting name");
+				g_set_error (error, CAMEL_IMAPX_ERROR, 1, "capability: expecting name");
 				break;
 		}
 	}
 
-	if (camel_exception_is_set (ex)) {
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
 		imapx_free_capability(cinfo);
 		cinfo = NULL;
 	}
@@ -493,7 +488,7 @@ void imapx_free_capability(struct _capability_info *cinfo)
 }
 
 struct _CamelIMAPXNamespaceList *
-imapx_parse_namespace_list (CamelIMAPXStream *stream, CamelException *ex)
+imapx_parse_namespace_list (CamelIMAPXStream *stream, GError **error)
 {
 	CamelIMAPXStoreNamespace *namespaces[3], *node, *tail;
 	CamelIMAPXNamespaceList *nsl = NULL;
@@ -507,18 +502,18 @@ imapx_parse_namespace_list (CamelIMAPXStream *stream, CamelException *ex)
 	nsl->shared = NULL;
 	nsl->other = NULL;
 
-	tok = camel_imapx_stream_token (stream, &token, &len, ex);
+	tok = camel_imapx_stream_token (stream, &token, &len, NULL);
 	do {
 		namespaces[n] = NULL;
 		tail = (CamelIMAPXStoreNamespace *) &namespaces[n];
 
 		if (tok == '(') {
-			tok = camel_imapx_stream_token (stream, &token, &len, ex);
+			tok = camel_imapx_stream_token (stream, &token, &len, NULL);
 
 			while (tok == '(') {
-				tok = camel_imapx_stream_token (stream, &token, &len, ex);
+				tok = camel_imapx_stream_token (stream, &token, &len, NULL);
 				if (tok != IMAPX_TOK_STRING) {
-					camel_exception_set (ex, 1, "namespace: expected a string path name");
+					g_set_error (error, 1, CAMEL_IMAPX_ERROR, "namespace: expected a string path name");
 					goto exception;
 				}
 
@@ -526,7 +521,7 @@ imapx_parse_namespace_list (CamelIMAPXStream *stream, CamelException *ex)
 				node->next = NULL;
 				node->path = g_strdup ((gchar *) token);
 
-				tok = camel_imapx_stream_token (stream, &token, &len, ex);
+				tok = camel_imapx_stream_token (stream, &token, &len, NULL);
 
 				if (tok == IMAPX_TOK_STRING) {
 					if (strlen ((gchar *) token) == 1) {
@@ -541,7 +536,7 @@ imapx_parse_namespace_list (CamelIMAPXStream *stream, CamelException *ex)
 					/* will a NIL be possible here? */
 					node->sep = '\0';
 				} else {
-					camel_exception_set (ex, 1, "namespace: expected a string separator");
+					g_set_error (error, CAMEL_IMAPX_ERROR, 1, "namespace: expected a string separtor");
 					g_free (node->path);
 					g_free (node);
 					goto exception;
@@ -560,28 +555,28 @@ imapx_parse_namespace_list (CamelIMAPXStream *stream, CamelException *ex)
 				/* TODO remove full_name later. not required */
 				node->full_name = g_strdup (node->path);
 
-				tok = camel_imapx_stream_token (stream, &token, &len, ex);
+				tok = camel_imapx_stream_token (stream, &token, &len, NULL);
 				if (tok != ')') {
-					camel_exception_set (ex, 1, "namespace: expected a ')'");
+					g_set_error (error, CAMEL_IMAPX_ERROR, 1, "namespace: expected a ')'");
 					goto exception;
 				}
 
-				tok = camel_imapx_stream_token (stream, &token, &len, ex);
+				tok = camel_imapx_stream_token (stream, &token, &len, NULL);
 			}
 
 			if (tok != ')') {
-				camel_exception_set (ex, 1, "namespace: expected a ')'");
+				g_set_error (error, CAMEL_IMAPX_ERROR, 1, "namespace: expected a ')'");
 				goto exception;
 			}
 
 		} else if (tok == IMAPX_TOK_TOKEN && !strcmp ((gchar *) token, "NIL")) {
 			namespaces [n] = NULL;
 		} else {
-			camel_exception_set (ex, 1, "namespace: expected either a '(' or NIL");
+			g_set_error (error, CAMEL_IMAPX_ERROR, 1, "namespace: expected either a '(' or NIL");
 			goto exception;
 		}
 
-		tok = camel_imapx_stream_token (stream, &token, &len, ex);
+		tok = camel_imapx_stream_token (stream, &token, &len, NULL);
 		n++;
 	} while (n < 3);
 
@@ -736,8 +731,8 @@ imapx_free_body(struct _CamelMessageContentInfo *cinfo)
 	g_free(cinfo);
 }
 
-void
-imapx_parse_param_list(CamelIMAPXStream *is, struct _camel_header_param **plist, CamelException *ex)
+gboolean
+imapx_parse_param_list(CamelIMAPXStream *is, struct _camel_header_param **plist, GError **error)
 {
 	gint tok;
 	guint len;
@@ -747,30 +742,33 @@ imapx_parse_param_list(CamelIMAPXStream *is, struct _camel_header_param **plist,
 	p(printf("body_fld_param\n"));
 
 	/* body_fld_param  ::= "(" 1#(string SPACE string) ")" / nil */
-	tok = camel_imapx_stream_token(is, &token, &len, ex);
+	tok = camel_imapx_stream_token(is, &token, &len, NULL);
 	if (tok == '(') {
 		while (1) {
-			tok = camel_imapx_stream_token(is, &token, &len, ex);
+			tok = camel_imapx_stream_token(is, &token, &len, NULL);
 			if (tok == ')')
 				break;
 			camel_imapx_stream_ungettoken(is, tok, token, len);
 
-			camel_imapx_stream_astring(is, &token, ex);
+			camel_imapx_stream_astring(is, &token, NULL);
 			param = alloca (strlen ((gchar *) token)+1);
 			strcpy(param, (gchar *) token);
-			camel_imapx_stream_astring(is, &token, ex);
+			camel_imapx_stream_astring(is, &token, NULL);
 			camel_header_set_param(plist, param, (gchar *) token);
 		}
 	} /* else check nil?  no need */
+
+	return TRUE;
 }
 
 struct _CamelContentDisposition *
-imapx_parse_ext_optional(CamelIMAPXStream *is, CamelException *ex)
+imapx_parse_ext_optional(CamelIMAPXStream *is, GError **error)
 {
 	gint tok;
 	guint len;
 	guchar *token;
 	struct _CamelContentDisposition *dinfo = NULL;
+	GError *local_error = NULL;
 
 	/* this parses both extension types, from the body_fld_dsp onwards */
 	/* although the grammars are different, they can be parsed the same way */
@@ -789,21 +787,21 @@ imapx_parse_ext_optional(CamelIMAPXStream *is, CamelException *ex)
 
 	/* body_fld_dsp    ::= "(" string SPACE body_fld_param ")" / nil */
 
-	tok = camel_imapx_stream_token(is, &token, &len, ex);
+	tok = camel_imapx_stream_token(is, &token, &len, NULL);
 	switch (tok) {
 		case '(':
 			dinfo = g_malloc0(sizeof(*dinfo));
 			dinfo->refcount = 1;
 			/* should be string */
-			camel_imapx_stream_astring(is, &token, ex);
+			camel_imapx_stream_astring(is, &token, NULL);
 
 			dinfo->disposition = g_strdup((gchar *) token);
-			imapx_parse_param_list(is, &dinfo->params, ex);
+			imapx_parse_param_list(is, &dinfo->params, NULL);
 		case IMAPX_TOK_TOKEN:
 			d(printf("body_fld_dsp: NIL\n"));
 			break;
 		default:
-			camel_exception_set (ex, 1, "body_fld_disp: expecting nil or list");
+			g_set_error (error, CAMEL_IMAPX_ERROR, 1, "body_fld_disp: expecting nil or list");
 			return NULL;
 	}
 
@@ -813,15 +811,16 @@ imapx_parse_ext_optional(CamelIMAPXStream *is, CamelException *ex)
 
 	/* we just drop the lang string/list, save it somewhere? */
 
-	tok = camel_imapx_stream_token(is, &token, &len, ex);
+	tok = camel_imapx_stream_token(is, &token, &len, &local_error);
 	switch (tok) {
 		case '(':
 			while (1) {
-				tok = camel_imapx_stream_token(is, &token, &len, ex);
+				tok = camel_imapx_stream_token(is, &token, &len, &local_error);
 				if (tok == ')') {
 					break;
 				} else if (tok != IMAPX_TOK_STRING) {
-					camel_exception_set (ex, 1, "expecting string");
+					g_clear_error (&local_error);
+					g_set_error (&local_error, CAMEL_IMAPX_ERROR, 1, "expecting string");
 					break;
 				}
 			}
@@ -843,20 +842,23 @@ imapx_parse_ext_optional(CamelIMAPXStream *is, CamelException *ex)
 
 	}
 
-	if camel_exception_is_set (ex) {
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
 		if (dinfo)
 			camel_content_disposition_unref(dinfo);
+		dinfo = NULL;
 	}
 
 	return dinfo;
 }
 
 struct _CamelMessageContentInfo *
-imapx_parse_body_fields(CamelIMAPXStream *is, CamelException *ex)
+imapx_parse_body_fields(CamelIMAPXStream *is, GError **error)
 {
 	guchar *token;
 	gchar  *type;
 	struct _CamelMessageContentInfo *cinfo;
+	GError *local_error = NULL;
 
 	/* body_fields     ::= body_fld_param SPACE body_fld_id SPACE
 	   body_fld_desc SPACE body_fld_enc SPACE
@@ -867,42 +869,38 @@ imapx_parse_body_fields(CamelIMAPXStream *is, CamelException *ex)
 	cinfo = g_malloc0(sizeof(*cinfo));
 
 	/* this should be string not astring */
-	camel_imapx_stream_astring(is, &token, ex);
-	if (camel_exception_is_set (ex))
+	if (!camel_imapx_stream_astring(is, &token, error))
 		goto error;
 	type = alloca(strlen( (gchar *) token)+1);
 	strcpy(type, (gchar *) token);
-	camel_imapx_stream_astring(is, &token, ex);
-	if (camel_exception_is_set (ex))
+	if (!camel_imapx_stream_astring(is, &token, error))
 		goto error;
 	cinfo->type = camel_content_type_new(type, (gchar *) token);
-	imapx_parse_param_list(is, &cinfo->type->params, ex);
-	if (camel_exception_is_set (ex))
+	if (!imapx_parse_param_list(is, &cinfo->type->params, error))
 		goto error;
 
 	/* body_fld_id     ::= nstring */
-	camel_imapx_stream_nstring(is, &token, ex);
-	if (camel_exception_is_set (ex))
+	if (!camel_imapx_stream_nstring(is, &token, error))
 		goto error;
 	cinfo->id = g_strdup((gchar *) token);
 
 	/* body_fld_desc   ::= nstring */
-	camel_imapx_stream_nstring(is, &token, ex);
-	if (camel_exception_is_set (ex))
+	if (!camel_imapx_stream_nstring(is, &token, error))
 		goto error;
 	cinfo->description = g_strdup((gchar *) token);
 
 	/* body_fld_enc    ::= (<"> ("7BIT" / "8BIT" / "BINARY" / "BASE64"/
 	   "QUOTED-PRINTABLE") <">) / string */
-	camel_imapx_stream_astring(is, &token, ex);
-	if (camel_exception_is_set (ex))
+	if (!camel_imapx_stream_astring(is, &token, error))
 		goto error;
 	cinfo->encoding = g_strdup((gchar *) token);
 
 	/* body_fld_octets ::= number */
-	cinfo->size = camel_imapx_stream_number(is, ex);
-	if (camel_exception_is_set (ex))
+	cinfo->size = camel_imapx_stream_number(is, &local_error);
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
 		goto error;
+	}
 
 	return cinfo;
 error:
@@ -911,7 +909,7 @@ error:
 }
 
 struct _camel_header_address *
-imapx_parse_address_list(CamelIMAPXStream *is, CamelException *ex)
+imapx_parse_address_list(CamelIMAPXStream *is, GError **error)
 /* throws PARSE,IO exception */
 {
 	gint tok;
@@ -919,31 +917,33 @@ imapx_parse_address_list(CamelIMAPXStream *is, CamelException *ex)
 	guchar *token, *host;
 	gchar *mbox;
 	struct _camel_header_address *list = NULL;
+	GError *local_error = NULL;
 
 	/* "(" 1*address ")" / nil */
 
-	tok = camel_imapx_stream_token(is, &token, &len, ex);
+	tok = camel_imapx_stream_token(is, &token, &len, &local_error);
 	if (tok == '(') {
 		while (1) {
 			struct _camel_header_address *addr, *group = NULL;
 
 			/* address         ::= "(" addr_name SPACE addr_adl SPACE addr_mailbox
 			   SPACE addr_host ")" */
-			tok = camel_imapx_stream_token(is, &token, &len, ex);
+			tok = camel_imapx_stream_token(is, &token, &len, &local_error);
 			if (tok == ')')
 				break;
 			if (tok != '(') {
+				g_clear_error (&local_error);
 				camel_header_address_list_clear(&list);
-				camel_exception_set (ex, 1, "missing '(' for address");
+				g_set_error (error, CAMEL_IMAPX_ERROR, 1, "missing '(' for address");
 				return NULL;
 			}
 
 			addr = camel_header_address_new();
 			addr->type = CAMEL_HEADER_ADDRESS_NAME;
-			tok = camel_imapx_stream_nstring(is, &token, ex);
+			tok = camel_imapx_stream_nstring(is, &token, &local_error);
 			addr->name = g_strdup((gchar *) token);
 			/* we ignore the route, nobody uses it in the real world */
-			tok = camel_imapx_stream_nstring(is, &token, ex);
+			tok = camel_imapx_stream_nstring(is, &token, &local_error);
 
 			/* [RFC-822] group syntax is indicated by a special
 			   form of address structure in which the host name
@@ -953,9 +953,9 @@ imapx_parse_address_list(CamelIMAPXStream *is, CamelException *ex)
 			   non-NIL, this is a start of group marker, and the
 			   mailbox name field holds the group name phrase. */
 
-			tok = camel_imapx_stream_nstring(is,(guchar **) &mbox, ex);
+			tok = camel_imapx_stream_nstring(is,(guchar **) &mbox, &local_error);
 			mbox = g_strdup(mbox);
-			tok = camel_imapx_stream_nstring(is, &host, ex);
+			tok = camel_imapx_stream_nstring(is, &host, &local_error);
 			if (host == NULL) {
 				if (mbox == NULL) {
 					group = NULL;
@@ -977,7 +977,7 @@ imapx_parse_address_list(CamelIMAPXStream *is, CamelException *ex)
 					camel_header_address_list_append(&list, addr);
 			}
 			do {
-				tok = camel_imapx_stream_token(is, &token, &len, ex);
+				tok = camel_imapx_stream_token(is, &token, &len, &local_error);
 			} while (tok != ')');
 		}
 	} else {
@@ -985,12 +985,14 @@ imapx_parse_address_list(CamelIMAPXStream *is, CamelException *ex)
 	}
 
 	/* CHEN TODO handle exception at required places */
+	if (local_error != NULL)
+		g_propagate_error (error, local_error);
 
 	return list;
 }
 
 struct _CamelMessageInfo *
-imapx_parse_envelope(CamelIMAPXStream *is, CamelException *ex)
+imapx_parse_envelope(CamelIMAPXStream *is, GError **error)
 {
 	gint tok;
 	guint len;
@@ -998,6 +1000,7 @@ imapx_parse_envelope(CamelIMAPXStream *is, CamelException *ex)
 	struct _camel_header_address *addr, *addr_from;
 	gchar *addrstr;
 	struct _CamelMessageInfoBase *minfo;
+	GError *local_error = NULL;
 
 	/* envelope        ::= "(" env_date SPACE env_subject SPACE env_from
 	   SPACE env_sender SPACE env_reply_to SPACE env_to
@@ -1008,28 +1011,29 @@ imapx_parse_envelope(CamelIMAPXStream *is, CamelException *ex)
 
 	minfo = (CamelMessageInfoBase *)camel_message_info_new(NULL);
 
-	tok = camel_imapx_stream_token(is, &token, &len, ex);
+	tok = camel_imapx_stream_token(is, &token, &len, &local_error);
 	if (tok != '(') {
+		g_clear_error (&local_error);
 		camel_message_info_free(minfo);
-		camel_exception_set (ex, 1, "envelope: expecting '('");
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "envelope: expecting '('");
 		return NULL;
 	}
 
 	/* env_date        ::= nstring */
-	camel_imapx_stream_nstring(is, &token, ex);
+	camel_imapx_stream_nstring(is, &token, &local_error);
 	minfo->date_sent = camel_header_decode_date((gchar *) token, NULL);
 
 	/* env_subject     ::= nstring */
-	tok = camel_imapx_stream_nstring(is, &token, ex);
+	tok = camel_imapx_stream_nstring(is, &token, &local_error);
 	minfo->subject = camel_pstring_strdup((gchar *) token);
 
 	/* we merge from/sender into from, append should probably merge more smartly? */
 
 	/* env_from        ::= "(" 1*address ")" / nil */
-	addr_from = imapx_parse_address_list(is, ex);
+	addr_from = imapx_parse_address_list(is, &local_error);
 
 	/* env_sender      ::= "(" 1*address ")" / nil */
-	addr = imapx_parse_address_list(is, ex);
+	addr = imapx_parse_address_list(is, &local_error);
 	if (addr_from) {
 		camel_header_address_list_clear(&addr);
 #if 0
@@ -1051,11 +1055,11 @@ imapx_parse_envelope(CamelIMAPXStream *is, CamelException *ex)
 	/* we dont keep reply_to */
 
 	/* env_reply_to    ::= "(" 1*address ")" / nil */
-	addr = imapx_parse_address_list(is, ex);
+	addr = imapx_parse_address_list(is, &local_error);
 	camel_header_address_list_clear(&addr);
 
 	/* env_to          ::= "(" 1*address ")" / nil */
-	addr = imapx_parse_address_list(is, ex);
+	addr = imapx_parse_address_list(is, &local_error);
 	if (addr) {
 		addrstr = camel_header_address_list_format(addr);
 		minfo->to = camel_pstring_strdup(addrstr);
@@ -1064,7 +1068,7 @@ imapx_parse_envelope(CamelIMAPXStream *is, CamelException *ex)
 	}
 
 	/* env_cc          ::= "(" 1*address ")" / nil */
-	addr = imapx_parse_address_list(is, ex);
+	addr = imapx_parse_address_list(is, &local_error);
 	if (addr) {
 		addrstr = camel_header_address_list_format(addr);
 		minfo->cc = camel_pstring_strdup(addrstr);
@@ -1075,33 +1079,36 @@ imapx_parse_envelope(CamelIMAPXStream *is, CamelException *ex)
 	/* we dont keep bcc either */
 
 	/* env_bcc         ::= "(" 1*address ")" / nil */
-	addr = imapx_parse_address_list(is, ex);
+	addr = imapx_parse_address_list(is, &local_error);
 	camel_header_address_list_clear(&addr);
 
 	/* FIXME: need to put in-reply-to into references hash list */
 
 	/* env_in_reply_to ::= nstring */
-	tok = camel_imapx_stream_nstring(is, &token, ex);
+	tok = camel_imapx_stream_nstring(is, &token, &local_error);
 
 	/* FIXME: need to put message-id into message-id hash */
 
 	/* env_message_id  ::= nstring */
-	tok = camel_imapx_stream_nstring(is, &token, ex);
+	tok = camel_imapx_stream_nstring(is, &token, &local_error);
 
-	tok = camel_imapx_stream_token(is, &token, &len, ex);
+	tok = camel_imapx_stream_token(is, &token, &len, &local_error);
 	if (tok != ')') {
+		g_clear_error (&local_error);
 		camel_message_info_free(minfo);
-		camel_exception_set (ex, 1, "expecting ')'");
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "expecting ')'");
 		return NULL;
 	}
 
 	/* CHEN TODO handle exceptions better */
+	if (local_error != NULL)
+		g_propagate_error (error, local_error);
 
 	return (CamelMessageInfo *)minfo;
 }
 
 struct _CamelMessageContentInfo *
-imapx_parse_body(CamelIMAPXStream *is, CamelException *ex)
+imapx_parse_body(CamelIMAPXStream *is, GError **error)
 {
 	gint tok;
 	guint len;
@@ -1110,19 +1117,20 @@ imapx_parse_body(CamelIMAPXStream *is, CamelException *ex)
 	struct _CamelMessageContentInfo *subinfo, *last;
 	struct _CamelContentDisposition * dinfo = NULL;
 	struct _CamelMessageInfo * minfo = NULL;
+	GError *local_error = NULL;
 
 	/* body            ::= "(" body_type_1part / body_type_mpart ")" */
 
 	p(printf("body\n"));
 
-	tok = camel_imapx_stream_token(is, &token, &len, ex);
+	tok = camel_imapx_stream_token(is, &token, &len, &local_error);
 	if (tok != '(') {
-		camel_exception_set (ex, 1, "body: expecting '('");
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "body: expecting '('");
 		return NULL;
 	}
 
 	/* 1*body (optional for multiparts) */
-	tok = camel_imapx_stream_token(is, &token, &len, ex);
+	tok = camel_imapx_stream_token(is, &token, &len, &local_error);
 	camel_imapx_stream_ungettoken(is, tok, token, len);
 	if (tok == '(') {
 		/* body_type_mpart ::= 1*body SPACE media_subtype
@@ -1131,17 +1139,17 @@ imapx_parse_body(CamelIMAPXStream *is, CamelException *ex)
 		cinfo = g_malloc0(sizeof(*cinfo));
 		last = (struct _CamelMessageContentInfo *)&cinfo->childs;
 		do {
-			subinfo = imapx_parse_body(is, ex);
+			subinfo = imapx_parse_body(is, &local_error);
 			last->next = subinfo;
 			last = subinfo;
 			subinfo->parent = cinfo;
-			tok = camel_imapx_stream_token(is, &token, &len, ex);
+			tok = camel_imapx_stream_token(is, &token, &len, &local_error);
 			camel_imapx_stream_ungettoken(is, tok, token, len);
 		} while (tok == '(');
 
 		d(printf("media_subtype\n"));
 
-		camel_imapx_stream_astring(is, &token, ex);
+		camel_imapx_stream_astring(is, &token, &local_error);
 		cinfo->type = camel_content_type_new("multipart", (gchar *) token);
 
 		/* body_ext_mpart  ::= body_fld_param
@@ -1152,17 +1160,17 @@ imapx_parse_body(CamelIMAPXStream *is, CamelException *ex)
 
 		d(printf("body_ext_mpart\n"));
 
-		tok = camel_imapx_stream_token(is, &token, &len, ex);
+		tok = camel_imapx_stream_token(is, &token, &len, &local_error);
 		camel_imapx_stream_ungettoken(is, tok, token, len);
 		if (tok == '(') {
-			imapx_parse_param_list(is, &cinfo->type->params, ex);
+			imapx_parse_param_list(is, &cinfo->type->params, &local_error);
 
 			/* body_fld_dsp    ::= "(" string SPACE body_fld_param ")" / nil */
 
-			tok = camel_imapx_stream_token(is, &token, &len, ex);
+			tok = camel_imapx_stream_token(is, &token, &len, &local_error);
 			camel_imapx_stream_ungettoken(is, tok, token, len);
 			if (tok == '(' || tok == IMAPX_TOK_TOKEN) {
-				dinfo = imapx_parse_ext_optional(is, ex);
+				dinfo = imapx_parse_ext_optional(is, &local_error);
 				/* other extension fields?, soaked up below */
 			} else {
 				camel_imapx_stream_ungettoken(is, tok, token, len);
@@ -1179,16 +1187,16 @@ imapx_parse_body(CamelIMAPXStream *is, CamelException *ex)
 
 		d(printf("Single part body\n"));
 
-		cinfo = imapx_parse_body_fields(is, ex);
+		cinfo = imapx_parse_body_fields(is, &local_error);
 
 		d(printf("envelope?\n"));
 
 		/* do we have an envelope following */
-		tok = camel_imapx_stream_token(is, &token, &len, ex);
+		tok = camel_imapx_stream_token(is, &token, &len, &local_error);
 		camel_imapx_stream_ungettoken(is, tok, token, len);
 		if (tok == '(') {
 			/* what do we do with the envelope?? */
-			minfo = imapx_parse_envelope(is, ex);
+			minfo = imapx_parse_envelope(is, &local_error);
 			/* what do we do with the message content info?? */
 			//((CamelMessageInfoBase *)minfo)->content = imapx_parse_body(is);
 			camel_message_info_free(minfo);
@@ -1199,10 +1207,10 @@ imapx_parse_body(CamelIMAPXStream *is, CamelException *ex)
 		d(printf("fld_lines?\n"));
 
 		/* do we have fld_lines following? */
-		tok = camel_imapx_stream_token(is, &token, &len, ex);
+		tok = camel_imapx_stream_token(is, &token, &len, &local_error);
 		if (tok == IMAPX_TOK_INT) {
 			d(printf("field lines: %s\n", token));
-			tok = camel_imapx_stream_token(is, &token, &len, ex);
+			tok = camel_imapx_stream_token(is, &token, &len, &local_error);
 		}
 		camel_imapx_stream_ungettoken(is, tok, token, len);
 
@@ -1215,16 +1223,16 @@ imapx_parse_body(CamelIMAPXStream *is, CamelException *ex)
 		d(printf("extension data?\n"));
 
 		if (tok != ')') {
-			camel_imapx_stream_nstring(is, &token, ex);
+			camel_imapx_stream_nstring(is, &token, &local_error);
 
 			d(printf("md5: %s\n", token?(gchar *)token:"NIL"));
 
 			/* body_fld_dsp    ::= "(" string SPACE body_fld_param ")" / nil */
 
-			tok = camel_imapx_stream_token(is, &token, &len, ex);
+			tok = camel_imapx_stream_token(is, &token, &len, &local_error);
 			camel_imapx_stream_ungettoken(is, tok, token, len);
 			if (tok == '(' || tok == IMAPX_TOK_TOKEN) {
-				dinfo = imapx_parse_ext_optional(is, ex);
+				dinfo = imapx_parse_ext_optional(is, &local_error);
 				/* then other extension fields, soaked up below */
 			}
 		}
@@ -1233,14 +1241,15 @@ imapx_parse_body(CamelIMAPXStream *is, CamelException *ex)
 	/* soak up any other extension fields that may be present */
 	/* there should only be simple tokens, no lists */
 	do {
-		tok = camel_imapx_stream_token(is, &token, &len, ex);
+		tok = camel_imapx_stream_token(is, &token, &len, &local_error);
 		if (tok != ')') {
 			d(printf("Dropping extension data '%s'\n", token));
 		}
 	} while (tok != ')');
 
 	/* CHEN TODO handle exceptions better */
-	if (camel_exception_is_set (ex)) {
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
 		if (cinfo)
 			imapx_free_body(cinfo);
 		if (dinfo)
@@ -1258,7 +1267,7 @@ imapx_parse_body(CamelIMAPXStream *is, CamelException *ex)
 }
 
 gchar *
-imapx_parse_section(CamelIMAPXStream *is, CamelException *ex)
+imapx_parse_section(CamelIMAPXStream *is, GError **error)
 {
 	gint tok;
 	guint len;
@@ -1276,20 +1285,20 @@ imapx_parse_section(CamelIMAPXStream *is, CamelException *ex)
 	  SPACE header_list / "TEXT"
 	*/
 
-	tok = camel_imapx_stream_token(is, &token, &len, ex);
+	tok = camel_imapx_stream_token(is, &token, &len, NULL);
 	if (tok != '[') {
-		camel_exception_set (ex, 1, "section: expecting '['");
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "section: expecting '['");
 		return NULL;
 	}
 
-	tok = camel_imapx_stream_token(is, &token, &len, ex);
+	tok = camel_imapx_stream_token(is, &token, &len, NULL);
 	if (tok == IMAPX_TOK_INT || tok == IMAPX_TOK_TOKEN)
 		section = g_strdup((gchar *) token);
 	else if (tok == ']') {
 		section = g_strdup("");
 		camel_imapx_stream_ungettoken(is, tok, token, len);
 	} else {
-		camel_exception_set (ex, 1, "section: expecting token");
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "section: expecting token");
 		return NULL;
 	}
 
@@ -1297,23 +1306,23 @@ imapx_parse_section(CamelIMAPXStream *is, CamelException *ex)
 	   header_fld_name ::= astring */
 
 	/* we dont need the header specifiers */
-	tok = camel_imapx_stream_token(is, &token, &len, ex);
+	tok = camel_imapx_stream_token(is, &token, &len, NULL);
 	if (tok == '(') {
 		do {
-			tok = camel_imapx_stream_token(is, &token, &len, ex);
+			tok = camel_imapx_stream_token(is, &token, &len, NULL);
 			if (tok == IMAPX_TOK_STRING || tok == IMAPX_TOK_TOKEN || tok == IMAPX_TOK_INT) {
 				/* ?do something? */
 			} else if (tok != ')') {
-				camel_exception_set (ex, 1, "section: header fields: expecting string");
+				g_set_error (error, CAMEL_IMAPX_ERROR, 1, "section: header fields: expecting string");
 				g_free (section);
 				return NULL;
 			}
 		} while (tok != ')');
-		tok = camel_imapx_stream_token(is, &token, &len, ex);
+		tok = camel_imapx_stream_token(is, &token, &len, NULL);
 	}
 
 	if (tok != ']') {
-		camel_exception_set (ex, 1, "section: expecting ']'");
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "section: expecting ']'");
 		g_free(section);
 		return NULL;
 	}
@@ -1322,7 +1331,7 @@ imapx_parse_section(CamelIMAPXStream *is, CamelException *ex)
 }
 
 static guint64
-imapx_parse_modseq(CamelIMAPXStream *is, CamelException *ex)
+imapx_parse_modseq(CamelIMAPXStream *is, GError **error)
 {
 	guint64 ret;
 	gint tok;
@@ -1330,18 +1339,18 @@ imapx_parse_modseq(CamelIMAPXStream *is, CamelException *ex)
 	guchar *token;
 
 	
-	tok = camel_imapx_stream_token(is, &token, &len, ex);
+	tok = camel_imapx_stream_token(is, &token, &len, NULL);
 	if (tok != '(') {
-		camel_exception_set (ex, 1, "fetch: expecting '('");
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "fetch: expecting '('");
 		return 0;
 	}
-	ret = camel_imapx_stream_number(is, ex);
-	if (camel_exception_is_set(ex))
+	ret = camel_imapx_stream_number(is, error);
+	if (ret == 0)
 		return 0;
 
-	tok = camel_imapx_stream_token(is, &token, &len, ex);
+	tok = camel_imapx_stream_token(is, &token, &len, NULL);
 	if (tok != ')') {
-		camel_exception_set (ex, 1, "fetch: expecting '('");
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "fetch: expecting '('");
 		return 0;
 	}
 	return ret;
@@ -1387,18 +1396,18 @@ imapx_dump_fetch(struct _fetch_info *finfo)
 	sout = camel_stream_fs_new_with_fd(fd);
 	if (finfo->body) {
 		camel_stream_printf(sout, "Body content:\n");
-		camel_stream_write_to_stream(finfo->body, sout);
-		camel_stream_reset(finfo->body);
+		camel_stream_write_to_stream(finfo->body, sout, NULL);
+		camel_stream_reset(finfo->body, NULL);
 	}
 	if (finfo->text) {
 		camel_stream_printf(sout, "Text content:\n");
-		camel_stream_write_to_stream(finfo->text, sout);
-		camel_stream_reset(finfo->text);
+		camel_stream_write_to_stream(finfo->text, sout, NULL);
+		camel_stream_reset(finfo->text, NULL);
 	}
 	if (finfo->header) {
 		camel_stream_printf(sout, "Header content:\n");
-		camel_stream_write_to_stream(finfo->header, sout);
-		camel_stream_reset(finfo->header);
+		camel_stream_write_to_stream(finfo->header, sout, NULL);
+		camel_stream_reset(finfo->header, NULL);
 	}
 	if (finfo->minfo) {
 		camel_stream_printf(sout, "Message Info:\n");
@@ -1424,7 +1433,7 @@ imapx_dump_fetch(struct _fetch_info *finfo)
 }
 
 struct _fetch_info *
-imapx_parse_fetch(CamelIMAPXStream *is, CamelException *ex)
+imapx_parse_fetch(CamelIMAPXStream *is, GError **error)
 {
 	gint tok;
 	guint len;
@@ -1433,14 +1442,14 @@ imapx_parse_fetch(CamelIMAPXStream *is, CamelException *ex)
 
 	finfo = g_malloc0(sizeof(*finfo));
 
-	tok = camel_imapx_stream_token(is, &token, &len, ex);
+	tok = camel_imapx_stream_token(is, &token, &len, NULL);
 	if (tok != '(') {
-		camel_exception_set (ex, 1, "fetch: expecting '('");
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "fetch: expecting '('");
 		g_free (finfo);
 		return NULL;
 	}
 
-	while ((tok = camel_imapx_stream_token(is, &token, &len, ex)) == IMAPX_TOK_TOKEN) {
+	while ((tok = camel_imapx_stream_token(is, &token, &len, NULL)) == IMAPX_TOK_TOKEN) {
 
 		p = token;
 		while ((c=*p))
@@ -1448,66 +1457,66 @@ imapx_parse_fetch(CamelIMAPXStream *is, CamelException *ex)
 
 		switch (imapx_tokenise((gchar *) token, len)) {
 			case IMAPX_ENVELOPE:
-				finfo->minfo = imapx_parse_envelope(is, ex);
+				finfo->minfo = imapx_parse_envelope(is, NULL);
 				finfo->got |= FETCH_MINFO;
 				break;
 			case IMAPX_FLAGS:
-				imapx_parse_flags(is, &finfo->flags, &finfo->user_flags, ex);
+				imapx_parse_flags(is, &finfo->flags, &finfo->user_flags, NULL);
 				finfo->got |= FETCH_FLAGS;
 				break;
 			case IMAPX_INTERNALDATE:
-				camel_imapx_stream_nstring(is, &token, ex);
+				camel_imapx_stream_nstring(is, &token, NULL);
 				/* TODO: convert to camel format? */
 				finfo->date = g_strdup((gchar *) token);
 				finfo->got |= FETCH_DATE;
 				break;
 			case IMAPX_RFC822_HEADER:
-				camel_imapx_stream_nstring_stream(is, &finfo->header, ex);
+				camel_imapx_stream_nstring_stream(is, &finfo->header, NULL);
 				finfo->got |= FETCH_HEADER;
 				break;
 			case IMAPX_RFC822_TEXT:
-				camel_imapx_stream_nstring_stream(is, &finfo->text, ex);
+				camel_imapx_stream_nstring_stream(is, &finfo->text, NULL);
 				finfo->got |= FETCH_TEXT;
 				break;
 			case IMAPX_RFC822_SIZE:
-				finfo->size = camel_imapx_stream_number(is, ex);
+				finfo->size = camel_imapx_stream_number(is, NULL);
 				finfo->got |= FETCH_SIZE;
 				break;
 			case IMAPX_BODYSTRUCTURE:
-				finfo->cinfo = imapx_parse_body(is, ex);
+				finfo->cinfo = imapx_parse_body(is, NULL);
 				finfo->got |= FETCH_CINFO;
 				break;
 			case IMAPX_MODSEQ:
-				finfo->modseq = imapx_parse_modseq(is, ex);
+				finfo->modseq = imapx_parse_modseq(is, NULL);
 				finfo->got |= FETCH_MODSEQ;
 				break;
 			case IMAPX_BODY:
-				tok = camel_imapx_stream_token(is, &token, &len, ex);
+				tok = camel_imapx_stream_token(is, &token, &len, NULL);
 				camel_imapx_stream_ungettoken(is, tok, token, len);
 				if (tok == '(') {
-					finfo->cinfo = imapx_parse_body(is, ex);
+					finfo->cinfo = imapx_parse_body(is, NULL);
 					finfo->got |= FETCH_CINFO;
 				} else if (tok == '[') {
-					finfo->section = imapx_parse_section(is, ex);
+					finfo->section = imapx_parse_section(is, NULL);
 					finfo->got |= FETCH_SECTION;
-					tok = camel_imapx_stream_token(is, &token, &len, ex);
+					tok = camel_imapx_stream_token(is, &token, &len, NULL);
 					if (token[0] == '<') {
 						finfo->offset = strtoul((gchar *) token+1, NULL, 10);
 					} else {
 						camel_imapx_stream_ungettoken(is, tok, token, len);
 					}
-					camel_imapx_stream_nstring_stream(is, &finfo->body, ex);
+					camel_imapx_stream_nstring_stream(is, &finfo->body, NULL);
 					finfo->got |= FETCH_BODY;
 				} else {
-					camel_exception_set (ex, 1, "unknown body response");
+					g_set_error (error, CAMEL_IMAPX_ERROR, 1, "unknown body response");
 					imapx_free_fetch(finfo);
 					return NULL;
 				}
 				break;
 			case IMAPX_UID:
-				tok = camel_imapx_stream_token(is, &token, &len, ex);
+				tok = camel_imapx_stream_token(is, &token, &len, NULL);
 				if (tok != IMAPX_TOK_INT) {
-					camel_exception_set (ex, 1, "uid not integer");
+					g_set_error (error, CAMEL_IMAPX_ERROR, 1, "uid not integer");
 				}
 
 				finfo->uid = g_strdup((gchar *) token);
@@ -1515,13 +1524,13 @@ imapx_parse_fetch(CamelIMAPXStream *is, CamelException *ex)
 				break;
 			default:
 				imapx_free_fetch(finfo);
-				camel_exception_set (ex, 1, "unknown body response");
+				g_set_error (error, CAMEL_IMAPX_ERROR, 1, "unknown body response");
 				return NULL;
 		}
 	}
 
 	if (tok != ')') {
-		camel_exception_set (ex, 1, "missing closing ')' on fetch response");
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "missing closing ')' on fetch response");
 		imapx_free_fetch (finfo);
 		return NULL;
 	}
@@ -1530,7 +1539,7 @@ imapx_parse_fetch(CamelIMAPXStream *is, CamelException *ex)
 }
 
 struct _state_info *
-imapx_parse_status_info (struct _CamelIMAPXStream *is, CamelException *ex)
+imapx_parse_status_info (struct _CamelIMAPXStream *is, GError **error)
 {
 	struct _state_info *sinfo;
 	gint tok;
@@ -1540,51 +1549,50 @@ imapx_parse_status_info (struct _CamelIMAPXStream *is, CamelException *ex)
 	sinfo = g_malloc0 (sizeof(*sinfo));
 
 	/* skip the folder name */
-	camel_imapx_stream_astring (is, &token, ex);
-	if (camel_exception_is_set(ex)) {
+	if (!camel_imapx_stream_astring (is, &token, error)) {
 		g_free (sinfo);
 		return NULL;
 	}
 	sinfo->name = camel_utf7_utf8 ((gchar *)token);
 
-	tok = camel_imapx_stream_token(is, &token, &len, ex);
+	tok = camel_imapx_stream_token(is, &token, &len, NULL);
 	if (tok != '(') {
-		camel_exception_set (ex, 1, "parse status info: expecting '('");
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "parse status info: expecting '('");
 		g_free (sinfo);
 		return NULL;
 	}
 
-	while ((tok = camel_imapx_stream_token(is, &token, &len, ex)) == IMAPX_TOK_TOKEN) {
+	while ((tok = camel_imapx_stream_token(is, &token, &len, NULL)) == IMAPX_TOK_TOKEN) {
 		switch (imapx_tokenise((gchar *) token, len)) {
 			case IMAPX_MESSAGES:
-				sinfo->messages = camel_imapx_stream_number (is, ex);
+				sinfo->messages = camel_imapx_stream_number (is, NULL);
 				break;
 			case IMAPX_RECENT:
-				sinfo->recent = camel_imapx_stream_number (is, ex);
+				sinfo->recent = camel_imapx_stream_number (is, NULL);
 				break;
 			case IMAPX_UIDNEXT:
-				sinfo->uidnext = camel_imapx_stream_number (is, ex);
+				sinfo->uidnext = camel_imapx_stream_number (is, NULL);
 				break;
 			case IMAPX_UIDVALIDITY:
-				sinfo->uidvalidity = camel_imapx_stream_number (is, ex);
+				sinfo->uidvalidity = camel_imapx_stream_number (is, NULL);
 				break;
 			case IMAPX_UNSEEN:
-				sinfo->unseen = camel_imapx_stream_number (is, ex);
+				sinfo->unseen = camel_imapx_stream_number (is, NULL);
 				break;
 			case IMAPX_HIGHESTMODSEQ:
-				sinfo->highestmodseq = camel_imapx_stream_number (is, ex);
+				sinfo->highestmodseq = camel_imapx_stream_number (is, NULL);
 				break;
 			case IMAPX_NOMODSEQ:
 			break;
 			default:
 				g_free (sinfo);
-				camel_exception_set (ex, 1, "unknown status response");
+				g_set_error (error, CAMEL_IMAPX_ERROR, 1, "unknown status response");
 				return NULL;
 		}
 	}
 
 	if (tok != ')') {
-		camel_exception_set (ex, 1, "missing closing ')' on status response");
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "missing closing ')' on status response");
 		g_free (sinfo);
 		return NULL;
 	}
@@ -1602,7 +1610,7 @@ generate_uids_from_sequence (GPtrArray *uids, guint32 begin_uid, guint32 end_uid
 }
 
 GPtrArray *
-imapx_parse_uids (CamelIMAPXStream *is, CamelException *ex)
+imapx_parse_uids (CamelIMAPXStream *is, GError **error)
 {
 	GPtrArray *uids = g_ptr_array_new ();
 	guchar *token;
@@ -1610,7 +1618,7 @@ imapx_parse_uids (CamelIMAPXStream *is, CamelException *ex)
 	guint len, str_len;
 	gint tok, i;
 
-	tok = camel_imapx_stream_token (is, &token, &len, ex);
+	tok = camel_imapx_stream_token (is, &token, &len, NULL);
 	splits = g_strsplit ((gchar *) token, ",", -1);
 	str_len = g_strv_length (splits);
 
@@ -1636,7 +1644,7 @@ imapx_parse_uids (CamelIMAPXStream *is, CamelException *ex)
 /* rfc 2060 section 7.1 Status Responses */
 /* shoudl this start after [ or before the [? token_unget anyone? */
 struct _status_info *
-imapx_parse_status(CamelIMAPXStream *is, CamelException *ex)
+imapx_parse_status(CamelIMAPXStream *is, GError **error)
 {
 	gint tok;
 	guint len;
@@ -1645,7 +1653,7 @@ imapx_parse_status(CamelIMAPXStream *is, CamelException *ex)
 
 	sinfo = g_malloc0(sizeof(*sinfo));
 
-	camel_imapx_stream_atom(is, &token, &len, ex);
+	camel_imapx_stream_atom(is, &token, &len, NULL);
 
 	/*
 	   resp_cond_auth  ::= ("OK" / "PREAUTH") SPACE resp_text
@@ -1666,14 +1674,14 @@ imapx_parse_status(CamelIMAPXStream *is, CamelException *ex)
 		case IMAPX_BYE:
 			break;
 		default:
-			camel_exception_set (ex, 1, "expecting OK/NO/BAD");
+			g_set_error (error, CAMEL_IMAPX_ERROR, 1, "expecting OK/NO/BAD");
 			g_free (sinfo);
 			return NULL;
 	}
 
-	tok = camel_imapx_stream_token(is, &token, &len, ex);
+	tok = camel_imapx_stream_token(is, &token, &len, NULL);
 	if (tok == '[') {
-		camel_imapx_stream_atom(is, &token, &len, ex);
+		camel_imapx_stream_atom(is, &token, &len, NULL);
 		sinfo->condition = imapx_tokenise((gchar *) token, len);
 
 		/* parse any details */
@@ -1686,39 +1694,39 @@ imapx_parse_status(CamelIMAPXStream *is, CamelException *ex)
 			case IMAPX_CLOSED:
 				break;
 			case IMAPX_APPENDUID:
-				sinfo->u.appenduid.uidvalidity = camel_imapx_stream_number(is, ex);
-				sinfo->u.appenduid.uid = camel_imapx_stream_number(is, ex);
+				sinfo->u.appenduid.uidvalidity = camel_imapx_stream_number(is, NULL);
+				sinfo->u.appenduid.uid = camel_imapx_stream_number(is, NULL);
 				break;
 			case IMAPX_COPYUID:
-				sinfo->u.copyuid.uidvalidity = camel_imapx_stream_number(is, ex);
-				sinfo->u.copyuid.uids = imapx_parse_uids (is, ex);
-				sinfo->u.copyuid.copied_uids = imapx_parse_uids (is, ex);
+				sinfo->u.copyuid.uidvalidity = camel_imapx_stream_number(is, NULL);
+				sinfo->u.copyuid.uids = imapx_parse_uids (is, NULL);
+				sinfo->u.copyuid.copied_uids = imapx_parse_uids (is, NULL);
 				break;
 			case IMAPX_NEWNAME:
 				/* the rfc doesn't specify the bnf for this */
-				camel_imapx_stream_astring(is, &token, ex);
+				camel_imapx_stream_astring(is, &token, NULL);
 				sinfo->u.newname.oldname = g_strdup((gchar *) token);
-				camel_imapx_stream_astring(is, &token, ex);
+				camel_imapx_stream_astring(is, &token, NULL);
 				sinfo->u.newname.newname = g_strdup((gchar *) token);
 				break;
 			case IMAPX_PERMANENTFLAGS:
 				/* we only care about \* for permanent flags, not user flags */
-				imapx_parse_flags(is, &sinfo->u.permanentflags, NULL, ex);
+				imapx_parse_flags(is, &sinfo->u.permanentflags, NULL, NULL);
 				break;
 			case IMAPX_UIDVALIDITY:
-				sinfo->u.uidvalidity = camel_imapx_stream_number(is, ex);
+				sinfo->u.uidvalidity = camel_imapx_stream_number(is, NULL);
 				break;
 			case IMAPX_UIDNEXT:
-				sinfo->u.uidnext = camel_imapx_stream_number (is, ex);
+				sinfo->u.uidnext = camel_imapx_stream_number (is, NULL);
 				break;
 			case IMAPX_UNSEEN:
-				sinfo->u.unseen = camel_imapx_stream_number(is, ex);
+				sinfo->u.unseen = camel_imapx_stream_number(is, NULL);
 				break;
 			case IMAPX_HIGHESTMODSEQ:
-				sinfo->u.highestmodseq = camel_imapx_stream_number(is, ex);
+				sinfo->u.highestmodseq = camel_imapx_stream_number(is, NULL);
 				break;
 			case IMAPX_CAPABILITY:
-				sinfo->u.cinfo = imapx_parse_capability(is, ex);
+				sinfo->u.cinfo = imapx_parse_capability(is, NULL);
 				break;
 			default:
 				sinfo->condition = IMAPX_UNKNOWN;
@@ -1727,9 +1735,9 @@ imapx_parse_status(CamelIMAPXStream *is, CamelException *ex)
 
 		/* ignore anything we dont know about */
 		do {
-			tok = camel_imapx_stream_token(is, &token, &len, ex);
+			tok = camel_imapx_stream_token(is, &token, &len, NULL);
 			if (tok == '\n') {
-				camel_exception_set (ex, 1, "server response truncated");
+				g_set_error (error, CAMEL_IMAPX_ERROR, 1, "server response truncated");
 				imapx_free_status(sinfo);
 				return NULL;
 			}
@@ -1739,7 +1747,7 @@ imapx_parse_status(CamelIMAPXStream *is, CamelException *ex)
 	}
 
 	/* and take the human readable response */
-	camel_imapx_stream_text(is, (guchar **)&sinfo->text, ex);
+	camel_imapx_stream_text(is, (guchar **)&sinfo->text, NULL);
 
 	return sinfo;
 }
@@ -1801,7 +1809,7 @@ static struct {
 };
 
 struct _list_info *
-imapx_parse_list(CamelIMAPXStream *is, CamelException *ex)
+imapx_parse_list(CamelIMAPXStream *is, GError **error)
 /* throws io, parse */
 {
 	gint tok, i;
@@ -1815,14 +1823,14 @@ imapx_parse_list(CamelIMAPXStream *is, CamelException *ex)
 	   "\Noselect" / "\Unmarked" / flag_extension) ")"
 	   SPACE (<"> QUOTED_CHAR <"> / nil) SPACE mailbox */
 
-	tok = camel_imapx_stream_token(is, &token, &len, ex);
+	tok = camel_imapx_stream_token(is, &token, &len, NULL);
 	if (tok != '(') {
-		camel_exception_set (ex, 1, "list: expecting '('");
+		g_set_error (error, CAMEL_IMAPX_ERROR, 1, "list: expecting '('");
 		g_free (linfo);
 		return NULL;
 	}
 
-	while ((tok = camel_imapx_stream_token(is, &token, &len, ex)) != ')') {
+	while ((tok = camel_imapx_stream_token(is, &token, &len, NULL)) != ')') {
 		if (tok == IMAPX_TOK_STRING || tok == IMAPX_TOK_TOKEN) {
 			p = token;
 			while ((c=*p))
@@ -1832,14 +1840,14 @@ imapx_parse_list(CamelIMAPXStream *is, CamelException *ex)
 					linfo->flags |= list_flag_table[i].flag;
 		} else {
 			imapx_free_list(linfo);
-			camel_exception_set (ex, 1, "list: expecting flag or ')'");
+			g_set_error (error, CAMEL_IMAPX_ERROR, 1, "list: execting flag or ')'");
 			return NULL;
 		}
 	}
 
-	camel_imapx_stream_nstring(is, &token, ex);
+	camel_imapx_stream_nstring(is, &token, NULL);
 	linfo->separator = token?*token:0;
-	camel_imapx_stream_astring(is, &token, ex);
+	camel_imapx_stream_astring(is, &token, NULL);
 	linfo->name = camel_utf7_utf8 ((gchar *) token);
 
 	return linfo;
diff --git a/camel/providers/imapx/camel-imapx-utils.h b/camel/providers/imapx/camel-imapx-utils.h
index ad1c278..f60e0d8 100644
--- a/camel/providers/imapx/camel-imapx-utils.h
+++ b/camel/providers/imapx/camel-imapx-utils.h
@@ -66,9 +66,9 @@ enum {
 
 /* ********************************************************************** */
 
-GPtrArray *imapx_parse_uids (CamelIMAPXStream *is, CamelException *ex);
-void imapx_parse_flags(struct _CamelIMAPXStream *stream, guint32 *flagsp, struct _CamelFlag **user_flagsp, CamelException *ex);
-void imapx_write_flags(CamelStream *stream, guint32 flags, struct _CamelFlag *user_flags, CamelException *ex);
+GPtrArray *imapx_parse_uids (CamelIMAPXStream *is, GError **error);
+void imapx_parse_flags(struct _CamelIMAPXStream *stream, guint32 *flagsp, struct _CamelFlag **user_flagsp, GError **error);
+void imapx_write_flags(CamelStream *stream, guint32 flags, struct _CamelFlag *user_flags, GError **error);
 gboolean imapx_update_message_info_flags (CamelMessageInfo *info, guint32 server_flags, CamelFlag *server_user_flags, CamelFolder *folder, gboolean unsolicited);
 void imapx_set_message_info_flags_for_new_message (CamelMessageInfo *info, guint32 server_flags, CamelFlag *server_user_flags,
 							CamelFolder *folder);
@@ -96,16 +96,16 @@ struct _capability_info {
 	GHashTable *auth_types;
 };
 
-struct _capability_info *imapx_parse_capability(struct _CamelIMAPXStream *stream, CamelException *ex);
+struct _capability_info *imapx_parse_capability(struct _CamelIMAPXStream *stream, GError **error);
 void imapx_free_capability(struct _capability_info *);
 
-void imapx_parse_param_list(struct _CamelIMAPXStream *is, struct _camel_header_param **plist, CamelException *ex) /* IO,PARSE */;
-struct _CamelContentDisposition *imapx_parse_ext_optional(struct _CamelIMAPXStream *is, CamelException *ex) /* IO,PARSE */;
-struct _CamelMessageContentInfo *imapx_parse_body_fields(struct _CamelIMAPXStream *is, CamelException *ex) /* IO,PARSE */;
-struct _camel_header_address *imapx_parse_address_list(struct _CamelIMAPXStream *is, CamelException *ex) /* IO,PARSE */;
-struct _CamelMessageInfo *imapx_parse_envelope(struct _CamelIMAPXStream *is, CamelException *ex) /* IO, PARSE */;
-struct _CamelMessageContentInfo *imapx_parse_body(struct _CamelIMAPXStream *is, CamelException *ex) /* IO,PARSE */;
-gchar *imapx_parse_section(struct _CamelIMAPXStream *is, CamelException *ex) /* IO,PARSE */;
+gboolean imapx_parse_param_list(struct _CamelIMAPXStream *is, struct _camel_header_param **plist, GError **error) /* IO,PARSE */;
+struct _CamelContentDisposition *imapx_parse_ext_optional(struct _CamelIMAPXStream *is, GError **error) /* IO,PARSE */;
+struct _CamelMessageContentInfo *imapx_parse_body_fields(struct _CamelIMAPXStream *is, GError **error) /* IO,PARSE */;
+struct _camel_header_address *imapx_parse_address_list(struct _CamelIMAPXStream *is, GError **error) /* IO,PARSE */;
+struct _CamelMessageInfo *imapx_parse_envelope(struct _CamelIMAPXStream *is, GError **error) /* IO, PARSE */;
+struct _CamelMessageContentInfo *imapx_parse_body(struct _CamelIMAPXStream *is, GError **error) /* IO,PARSE */;
+gchar *imapx_parse_section(struct _CamelIMAPXStream *is, GError **error) /* IO,PARSE */;
 void imapx_free_body(struct _CamelMessageContentInfo *cinfo);
 
 /* ********************************************************************** */
@@ -141,7 +141,7 @@ struct _fetch_info {
 #define FETCH_UID (1<<10)
 #define FETCH_MODSEQ (1<<11)
 
-struct _fetch_info *imapx_parse_fetch(struct _CamelIMAPXStream *is, CamelException *ex);
+struct _fetch_info *imapx_parse_fetch(struct _CamelIMAPXStream *is, GError **error);
 void imapx_free_fetch(struct _fetch_info *finfo);
 void imapx_dump_fetch(struct _fetch_info *finfo);
 
@@ -176,7 +176,7 @@ struct _status_info {
 	gchar *text;
 };
 
-struct _status_info *imapx_parse_status(struct _CamelIMAPXStream *is, CamelException *ex);
+struct _status_info *imapx_parse_status(struct _CamelIMAPXStream *is, GError **error);
 struct _status_info *imapx_copy_status(struct _status_info *sinfo);
 void imapx_free_status(struct _status_info *sinfo);
 
@@ -193,7 +193,7 @@ struct _state_info {
 };
 
 /* use g_free to free the return value */
-struct _state_info *imapx_parse_status_info (struct _CamelIMAPXStream *is, CamelException *ex);
+struct _state_info *imapx_parse_status_info (struct _CamelIMAPXStream *is, GError **error);
 
 /* ********************************************************************** */
 
@@ -205,7 +205,7 @@ struct _list_info {
 	gchar *name;
 };
 
-struct _list_info *imapx_parse_list(struct _CamelIMAPXStream *is, CamelException *ex);
+struct _list_info *imapx_parse_list(struct _CamelIMAPXStream *is, GError **error);
 gchar *imapx_list_get_path(struct _list_info *li);
 void imapx_free_list(struct _list_info *linfo);
 
@@ -263,7 +263,7 @@ gchar *imapx_concat (CamelIMAPXStore *imapx_store, const gchar *prefix, const gc
 gchar * imapx_get_temp_uid (void);
 
 void camel_imapx_namespace_list_clear (struct _CamelIMAPXNamespaceList *nsl);
-struct _CamelIMAPXNamespaceList * imapx_parse_namespace_list (struct _CamelIMAPXStream *stream, CamelException *ex);
+struct _CamelIMAPXNamespaceList * imapx_parse_namespace_list (struct _CamelIMAPXStream *stream, GError **error);
 struct _CamelIMAPXNamespaceList *camel_imapx_namespace_list_copy (const struct _CamelIMAPXNamespaceList *nsl);
 
 #endif
diff --git a/camel/providers/imapx/camel-imapx-view-summary.c b/camel/providers/imapx/camel-imapx-view-summary.c
index 9902deb..26ad76a 100644
--- a/camel/providers/imapx/camel-imapx-view-summary.c
+++ b/camel/providers/imapx/camel-imapx-view-summary.c
@@ -48,7 +48,7 @@ static CamelViewSummaryDiskClass *cmvs_parent;
  * Returns: A new CamelIMAPXViewSummary widget.
  **/
 CamelIMAPXViewSummary *
-camel_imapx_view_summary_new(const gchar *base, CamelException *ex)
+camel_imapx_view_summary_new(const gchar *base, GError **error)
 {
 	return (CamelIMAPXViewSummary *)camel_view_summary_disk_construct(camel_object_new(camel_imapx_view_summary_get_type()), base, ex);
 }
diff --git a/camel/providers/imapx/camel-imapx-view-summary.h b/camel/providers/imapx/camel-imapx-view-summary.h
index 9b3b9d5..b81118e 100644
--- a/camel/providers/imapx/camel-imapx-view-summary.h
+++ b/camel/providers/imapx/camel-imapx-view-summary.h
@@ -76,7 +76,7 @@ struct _CamelIMAPXViewSummaryClass {
 GType		camel_imapx_view_summary_get_type (void);
 CamelIMAPXViewSummary *
 		camel_imapx_view_summary_new	(const gchar *base,
-						 CamelException *ex);
+						 GError **error);
 
 /* called on root view */
 guint32		camel_imapx_view_next_uid	(CamelIMAPXView *view);
diff --git a/camel/providers/imapx/test-imapx.c b/camel/providers/imapx/test-imapx.c
index eacaaef..be80df5 100644
--- a/camel/providers/imapx/test-imapx.c
+++ b/camel/providers/imapx/test-imapx.c
@@ -7,7 +7,6 @@ gint
 main (gint argc, gchar *argv [])
 {
 	CamelSession *session;
-	CamelException *ex;
 	gchar *uri = NULL;
 	CamelService *service;
 	CamelFolder *folder;
@@ -22,13 +21,12 @@ main (gint argc, gchar *argv [])
 	system ("rm -rf /tmp/test-camel-imapx");
 	camel_init ("/tmp/test-camel-imapx", TRUE);
 	camel_provider_init ();
-	ex = camel_exception_new ();
 
 	session = g_object_new (CAMEL_TYPE_SESSION, NULL);
 	camel_session_construct (session, "/tmp/test-camel-imapx");
 
-	service = camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, ex);
-	camel_service_connect (service, ex);
+	service = camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, NULL);
+	camel_service_connect (service, NULL);
 
 	camel_store_get_folder_info ((CamelStore *)service, "", 3, NULL);
 	folder = camel_store_get_folder ((CamelStore *)service, "INBOX", 0, NULL);
diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c
index d1b4a8c..004f400 100644
--- a/camel/providers/local/camel-local-folder.c
+++ b/camel/providers/local/camel-local-folder.c
@@ -62,19 +62,19 @@ enum {
 	PROP_INDEX_BODY = 0x2400
 };
 
-static gint local_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex);
+static gint local_lock(CamelLocalFolder *lf, CamelLockType type, GError **error);
 static void local_unlock(CamelLocalFolder *lf);
 
-static gboolean local_refresh_info(CamelFolder *folder, CamelException *ex);
+static gboolean local_refresh_info(CamelFolder *folder, GError **error);
 
-static gboolean local_sync(CamelFolder *folder, gboolean expunge, CamelException *ex);
-static gboolean local_expunge(CamelFolder *folder, CamelException *ex);
+static gboolean local_sync(CamelFolder *folder, gboolean expunge, GError **error);
+static gboolean local_expunge(CamelFolder *folder, GError **error);
 
-static GPtrArray *local_search_by_expression(CamelFolder *folder, const gchar *expression, CamelException *ex);
-static guint32 local_count_by_expression(CamelFolder *folder, const gchar *expression, CamelException *ex);
-static GPtrArray *local_search_by_uids(CamelFolder *folder, const gchar *expression, GPtrArray *uids, CamelException *ex);
+static GPtrArray *local_search_by_expression(CamelFolder *folder, const gchar *expression, GError **error);
+static guint32 local_count_by_expression(CamelFolder *folder, const gchar *expression, GError **error);
+static GPtrArray *local_search_by_uids(CamelFolder *folder, const gchar *expression, GPtrArray *uids, GError **error);
 static void local_search_free(CamelFolder *folder, GPtrArray * result);
-static GPtrArray * local_get_uncached_uids (CamelFolder *folder, GPtrArray * uids, CamelException *ex);
+static GPtrArray * local_get_uncached_uids (CamelFolder *folder, GPtrArray * uids, GError **error);
 
 static void local_delete(CamelFolder *folder);
 static void local_rename(CamelFolder *folder, const gchar *newname);
@@ -296,7 +296,7 @@ camel_local_folder_init (CamelLocalFolder *local_folder)
 }
 
 CamelLocalFolder *
-camel_local_folder_construct(CamelLocalFolder *lf, guint32 flags, CamelException *ex)
+camel_local_folder_construct(CamelLocalFolder *lf, guint32 flags, GError **error)
 {
 	CamelFolder *folder;
 	CamelFolderInfo *fi;
@@ -347,7 +347,7 @@ camel_local_folder_construct(CamelLocalFolder *lf, guint32 flags, CamelException
 	}
 #ifndef G_OS_WIN32
 	/* follow any symlinks to the mailbox */
-	if (lstat (lf->folder_path, &st) != -1 && S_ISLNK (st.st_mode) &&
+	if (g_lstat (lf->folder_path, &st) != -1 && S_ISLNK (st.st_mode) &&
 	    realpath (lf->folder_path, folder_path) != NULL) {
 		g_free (lf->folder_path);
 		lf->folder_path = g_strdup (folder_path);
@@ -387,9 +387,9 @@ camel_local_folder_construct(CamelLocalFolder *lf, guint32 flags, CamelException
 	folder->summary = (CamelFolderSummary *)CAMEL_LOCAL_FOLDER_GET_CLASS(lf)->create_summary(lf, lf->summary_path, lf->folder_path, lf->index);
 	if (!(flags & CAMEL_STORE_IS_MIGRATING) && camel_local_summary_load((CamelLocalSummary *)folder->summary, forceindex, NULL) == -1) {
 		/* ? */
-		if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, ex) == 0) {
+		if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, error) == 0) {
 			/* we sync here so that any hard work setting up the folder isn't lost */
-			if (camel_local_summary_sync((CamelLocalSummary *)folder->summary, FALSE, lf->changes, ex) == -1) {
+			if (camel_local_summary_sync((CamelLocalSummary *)folder->summary, FALSE, lf->changes, error) == -1) {
 				g_object_unref (CAMEL_OBJECT (folder));
 				return NULL;
 			}
@@ -452,13 +452,13 @@ camel_local_folder_set_index_body (CamelLocalFolder *local_folder,
 
 /* lock the folder, may be called repeatedly (with matching unlock calls),
    with type the same or less than the first call */
-gint camel_local_folder_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex)
+gint camel_local_folder_lock(CamelLocalFolder *lf, CamelLockType type, GError **error)
 {
 	if (lf->locked > 0) {
 		/* lets be anal here - its important the code knows what its doing */
 		g_assert(lf->locktype == type || lf->locktype == CAMEL_LOCK_WRITE);
 	} else {
-		if (CAMEL_LOCAL_FOLDER_GET_CLASS(lf)->lock(lf, type, ex) == -1)
+		if (CAMEL_LOCAL_FOLDER_GET_CLASS(lf)->lock(lf, type, error) == -1)
 			return -1;
 		lf->locktype = type;
 	}
@@ -480,7 +480,7 @@ gint camel_local_folder_unlock(CamelLocalFolder *lf)
 }
 
 static gint
-local_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex)
+local_lock(CamelLocalFolder *lf, CamelLockType type, GError **error)
 {
 	return 0;
 }
@@ -493,13 +493,12 @@ local_unlock(CamelLocalFolder *lf)
 
 /* for auto-check to work */
 static gboolean
-local_refresh_info(CamelFolder *folder, CamelException *ex)
+local_refresh_info(CamelFolder *folder, GError **error)
 {
 	CamelLocalFolder *lf = (CamelLocalFolder *)folder;
 
-	if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, ex) == -1) {
+	if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, error) == -1)
 		return FALSE;
-	}
 
 	if (camel_folder_change_info_changed(lf->changes)) {
 		camel_folder_changed (folder, lf->changes);
@@ -510,7 +509,7 @@ local_refresh_info(CamelFolder *folder, CamelException *ex)
 }
 
 static GPtrArray *
-local_get_uncached_uids (CamelFolder *folder, GPtrArray * uids, CamelException *ex)
+local_get_uncached_uids (CamelFolder *folder, GPtrArray * uids, GError **error)
 {
 	GPtrArray *result = g_ptr_array_new ();
 	/* By default, we would have everything local. No need to fetch from anywhere. */
@@ -518,19 +517,19 @@ local_get_uncached_uids (CamelFolder *folder, GPtrArray * uids, CamelException *
 }
 
 static gboolean
-local_sync(CamelFolder *folder, gboolean expunge, CamelException *ex)
+local_sync(CamelFolder *folder, gboolean expunge, GError **error)
 {
 	CamelLocalFolder *lf = CAMEL_LOCAL_FOLDER(folder);
 
 	d(printf("local sync '%s' , expunge=%s\n", folder->full_name, expunge?"true":"false"));
 
-	if (camel_local_folder_lock(lf, CAMEL_LOCK_WRITE, ex) == -1)
+	if (camel_local_folder_lock(lf, CAMEL_LOCK_WRITE, error) == -1)
 		return FALSE;
 
 	camel_object_state_write (CAMEL_OBJECT (lf));
 
 	/* if sync fails, we'll pass it up on exit through ex */
-	camel_local_summary_sync((CamelLocalSummary *)folder->summary, expunge, lf->changes, ex);
+	camel_local_summary_sync((CamelLocalSummary *)folder->summary, expunge, lf->changes, error);
 	camel_local_folder_unlock(lf);
 
 	if (camel_folder_change_info_changed(lf->changes)) {
@@ -542,13 +541,13 @@ local_sync(CamelFolder *folder, gboolean expunge, CamelException *ex)
 }
 
 static gboolean
-local_expunge(CamelFolder *folder, CamelException *ex)
+local_expunge(CamelFolder *folder, GError **error)
 {
 	d(printf("expunge\n"));
 
 	/* Just do a sync with expunge, serves the same purpose */
 	/* call the callback directly, to avoid locking problems */
-	return CAMEL_FOLDER_GET_CLASS (folder)->sync (folder, TRUE, ex);
+	return CAMEL_FOLDER_GET_CLASS (folder)->sync (folder, TRUE, error);
 }
 
 static void
@@ -597,7 +596,7 @@ local_rename(CamelFolder *folder, const gchar *newname)
 }
 
 static GPtrArray *
-local_search_by_expression(CamelFolder *folder, const gchar *expression, CamelException *ex)
+local_search_by_expression(CamelFolder *folder, const gchar *expression, GError **error)
 {
 	CamelLocalFolder *local_folder = CAMEL_LOCAL_FOLDER(folder);
 	GPtrArray *matches;
@@ -609,7 +608,7 @@ local_search_by_expression(CamelFolder *folder, const gchar *expression, CamelEx
 
 	camel_folder_search_set_folder(local_folder->search, folder);
 	camel_folder_search_set_body_index(local_folder->search, local_folder->index);
-	matches = camel_folder_search_search(local_folder->search, expression, NULL, ex);
+	matches = camel_folder_search_search(local_folder->search, expression, NULL, error);
 
 	CAMEL_LOCAL_FOLDER_UNLOCK(folder, search_lock);
 
@@ -617,7 +616,7 @@ local_search_by_expression(CamelFolder *folder, const gchar *expression, CamelEx
 }
 
 static guint32
-local_count_by_expression(CamelFolder *folder, const gchar *expression, CamelException *ex)
+local_count_by_expression(CamelFolder *folder, const gchar *expression, GError **error)
 {
 	CamelLocalFolder *local_folder = CAMEL_LOCAL_FOLDER(folder);
 	gint matches;
@@ -629,7 +628,7 @@ local_count_by_expression(CamelFolder *folder, const gchar *expression, CamelExc
 
 	camel_folder_search_set_folder(local_folder->search, folder);
 	camel_folder_search_set_body_index(local_folder->search, local_folder->index);
-	matches = camel_folder_search_count (local_folder->search, expression, ex);
+	matches = camel_folder_search_count (local_folder->search, expression, error);
 
 	CAMEL_LOCAL_FOLDER_UNLOCK(folder, search_lock);
 
@@ -637,7 +636,7 @@ local_count_by_expression(CamelFolder *folder, const gchar *expression, CamelExc
 }
 
 static GPtrArray *
-local_search_by_uids(CamelFolder *folder, const gchar *expression, GPtrArray *uids, CamelException *ex)
+local_search_by_uids(CamelFolder *folder, const gchar *expression, GPtrArray *uids, GError **error)
 {
 	CamelLocalFolder *local_folder = CAMEL_LOCAL_FOLDER(folder);
 	GPtrArray *matches;
@@ -652,7 +651,7 @@ local_search_by_uids(CamelFolder *folder, const gchar *expression, GPtrArray *ui
 
 	camel_folder_search_set_folder(local_folder->search, folder);
 	camel_folder_search_set_body_index(local_folder->search, local_folder->index);
-	matches = camel_folder_search_search(local_folder->search, expression, uids, ex);
+	matches = camel_folder_search_search(local_folder->search, expression, uids, error);
 
 	CAMEL_LOCAL_FOLDER_UNLOCK(folder, search_lock);
 
@@ -674,10 +673,13 @@ local_search_free(CamelFolder *folder, GPtrArray * result)
 }
 
 void
-set_cannot_get_message_ex (CamelException *ex, ExceptionId exId, const gchar *msgID, const gchar *folder_path, const gchar *detailErr)
+set_cannot_get_message_ex (GError **error, gint err_code, const gchar *msgID, const gchar *folder_path, const gchar *detailErr)
 {
 	/* Translators: The first %s is replaced with a message ID,
 	   the second %s is replaced with the folder path,
 	   the third %s is replaced with a detailed error string */
-	camel_exception_setv (ex, exId, _("Cannot get message %s from folder %s\n%s"), msgID, folder_path, detailErr);
+	g_set_error (
+		error, CAMEL_ERROR, err_code,
+		_("Cannot get message %s from folder %s\n%s"),
+		msgID, folder_path, detailErr);
 }
diff --git a/camel/providers/local/camel-local-folder.h b/camel/providers/local/camel-local-folder.h
index 19d405b..1d3b077 100644
--- a/camel/providers/local/camel-local-folder.h
+++ b/camel/providers/local/camel-local-folder.h
@@ -79,7 +79,7 @@ struct _CamelLocalFolderClass {
 	CamelLocalSummary *(*create_summary)(CamelLocalFolder *lf, const gchar *path, const gchar *folder, CamelIndex *index);
 
 	/* Lock the folder for my operations */
-	gint (*lock)(CamelLocalFolder *, CamelLockType type, CamelException *ex);
+	gint (*lock)(CamelLocalFolder *, CamelLockType type, GError **error);
 
 	/* Unlock the folder for my operations */
 	void (*unlock)(CamelLocalFolder *);
@@ -91,7 +91,7 @@ GType		camel_local_folder_get_type	(void);
 CamelLocalFolder *
 		camel_local_folder_construct	(CamelLocalFolder *local_folder,
 						 guint32 flags,
-						 CamelException *ex);
+						 GError **error);
 gboolean	camel_local_folder_get_index_body
 						(CamelLocalFolder *local_folder);
 void		camel_local_folder_set_index_body
@@ -102,11 +102,11 @@ void		camel_local_folder_set_index_body
 /* UNIMPLEMENTED */
 gint		camel_local_folder_lock		(CamelLocalFolder *local_folder,
 						 CamelLockType type,
-						 CamelException *ex);
+						 GError **error);
 gint		camel_local_folder_unlock	(CamelLocalFolder *local_folder);
 
-void		set_cannot_get_message_ex	(CamelException *ex,
-						 ExceptionId exId,
+void		set_cannot_get_message_ex	(GError **error,
+						 gint err_code,
 						 const gchar *msgID,
 						 const gchar *folder_path,
 						 const gchar *detailErr);
diff --git a/camel/providers/local/camel-local-store.c b/camel/providers/local/camel-local-store.c
index 29a4149..ddfdb52 100644
--- a/camel/providers/local/camel-local-store.c
+++ b/camel/providers/local/camel-local-store.c
@@ -37,17 +37,17 @@
 
 #define d(x)
 
-static gboolean construct (CamelService *service, CamelSession *session, CamelProvider *provider, CamelURL *url, CamelException *ex);
-static CamelFolder *get_folder(CamelStore * store, const gchar *folder_name, guint32 flags, CamelException * ex);
+static gboolean construct (CamelService *service, CamelSession *session, CamelProvider *provider, CamelURL *url, GError **error);
+static CamelFolder *get_folder(CamelStore *store, const gchar *folder_name, guint32 flags, GError **error);
 static gchar *get_name(CamelService *service, gboolean brief);
-static CamelFolder *local_get_inbox (CamelStore *store, CamelException *ex);
-static CamelFolder *local_get_junk(CamelStore *store, CamelException *ex);
-static CamelFolder *local_get_trash(CamelStore *store, CamelException *ex);
-static CamelFolderInfo *get_folder_info (CamelStore *store, const gchar *top, guint32 flags, CamelException *ex);
-static gboolean delete_folder(CamelStore *store, const gchar *folder_name, CamelException *ex);
-static gboolean rename_folder(CamelStore *store, const gchar *old, const gchar *new, CamelException *ex);
-static CamelFolderInfo *create_folder(CamelStore *store, const gchar *parent_name, const gchar *folder_name, CamelException *ex);
-static gboolean local_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, CamelException *ex);
+static CamelFolder *local_get_inbox (CamelStore *store, GError **error);
+static CamelFolder *local_get_junk(CamelStore *store, GError **error);
+static CamelFolder *local_get_trash(CamelStore *store, GError **error);
+static CamelFolderInfo *get_folder_info (CamelStore *store, const gchar *top, guint32 flags, GError **error);
+static gboolean delete_folder(CamelStore *store, const gchar *folder_name, GError **error);
+static gboolean rename_folder(CamelStore *store, const gchar *old, const gchar *new, GError **error);
+static CamelFolderInfo *create_folder(CamelStore *store, const gchar *parent_name, const gchar *folder_name, GError **error);
+static gboolean local_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, GError **error);
 
 static gchar *local_get_full_path(CamelLocalStore *lf, const gchar *full_name);
 static gchar *local_get_meta_path(CamelLocalStore *lf, const gchar *full_name, const gchar *ext);
@@ -105,7 +105,7 @@ construct (CamelService *service,
            CamelSession *session,
            CamelProvider *provider,
            CamelURL *url,
-           CamelException *ex)
+           GError **error)
 {
 	CamelLocalStore *local_store = CAMEL_LOCAL_STORE (service);
 	CamelServiceClass *service_class;
@@ -113,7 +113,7 @@ construct (CamelService *service,
 
 	/* Chain up to parent's construct() method. */
 	service_class = CAMEL_SERVICE_CLASS (camel_local_store_parent_class);
-	if (!service_class->construct (service, session, provider, url, ex))
+	if (!service_class->construct (service, session, provider, url, error))
 		return FALSE;
 
 	len = strlen (service->url->path);
@@ -132,7 +132,7 @@ camel_local_store_get_toplevel_dir (CamelLocalStore *store)
 }
 
 static CamelFolder *
-get_folder(CamelStore * store, const gchar *folder_name, guint32 flags, CamelException * ex)
+get_folder(CamelStore *store, const gchar *folder_name, guint32 flags, GError **error)
 {
 	gint len = strlen(((CamelLocalStore *)store)->toplevel_dir);
 	gchar *path = g_alloca(len + 1);
@@ -143,16 +143,18 @@ get_folder(CamelStore * store, const gchar *folder_name, guint32 flags, CamelExc
 		path[len-1] = '\0';
 
 	if (!g_path_is_absolute(path)) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("Store root %s is not an absolute path"), path);
 		return NULL;
 	}
 
 	if (g_stat(path, &st) == 0) {
 		if (!S_ISDIR(st.st_mode)) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+			g_set_error (
+				error, CAMEL_STORE_ERROR,
+				CAMEL_STORE_ERROR_NO_FOLDER,
 				_("Store root %s is not a regular directory"), path);
 			return NULL;
 		}
@@ -161,8 +163,9 @@ get_folder(CamelStore * store, const gchar *folder_name, guint32 flags, CamelExc
 
 	if (errno != ENOENT
 	    || (flags & CAMEL_STORE_FOLDER_CREATE) == 0) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Cannot get folder: %s: %s"),
 			path, g_strerror (errno));
 		return NULL;
@@ -170,8 +173,9 @@ get_folder(CamelStore * store, const gchar *folder_name, guint32 flags, CamelExc
 
 	/* need to create the dir heirarchy */
 	if (g_mkdir_with_parents (path, 0700) == -1 && errno != EEXIST) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Cannot get folder: %s: %s"),
 			path, g_strerror (errno));
 		return NULL;
@@ -181,10 +185,11 @@ get_folder(CamelStore * store, const gchar *folder_name, guint32 flags, CamelExc
 }
 
 static CamelFolder *
-local_get_inbox(CamelStore *store, CamelException *ex)
+local_get_inbox(CamelStore *store, GError **error)
 {
-	camel_exception_set (
-		ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+	g_set_error (
+		error, CAMEL_STORE_ERROR,
+		CAMEL_STORE_ERROR_NO_FOLDER,
 		_("Local stores do not have an inbox"));
 
 	return NULL;
@@ -192,12 +197,12 @@ local_get_inbox(CamelStore *store, CamelException *ex)
 
 static CamelFolder *
 local_get_trash (CamelStore *store,
-                 CamelException *ex)
+                 GError **error)
 {
 	CamelFolder *folder;
 
 	/* Chain up to parent's get_trash() method. */
-	folder = CAMEL_STORE_CLASS (camel_local_store_parent_class)->get_trash (store, ex);
+	folder = CAMEL_STORE_CLASS (camel_local_store_parent_class)->get_trash (store, error);
 
 	if (folder) {
 		CamelObject *object = CAMEL_OBJECT (folder);
@@ -214,12 +219,12 @@ local_get_trash (CamelStore *store,
 
 static CamelFolder *
 local_get_junk (CamelStore *store,
-                CamelException *ex)
+                GError **error)
 {
 	CamelFolder *folder;
 
 	/* Chain up to parent's get_junk() method. */
-	folder = CAMEL_STORE_CLASS (camel_local_store_parent_class)->get_junk (store, ex);
+	folder = CAMEL_STORE_CLASS (camel_local_store_parent_class)->get_junk (store, error);
 
 	if (folder) {
 		CamelObject *object = CAMEL_OBJECT (folder);
@@ -247,7 +252,7 @@ get_name (CamelService *service, gboolean brief)
 
 static CamelFolderInfo *
 get_folder_info (CamelStore *store, const gchar *top,
-		 guint32 flags, CamelException *ex)
+		 guint32 flags, GError **error)
 {
 	/* FIXME: This is broken, but it corresponds to what was
 	 * there before.
@@ -262,7 +267,7 @@ static CamelFolderInfo *
 create_folder (CamelStore *store,
                const gchar *parent_name,
                const gchar *folder_name,
-               CamelException *ex)
+               GError **error)
 {
 	gchar *path = ((CamelLocalStore *)store)->toplevel_dir;
 	gchar *name;
@@ -273,8 +278,9 @@ create_folder (CamelStore *store,
 	/* This is a pretty hacky version of create folder, but should basically work */
 
 	if (!g_path_is_absolute(path)) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("Store root %s is not an absolute path"), path);
 		return NULL;
 	}
@@ -285,8 +291,9 @@ create_folder (CamelStore *store,
 		name = g_strdup_printf("%s/%s", path, folder_name);
 
 	if (g_stat(name, &st) == 0 || errno != ENOENT) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Cannot get folder: %s: %s"),
 			name, g_strerror (errno));
 		g_free(name);
@@ -301,11 +308,11 @@ create_folder (CamelStore *store,
 		name = g_strdup_printf("%s", folder_name);
 
 	folder = CAMEL_STORE_GET_CLASS (store)->get_folder (
-		store, name, CAMEL_STORE_FOLDER_CREATE, ex);
+		store, name, CAMEL_STORE_FOLDER_CREATE, error);
 	if (folder) {
 		g_object_unref (folder);
 		info = CAMEL_STORE_GET_CLASS (store)->get_folder_info (
-			store, name, 0, ex);
+			store, name, 0, error);
 	}
 
 	g_free(name);
@@ -319,7 +326,7 @@ xrename (const gchar *oldp,
          const gchar *prefix,
          const gchar *suffix,
          gint missingok,
-         CamelException *ex)
+         GError **error)
 {
 	struct stat st;
 	gchar *old = g_strconcat(prefix, oldp, suffix, NULL);
@@ -345,8 +352,9 @@ xrename (const gchar *oldp,
 	}
 
 	if (ret == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (err),
 			_("Could not rename folder %s to %s: %s"),
 			old, new, g_strerror (err));
 	}
@@ -361,7 +369,7 @@ static gboolean
 rename_folder(CamelStore *store,
               const gchar *old,
               const gchar *new,
-              CamelException *ex)
+              GError **error)
 {
 	gchar *path = CAMEL_LOCAL_STORE (store)->toplevel_dir;
 	CamelLocalFolder *folder = NULL;
@@ -382,16 +390,16 @@ rename_folder(CamelStore *store,
 			goto ibex_failed;
 	}
 
-	if (xrename(old, new, path, ".ev-summary", TRUE, ex))
+	if (xrename(old, new, path, ".ev-summary", TRUE, error))
 		goto summary_failed;
 
-	if (xrename(old, new, path, ".ev-summary-meta", TRUE, ex))
+	if (xrename(old, new, path, ".ev-summary-meta", TRUE, error))
 		goto summary_failed;
 
-	if (xrename(old, new, path, ".cmeta", TRUE, ex))
+	if (xrename(old, new, path, ".cmeta", TRUE, error))
 		goto cmeta_failed;
 
-	if (xrename(old, new, path, "", FALSE, ex))
+	if (xrename(old, new, path, "", FALSE, error))
 		goto base_failed;
 
 	g_free(newibex);
@@ -405,11 +413,11 @@ rename_folder(CamelStore *store,
 	/* The (f)utility of this recovery effort is quesitonable */
 
 base_failed:
-	xrename(new, old, path, ".cmeta", TRUE, ex);
+	xrename(new, old, path, ".cmeta", TRUE, NULL);
 
 cmeta_failed:
-	xrename(new, old, path, ".ev-summary", TRUE, ex);
-	xrename(new, old, path, ".ev-summary-meta", TRUE, ex);
+	xrename(new, old, path, ".ev-summary", TRUE, NULL);
+	xrename(new, old, path, ".ev-summary-meta", TRUE, NULL);
 summary_failed:
 	if (folder) {
 		if (folder->index)
@@ -417,8 +425,9 @@ summary_failed:
 	} else
 		camel_text_index_rename(newibex, oldibex);
 ibex_failed:
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, G_IO_ERROR,
+		g_io_error_from_errno (errno),
 		_("Could not rename '%s': %s"),
 		old, g_strerror (errno));
 
@@ -435,10 +444,9 @@ ibex_failed:
 static gboolean
 delete_folder (CamelStore *store,
                const gchar *folder_name,
-               CamelException *ex)
+               GError **error)
 {
 	CamelFolderInfo *fi;
-	CamelException lex;
 	CamelFolder *lf;
 	gchar *name;
 	gchar *str;
@@ -447,8 +455,9 @@ delete_folder (CamelStore *store,
 	name = g_strdup_printf("%s%s", CAMEL_LOCAL_STORE(store)->toplevel_dir, folder_name);
 	str = g_strdup_printf("%s.ibex", name);
 	if (camel_text_index_remove(str) == -1 && errno != ENOENT) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not delete folder index file '%s': %s"),
 			str, g_strerror (errno));
 		g_free(str);
@@ -458,8 +467,7 @@ delete_folder (CamelStore *store,
 	g_free(str);
 
 	str = NULL;
-	camel_exception_init (&lex);
-	if ((lf = camel_store_get_folder (store, folder_name, 0, &lex))) {
+	if ((lf = camel_store_get_folder (store, folder_name, 0, NULL))) {
 		CamelObject *object = CAMEL_OBJECT (lf);
 		const gchar *state_filename;
 
@@ -469,16 +477,15 @@ delete_folder (CamelStore *store,
 		camel_object_set_state_filename (object, NULL);
 
 		g_object_unref (lf);
-	} else {
-		camel_exception_clear (&lex);
 	}
 
 	if (str == NULL)
 		str = g_strdup_printf ("%s.cmeta", name);
 
 	if (g_unlink (str) == -1 && errno != ENOENT) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not delete folder meta file '%s': %s"),
 			str, g_strerror (errno));
 		g_free (name);
@@ -515,7 +522,7 @@ local_get_meta_path(CamelLocalStore *ls, const gchar *full_name, const gchar *ex
 }
 
 static gboolean
-local_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, CamelException *ex)
+local_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, GError **error)
 {
 	/* any local folder can be refreshed */
 	return TRUE;
diff --git a/camel/providers/local/camel-local-summary.c b/camel/providers/local/camel-local-summary.c
index 8cf829b..53268f0 100644
--- a/camel/providers/local/camel-local-summary.c
+++ b/camel/providers/local/camel-local-summary.c
@@ -43,7 +43,7 @@
 
 #define EXTRACT_FIRST_DIGIT(val) val=strtoul (part, &part, 10);
 
-static CamelFIRecord * summary_header_to_db (CamelFolderSummary *, CamelException *ex);
+static CamelFIRecord * summary_header_to_db (CamelFolderSummary *, GError **error);
 static gint summary_header_from_db (CamelFolderSummary *, CamelFIRecord *);
 
 static gint summary_header_load (CamelFolderSummary *, FILE *);
@@ -54,10 +54,10 @@ static CamelMessageInfo * message_info_new_from_header (CamelFolderSummary *, st
 static gint local_summary_decode_x_evolution(CamelLocalSummary *cls, const gchar *xev, CamelLocalMessageInfo *mi);
 static gchar *local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelLocalMessageInfo *mi);
 
-static gint local_summary_load(CamelLocalSummary *cls, gint forceindex, CamelException *ex);
-static gint local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-static gint local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-static CamelMessageInfo *local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);
+static gint local_summary_load(CamelLocalSummary *cls, gint forceindex, GError **error);
+static gint local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, GError **error);
+static gint local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, GError **error);
+static CamelMessageInfo *local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, GError **error);
 static gint local_summary_need_index(void);
 
 G_DEFINE_TYPE (CamelLocalSummary, camel_local_summary, CAMEL_TYPE_FOLDER_SUMMARY)
@@ -142,15 +142,15 @@ camel_local_summary_construct(CamelLocalSummary *new, const gchar *filename, con
 }
 
 static gint
-local_summary_load(CamelLocalSummary *cls, gint forceindex, CamelException *ex)
+local_summary_load(CamelLocalSummary *cls, gint forceindex, GError **error)
 {
 	d(g_print ("\nlocal_summary_load called \n"));
-	return camel_folder_summary_load_from_db ((CamelFolderSummary *)cls, ex);
+	return camel_folder_summary_load_from_db ((CamelFolderSummary *)cls, error);
 }
 
 /* load/check the summary */
 gint
-camel_local_summary_load(CamelLocalSummary *cls, gint forceindex, CamelException *ex)
+camel_local_summary_load(CamelLocalSummary *cls, gint forceindex, GError **error)
 {
 	CamelLocalSummaryClass *class;
 
@@ -159,7 +159,7 @@ camel_local_summary_load(CamelLocalSummary *cls, gint forceindex, CamelException
 	class = CAMEL_LOCAL_SUMMARY_GET_CLASS (cls);
 
 	if ((forceindex && class->need_index())
-	    || class->load(cls, forceindex, ex) == -1) {
+	    || class->load(cls, forceindex, error) == -1) {
 		w(g_warning("Could not load summary: flags may be reset"));
 		camel_folder_summary_clear((CamelFolderSummary *)cls);
 		return -1;
@@ -268,13 +268,13 @@ do_stat_mi(CamelLocalSummary *cls, struct _stat_info *info, CamelMessageInfo *mi
 gint
 camel_local_summary_check (CamelLocalSummary *cls,
                            CamelFolderChangeInfo *changeinfo,
-                           CamelException *ex)
+                           GError **error)
 {
 	CamelLocalSummaryClass *local_summary_class;
 	gint ret;
 
 	local_summary_class = CAMEL_LOCAL_SUMMARY_GET_CLASS (cls);
-	ret = local_summary_class->check(cls, changeinfo, ex);
+	ret = local_summary_class->check(cls, changeinfo, error);
 
 #ifdef DOSTATS
 	if (ret != -1) {
@@ -304,13 +304,13 @@ gint
 camel_local_summary_sync (CamelLocalSummary *cls,
                           gboolean expunge,
                           CamelFolderChangeInfo *changeinfo,
-                          CamelException *ex)
+                          GError **error)
 {
 	CamelLocalSummaryClass *local_summary_class;
 
 	local_summary_class = CAMEL_LOCAL_SUMMARY_GET_CLASS (cls);
 
-	return local_summary_class->sync (cls, expunge, changeinfo, ex);
+	return local_summary_class->sync (cls, expunge, changeinfo, error);
 }
 
 CamelMessageInfo *
@@ -318,13 +318,13 @@ camel_local_summary_add (CamelLocalSummary *cls,
                          CamelMimeMessage *msg,
                          const CamelMessageInfo *info,
                          CamelFolderChangeInfo *ci,
-                         CamelException *ex)
+                         GError **error)
 {
 	CamelLocalSummaryClass *local_summary_class;
 
 	local_summary_class = CAMEL_LOCAL_SUMMARY_GET_CLASS (cls);
 
-	return local_summary_class->add (cls, msg, info, ci, ex);
+	return local_summary_class->add (cls, msg, info, ci, error);
 }
 
 /**
@@ -416,7 +416,7 @@ camel_local_summary_write_headers(gint fd, struct _camel_header_raw *header, con
 }
 
 static gint
-local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex)
+local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, GError **error)
 {
 	/* FIXME: sync index here ? */
 	return 0;
@@ -426,13 +426,13 @@ static gint
 local_summary_sync (CamelLocalSummary *cls,
                     gboolean expunge,
                     CamelFolderChangeInfo *changeinfo,
-                    CamelException *ex)
+                    GError **error)
 {
 	CamelFolderSummary *folder_summary;
 
 	folder_summary = CAMEL_FOLDER_SUMMARY (cls);
 
-	if (camel_folder_summary_save_to_db (folder_summary, ex) == -1) {
+	if (camel_folder_summary_save_to_db (folder_summary, error) == -1) {
 		g_warning ("Could not save summary for local providers");
 		return -1;
 	}
@@ -485,7 +485,7 @@ update_summary (CamelFolderSummary *summary, CamelMessageInfoBase *info, CamelMe
 }
 
 static CamelMessageInfo *
-local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *ci, CamelException *ex)
+local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *ci, GError **error)
 {
 	CamelLocalMessageInfo *mi;
 	CamelFolderSummary *s = (CamelFolderSummary *)cls;
@@ -520,7 +520,7 @@ local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMess
 		if (mi->info.size == 0) {
 			CamelStreamNull *sn = (CamelStreamNull *)camel_stream_null_new();
 
-			camel_data_wrapper_write_to_stream((CamelDataWrapper *)msg, (CamelStream *)sn);
+			camel_data_wrapper_write_to_stream((CamelDataWrapper *)msg, (CamelStream *)sn, NULL);
 			mi->info.size = sn->written;
 			g_object_unref (sn);
 		}
@@ -532,8 +532,8 @@ local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMess
 		camel_folder_change_info_add_uid(ci, camel_message_info_uid(mi));
 	} else {
 		d(printf("Failed!\n"));
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Unable to add message to summary: unknown reason"));
 	}
 	return (CamelMessageInfo *)mi;
@@ -702,14 +702,14 @@ summary_header_load(CamelFolderSummary *s, FILE *in)
 }
 
 static struct _CamelFIRecord *
-summary_header_to_db (CamelFolderSummary *s, CamelException *ex)
+summary_header_to_db (CamelFolderSummary *s, GError **error)
 {
 	CamelFolderSummaryClass *folder_summary_class;
 	struct _CamelFIRecord *fir;
 
 	/* Chain up to parent's summary_header_to_db() method. */
 	folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (camel_local_summary_parent_class);
-	fir = folder_summary_class->summary_header_to_db (s, ex);
+	fir = folder_summary_class->summary_header_to_db (s, NULL);
 	if (fir)
 		fir->bdata = g_strdup_printf ("%d", CAMEL_LOCAL_SUMMARY_VERSION);
 
diff --git a/camel/providers/local/camel-local-summary.h b/camel/providers/local/camel-local-summary.h
index 204ff1c..423a93d 100644
--- a/camel/providers/local/camel-local-summary.h
+++ b/camel/providers/local/camel-local-summary.h
@@ -75,10 +75,10 @@ struct _CamelLocalSummary {
 struct _CamelLocalSummaryClass {
 	CamelFolderSummaryClass parent_class;
 
-	gint (*load)(CamelLocalSummary *cls, gint forceindex, CamelException *ex);
-	gint (*check)(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-	gint (*sync)(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-	CamelMessageInfo *(*add)(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);
+	gint (*load)(CamelLocalSummary *cls, gint forceindex, GError **error);
+	gint (*check)(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, GError **error);
+	gint (*sync)(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, GError **error);
+	CamelMessageInfo *(*add)(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, GError **error);
 
 	gchar *(*encode_x_evolution)(CamelLocalSummary *cls, const CamelLocalMessageInfo *info);
 	gint (*decode_x_evolution)(CamelLocalSummary *cls, const gchar *xev, CamelLocalMessageInfo *info);
@@ -89,13 +89,13 @@ GType	camel_local_summary_get_type	(void);
 void	camel_local_summary_construct	(CamelLocalSummary *new, const gchar *filename, const gchar *local_name, CamelIndex *index);
 
 /* load/check the summary */
-gint camel_local_summary_load(CamelLocalSummary *cls, gint forceindex, CamelException *ex);
+gint camel_local_summary_load(CamelLocalSummary *cls, gint forceindex, GError **error);
 /* check for new/removed messages */
-gint camel_local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *, CamelException *ex);
+gint camel_local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *, GError **error);
 /* perform a folder sync or expunge, if needed */
-gint camel_local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *, CamelException *ex);
+gint camel_local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *, GError **error);
 /* add a new message to the summary */
-CamelMessageInfo *camel_local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);
+CamelMessageInfo *camel_local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, GError **error);
 
 /* force the next check to be a full check/rebuild */
 void camel_local_summary_check_force(CamelLocalSummary *cls);
diff --git a/camel/providers/local/camel-maildir-folder.c b/camel/providers/local/camel-maildir-folder.c
index a85432c..624b56d 100644
--- a/camel/providers/local/camel-maildir-folder.c
+++ b/camel/providers/local/camel-maildir-folder.c
@@ -43,12 +43,12 @@
 
 static CamelLocalSummary *maildir_create_summary(CamelLocalFolder *lf, const gchar *path, const gchar *folder, CamelIndex *index);
 
-static gboolean maildir_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, gchar **appended_uid, CamelException * ex);
-static CamelMimeMessage *maildir_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex);
-static gchar * maildir_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex);
+static gboolean maildir_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, gchar **appended_uid, GError **error);
+static CamelMimeMessage *maildir_get_message(CamelFolder * folder, const gchar * uid, GError **error);
+static gchar * maildir_get_filename (CamelFolder *folder, const gchar *uid, GError **error);
 static gint maildir_cmp_uids (CamelFolder *folder, const gchar *uid1, const gchar *uid2);
 static void maildir_sort_uids (CamelFolder *folder, GPtrArray *uids);
-static gboolean maildir_transfer_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *dest, GPtrArray **transferred_uids, gboolean delete_originals, CamelException *ex);
+static gboolean maildir_transfer_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *dest, GPtrArray **transferred_uids, gboolean delete_originals, GError **error);
 
 G_DEFINE_TYPE (CamelMaildirFolder, camel_maildir_folder, CAMEL_TYPE_LOCAL_FOLDER)
 
@@ -79,7 +79,7 @@ CamelFolder *
 camel_maildir_folder_new (CamelStore *parent_store,
                           const gchar *full_name,
                           guint32 flags,
-                          CamelException *ex)
+                          GError **error)
 {
 	CamelFolder *folder;
 	gchar *basename;
@@ -101,7 +101,7 @@ camel_maildir_folder_new (CamelStore *parent_store,
 		folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
 
 	folder = (CamelFolder *) camel_local_folder_construct (
-		CAMEL_LOCAL_FOLDER (folder), flags, ex);
+		CAMEL_LOCAL_FOLDER (folder), flags, error);
 
 	g_free (basename);
 
@@ -123,7 +123,7 @@ maildir_append_message (CamelFolder *folder,
                         CamelMimeMessage *message,
                         const CamelMessageInfo *info,
                         gchar **appended_uid,
-                        CamelException *ex)
+                        GError **error)
 {
 	CamelLocalFolder *lf = (CamelLocalFolder *)folder;
 	CamelStream *output_stream;
@@ -135,13 +135,13 @@ maildir_append_message (CamelFolder *folder,
 	d(printf("Appending message\n"));
 
 	/* If we can't lock, don't do anything */
-	if (camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, ex) == -1)
+	if (camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, error) == -1)
 		return FALSE;
 
 	/* add it to the summary/assign the uid, etc */
 	mi = camel_local_summary_add (
 		CAMEL_LOCAL_SUMMARY (folder->summary),
-		message, info, lf->changes, ex);
+		message, info, lf->changes, error);
 	if (mi == NULL)
 		goto check_changed;
 
@@ -155,18 +155,24 @@ maildir_append_message (CamelFolder *folder,
 	/* write it out to tmp, use the uid we got from the summary */
 	name = g_strdup_printf ("%s/tmp/%s", lf->folder_path, camel_message_info_uid(mi));
 	output_stream = camel_stream_fs_new_with_name (
-		name, O_WRONLY|O_CREAT, 0600);
+		name, O_WRONLY|O_CREAT, 0600, error);
 	if (output_stream == NULL)
 		goto fail_write;
 
-	if (camel_data_wrapper_write_to_stream ((CamelDataWrapper *)message, output_stream) == -1
-	    || camel_stream_close (output_stream) == -1)
+	if (camel_data_wrapper_write_to_stream (
+		(CamelDataWrapper *)message, output_stream, error) == -1
+	    || camel_stream_close (output_stream, error) == -1)
 		goto fail_write;
 
 	/* now move from tmp to cur (bypass new, does it matter?) */
 	dest = g_strdup_printf("%s/cur/%s", lf->folder_path, camel_maildir_info_filename (mdi));
-	if (rename (name, dest) == -1)
+	if (g_rename (name, dest) == -1) {
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
+			"%s", g_strerror (errno));
 		goto fail_write;
+	}
 
 	g_free (dest);
 	g_free (name);
@@ -185,15 +191,9 @@ maildir_append_message (CamelFolder *folder,
 	camel_folder_summary_remove_uid (CAMEL_FOLDER_SUMMARY (folder->summary),
 					 camel_message_info_uid (mi));
 
-	if (errno == EINTR)
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_USER_CANCEL,
-			_("Maildir append message canceled"));
-	else
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Cannot append message to maildir folder: %s: %s"),
-			name, g_strerror (errno));
+	g_prefix_error (
+		error, _("Cannot append message to maildir folder: %s: "),
+		name);
 
 	if (output_stream) {
 		g_object_unref (CAMEL_OBJECT (output_stream));
@@ -219,7 +219,7 @@ maildir_append_message (CamelFolder *folder,
 static gchar *
 maildir_get_filename (CamelFolder *folder,
                       const gchar *uid,
-                      CamelException *ex)
+                      GError **error)
 {
 	CamelLocalFolder *lf = (CamelLocalFolder *)folder;
 	CamelMaildirMessageInfo *mdi;
@@ -229,7 +229,7 @@ maildir_get_filename (CamelFolder *folder,
 	/* get the message summary info */
 	if ((info = camel_folder_summary_uid(folder->summary, uid)) == NULL) {
 		set_cannot_get_message_ex (
-			ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+			error, CAMEL_FOLDER_ERROR_INVALID_UID,
 			uid, lf->folder_path, _("No such message"));
 		return NULL;
 	}
@@ -247,7 +247,7 @@ maildir_get_filename (CamelFolder *folder,
 static CamelMimeMessage *
 maildir_get_message (CamelFolder *folder,
                      const gchar *uid,
-                     CamelException * ex)
+                     GError **error)
 {
 	CamelLocalFolder *lf = (CamelLocalFolder *)folder;
 	CamelStream *message_stream = NULL;
@@ -258,13 +258,13 @@ maildir_get_message (CamelFolder *folder,
 
 	d(printf("getting message: %s\n", uid));
 
-	if (camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, ex) == -1)
+	if (camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, error) == -1)
 		return NULL;
 
 	/* get the message summary info */
 	if ((info = camel_folder_summary_uid(folder->summary, uid)) == NULL) {
 		set_cannot_get_message_ex (
-			ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+			error, CAMEL_FOLDER_ERROR_INVALID_UID,
 			uid, lf->folder_path, _("No such message"));
 		goto fail;
 	}
@@ -276,19 +276,20 @@ maildir_get_message (CamelFolder *folder,
 
 	camel_message_info_free(info);
 
-	if ((message_stream = camel_stream_fs_new_with_name(name, O_RDONLY, 0)) == NULL) {
-		set_cannot_get_message_ex (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			uid, lf->folder_path, g_strerror (errno));
+	message_stream = camel_stream_fs_new_with_name (
+		name, O_RDONLY, 0, error);
+	if (message_stream == NULL) {
+		g_prefix_error (
+			error, _("Cannot get message %s from folder %s: "),
+			uid, lf->folder_path);
 		goto fail;
 	}
 
 	message = camel_mime_message_new();
-	if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)message, message_stream) == -1) {
-		set_cannot_get_message_ex (
-			ex, (errno==EINTR) ?
-			CAMEL_EXCEPTION_USER_CANCEL : CAMEL_EXCEPTION_SYSTEM,
-			uid, lf->folder_path, _("Invalid message contents"));
+	if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)message, message_stream, error) == -1) {
+		g_prefix_error (
+			error, _("Cannot get message %s from folder %s: "),
+			uid, lf->folder_path);
 		g_object_unref (message);
 		message = NULL;
 
@@ -340,18 +341,8 @@ maildir_sort_uids (CamelFolder *folder,
 	g_return_if_fail (camel_maildir_folder_parent_class != NULL);
 	g_return_if_fail (folder != NULL);
 
-	if (uids && uids->len > 1) {
-		CamelException ex;
-
-		camel_exception_init (&ex);
-
-		camel_folder_summary_prepare_fetch_all (folder->summary, &ex);
-
-		if (camel_exception_is_set (&ex))
-			g_warning ("%s: %s", G_STRFUNC, camel_exception_get_description (&ex));
-
-		camel_exception_clear (&ex);
-	}
+	if (uids && uids->len > 1)
+		camel_folder_summary_prepare_fetch_all (folder->summary, NULL);
 
 	/* Chain up to parent's sort_uids() method. */
 	CAMEL_FOLDER_CLASS (camel_maildir_folder_parent_class)->sort_uids (folder, uids);
@@ -363,7 +354,7 @@ maildir_transfer_messages_to (CamelFolder *source,
                               CamelFolder *dest,
                               GPtrArray **transferred_uids,
                               gboolean delete_originals,
-                              CamelException *ex)
+                              GError **error)
 {
 	gboolean fallback = FALSE;
 
@@ -385,7 +376,7 @@ maildir_transfer_messages_to (CamelFolder *source,
 
 			if ((info = camel_folder_summary_uid (source->summary, uid)) == NULL) {
 				set_cannot_get_message_ex (
-					ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+					error, CAMEL_FOLDER_ERROR_INVALID_UID,
 					uid, lf->folder_path, _("No such message"));
 				return FALSE;
 			}
@@ -402,9 +393,11 @@ maildir_transfer_messages_to (CamelFolder *source,
 					i = uids->len + 1;
 					fallback = TRUE;
 				} else {
-					camel_exception_set (
-						ex, CAMEL_EXCEPTION_SYSTEM,
-						_("Cannot transfer message to destination folder"));
+					g_set_error (
+						error, G_IO_ERROR,
+						g_io_error_from_errno (errno),
+						_("Cannot transfer message to destination folder: %s"),
+						g_strerror (errno));
 					camel_message_info_free (info);
 					break;
 				}
@@ -432,7 +425,7 @@ maildir_transfer_messages_to (CamelFolder *source,
 		folder_class = CAMEL_FOLDER_CLASS (camel_maildir_folder_parent_class);
 		return folder_class->transfer_messages_to (
 			source, uids, dest, transferred_uids,
-			delete_originals, ex);
+			delete_originals, error);
 	}
 
 	return TRUE;
diff --git a/camel/providers/local/camel-maildir-folder.h b/camel/providers/local/camel-maildir-folder.h
index 2165756..d52b545 100644
--- a/camel/providers/local/camel-maildir-folder.h
+++ b/camel/providers/local/camel-maildir-folder.h
@@ -58,7 +58,7 @@ struct _CamelMaildirFolderClass {
 };
 
 /* public methods */
-CamelFolder *camel_maildir_folder_new(CamelStore *parent_store, const gchar *full_name, guint32 flags, CamelException *ex);
+CamelFolder *camel_maildir_folder_new(CamelStore *parent_store, const gchar *full_name, guint32 flags, GError **error);
 
 GType camel_maildir_folder_get_type(void);
 
diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c
index b0859e3..3b60c22 100644
--- a/camel/providers/local/camel-maildir-store.c
+++ b/camel/providers/local/camel-maildir-store.c
@@ -30,6 +30,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#include <glib/gstdio.h>
 #include <glib/gi18n-lib.h>
 
 #include "camel-maildir-folder.h"
@@ -38,12 +39,12 @@
 
 #define d(x)
 
-static CamelFolder *get_folder(CamelStore * store, const gchar *folder_name, guint32 flags, CamelException * ex);
-static CamelFolder *get_inbox (CamelStore *store, CamelException *ex);
-static gboolean delete_folder(CamelStore * store, const gchar *folder_name, CamelException * ex);
-static gboolean maildir_rename_folder(CamelStore *store, const gchar *old, const gchar *new, CamelException *ex);
+static CamelFolder *get_folder(CamelStore * store, const gchar *folder_name, guint32 flags, GError **error);
+static CamelFolder *get_inbox (CamelStore *store, GError **error);
+static gboolean delete_folder(CamelStore * store, const gchar *folder_name, GError **error);
+static gboolean maildir_rename_folder(CamelStore *store, const gchar *old, const gchar *new, GError **error);
 
-static CamelFolderInfo * get_folder_info (CamelStore *store, const gchar *top, guint32 flags, CamelException *ex);
+static CamelFolderInfo * get_folder_info (CamelStore *store, const gchar *top, guint32 flags, GError **error);
 
 static gboolean maildir_compare_folder_name(gconstpointer a, gconstpointer b);
 static guint maildir_hash_folder_name(gconstpointer a);
@@ -102,7 +103,7 @@ static CamelFolder *
 get_folder (CamelStore *store,
             const gchar *folder_name,
             guint32 flags,
-            CamelException * ex)
+            GError **error)
 {
 	CamelStoreClass *store_class;
 	gchar *name, *tmp, *cur, *new;
@@ -113,7 +114,7 @@ get_folder (CamelStore *store,
 
 	/* Chain up to parent's get_folder() method. */
 	store_class = CAMEL_STORE_CLASS (camel_maildir_store_parent_class);
-	if (!store_class->get_folder (store, folder_name, flags, ex))
+	if (!store_class->get_folder (store, folder_name, flags, error))
 		return NULL;
 
 	name = g_strdup_printf("%s%s", CAMEL_LOCAL_STORE(store)->toplevel_dir, folder_name);
@@ -123,14 +124,15 @@ get_folder (CamelStore *store,
 
 	if (!strcmp(folder_name, ".")) {
 		/* special case "." (aka inbox), may need to be created */
-		if (stat(tmp, &st) != 0 || !S_ISDIR(st.st_mode)
-		    || stat(cur, &st) != 0 || !S_ISDIR(st.st_mode)
-		    || stat(new, &st) != 0 || !S_ISDIR(st.st_mode)) {
+		if (g_stat(tmp, &st) != 0 || !S_ISDIR(st.st_mode)
+		    || g_stat(cur, &st) != 0 || !S_ISDIR(st.st_mode)
+		    || g_stat(new, &st) != 0 || !S_ISDIR(st.st_mode)) {
 			if (mkdir(tmp, 0700) != 0
 			    || mkdir(cur, 0700) != 0
 			    || mkdir(new, 0700) != 0) {
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_SYSTEM,
+				g_set_error (
+					error, G_IO_ERROR,
+					g_io_error_from_errno (errno),
 					_("Cannot create folder '%s': %s"),
 					folder_name, g_strerror(errno));
 				rmdir(tmp);
@@ -139,17 +141,19 @@ get_folder (CamelStore *store,
 				goto fail;
 			}
 		}
-		folder = camel_maildir_folder_new(store, folder_name, flags, ex);
-	} else if (stat(name, &st) == -1) {
+		folder = camel_maildir_folder_new(store, folder_name, flags, error);
+	} else if (g_stat(name, &st) == -1) {
 		/* folder doesn't exist, see if we should create it */
 		if (errno != ENOENT) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Cannot get folder '%s': %s"),
 				folder_name, g_strerror (errno));
 		} else if ((flags & CAMEL_STORE_FOLDER_CREATE) == 0) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+			g_set_error (
+				error, CAMEL_STORE_ERROR,
+				CAMEL_STORE_ERROR_NO_FOLDER,
 				_("Cannot get folder '%s': folder does not exist."),
 				folder_name);
 		} else {
@@ -157,8 +161,9 @@ get_folder (CamelStore *store,
 			    || mkdir(tmp, 0700) != 0
 			    || mkdir(cur, 0700) != 0
 			    || mkdir(new, 0700) != 0) {
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_SYSTEM,
+				g_set_error (
+					error, G_IO_ERROR,
+					g_io_error_from_errno (errno),
 					_("Cannot create folder '%s': %s"),
 					folder_name, g_strerror (errno));
 				rmdir(tmp);
@@ -166,25 +171,25 @@ get_folder (CamelStore *store,
 				rmdir(new);
 				rmdir(name);
 			} else {
-				folder = camel_maildir_folder_new(store, folder_name, flags, ex);
+				folder = camel_maildir_folder_new(store, folder_name, flags, error);
 			}
 		}
 	} else if (!S_ISDIR(st.st_mode)
-		   || stat(tmp, &st) != 0 || !S_ISDIR(st.st_mode)
-		   || stat(cur, &st) != 0 || !S_ISDIR(st.st_mode)
-		   || stat(new, &st) != 0 || !S_ISDIR(st.st_mode)) {
+		   || g_stat(tmp, &st) != 0 || !S_ISDIR(st.st_mode)
+		   || g_stat(cur, &st) != 0 || !S_ISDIR(st.st_mode)
+		   || g_stat(new, &st) != 0 || !S_ISDIR(st.st_mode)) {
 		/* folder exists, but not maildir */
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot get folder '%s': not a maildir directory."),
 			name);
 	} else if (flags & CAMEL_STORE_FOLDER_EXCL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot create folder '%s': folder exists."),
 			folder_name);
 	} else {
-		folder = camel_maildir_folder_new(store, folder_name, flags, ex);
+		folder = camel_maildir_folder_new(store, folder_name, flags, error);
 	}
 fail:
 	g_free(name);
@@ -197,24 +202,25 @@ fail:
 
 static CamelFolder *
 get_inbox (CamelStore *store,
-           CamelException *ex)
+           GError **error)
 {
 	return camel_store_get_folder (
-		store, ".", CAMEL_STORE_FOLDER_CREATE, ex);
+		store, ".", CAMEL_STORE_FOLDER_CREATE, error);
 }
 
 static gboolean
 delete_folder (CamelStore *store,
                const gchar *folder_name,
-               CamelException *ex)
+               GError **error)
 {
 	gchar *name, *tmp, *cur, *new;
 	struct stat st;
 	gboolean success = TRUE;
 
 	if (strcmp(folder_name, ".") == 0) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("Cannot delete folder: %s: Invalid operation"),
 			_("Inbox"));
 		return FALSE;
@@ -226,12 +232,13 @@ delete_folder (CamelStore *store,
 	cur = g_strdup_printf("%s/cur", name);
 	new = g_strdup_printf("%s/new", name);
 
-	if (stat(name, &st) == -1 || !S_ISDIR(st.st_mode)
-	    || stat(tmp, &st) == -1 || !S_ISDIR(st.st_mode)
-	    || stat(cur, &st) == -1 || !S_ISDIR(st.st_mode)
-	    || stat(new, &st) == -1 || !S_ISDIR(st.st_mode)) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+	if (g_stat(name, &st) == -1 || !S_ISDIR(st.st_mode)
+	    || g_stat(tmp, &st) == -1 || !S_ISDIR(st.st_mode)
+	    || g_stat(cur, &st) == -1 || !S_ISDIR(st.st_mode)
+	    || g_stat(new, &st) == -1 || !S_ISDIR(st.st_mode)) {
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not delete folder '%s': %s"),
 			folder_name, errno ? g_strerror (errno) :
 			_("not a maildir directory"));
@@ -269,8 +276,9 @@ delete_folder (CamelStore *store,
 			mkdir(cur, 0700);
 			mkdir(new, 0700);
 			mkdir(tmp, 0700);
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (err),
 				_("Could not delete folder '%s': %s"),
 				folder_name, g_strerror (err));
 		} else {
@@ -279,7 +287,7 @@ delete_folder (CamelStore *store,
 			/* Chain up to parent's delete_folder() method. */
 			store_class = CAMEL_STORE_CLASS (camel_maildir_store_parent_class);
 			success = store_class->delete_folder (
-				store, folder_name, ex);
+				store, folder_name, error);
 		}
 	}
 
@@ -295,13 +303,14 @@ static gboolean
 maildir_rename_folder (CamelStore *store,
                        const gchar *old,
                        const gchar *new,
-                       CamelException *ex)
+                       GError **error)
 {
 	CamelStoreClass *store_class;
 
 	if (strcmp(old, ".") == 0) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("Cannot rename folder: %s: Invalid operation"),
 			_("Inbox"));
 		return FALSE;
@@ -309,7 +318,7 @@ maildir_rename_folder (CamelStore *store,
 
 	/* Chain up to parent's rename_folder() method. */
 	store_class = CAMEL_STORE_CLASS (camel_maildir_store_parent_class);
-	return store_class->rename_folder(store, old, new, ex);
+	return store_class->rename_folder(store, old, new, error);
 }
 
 static void
@@ -413,9 +422,9 @@ scan_fi (CamelStore *store,
 	cur = g_build_filename(url->path, fi->full_name, "cur", NULL);
 	new = g_build_filename(url->path, fi->full_name, "new", NULL);
 
-	if (!(stat(tmp, &st) == 0 && S_ISDIR(st.st_mode)
-	      && stat(cur, &st) == 0 && S_ISDIR(st.st_mode)
-	      && stat(new, &st) == 0 && S_ISDIR(st.st_mode)))
+	if (!(g_stat(tmp, &st) == 0 && S_ISDIR(st.st_mode)
+	      && g_stat(cur, &st) == 0 && S_ISDIR(st.st_mode)
+	      && g_stat(new, &st) == 0 && S_ISDIR(st.st_mode)))
 		fi->flags |= CAMEL_FOLDER_NOSELECT;
 
 	g_free(new);
@@ -432,7 +441,7 @@ scan_dirs (CamelStore *store,
            guint32 flags,
            CamelFolderInfo *topfi,
            CamelURL *url,
-           CamelException *ex)
+           GError **error)
 {
 	CamelDList queue = CAMEL_DLIST_INITIALISER(queue);
 	struct _scan_node *sn;
@@ -467,8 +476,9 @@ scan_dirs (CamelStore *store,
 		dir = opendir(name);
 		if (dir == NULL) {
 			g_free(name);
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Could not scan folder '%s': %s"),
 				root, g_strerror (errno));
 			goto fail;
@@ -484,7 +494,7 @@ scan_dirs (CamelStore *store,
 				continue;
 
 			tmp = g_build_filename(name, d->d_name, NULL);
-			if (stat(tmp, &st) == 0 && S_ISDIR(st.st_mode)) {
+			if (g_stat(tmp, &st) == 0 && S_ISDIR(st.st_mode)) {
 				struct _scan_node in;
 
 				in.dnode = st.st_dev;
@@ -536,7 +546,7 @@ static CamelFolderInfo *
 get_folder_info (CamelStore *store,
                  const gchar *top,
                  guint32 flags,
-                 CamelException *ex)
+                 GError **error)
 {
 	CamelFolderInfo *fi = NULL;
 	CamelLocalStore *local_store = (CamelLocalStore *)store;
@@ -550,7 +560,7 @@ get_folder_info (CamelStore *store,
 
 		/* create a dummy "." parent inbox, use to scan, then put back at the top level */
 		fi = scan_fi(store, flags, url, ".", _("Inbox"));
-		if (scan_dirs(store, flags, fi, url, ex) == -1)
+		if (scan_dirs(store, flags, fi, url, error) == -1)
 			goto fail;
 		fi->next = fi->child;
 		scan = fi->child;
@@ -568,7 +578,7 @@ get_folder_info (CamelStore *store,
 		const gchar *name = strrchr(top, '/');
 
 		fi = scan_fi(store, flags, url, top, name?name+1:top);
-		if (scan_dirs(store, flags, fi, url, ex) == -1)
+		if (scan_dirs(store, flags, fi, url, error) == -1)
 			goto fail;
 	}
 
diff --git a/camel/providers/local/camel-maildir-summary.c b/camel/providers/local/camel-maildir-summary.c
index a15c536..cb012bc 100644
--- a/camel/providers/local/camel-maildir-summary.c
+++ b/camel/providers/local/camel-maildir-summary.c
@@ -33,6 +33,7 @@
 #include <sys/types.h>
 #include <sys/uio.h>
 
+#include <glib/gstdio.h>
 #include <glib/gi18n-lib.h>
 
 #include "camel-maildir-summary.h"
@@ -49,10 +50,10 @@ static CamelMessageInfo *message_info_migrate (CamelFolderSummary *s, FILE *in);
 static CamelMessageInfo *message_info_new_from_header(CamelFolderSummary *, struct _camel_header_raw *);
 static void message_info_free(CamelFolderSummary *, CamelMessageInfo *mi);
 
-static gint maildir_summary_load(CamelLocalSummary *cls, gint forceindex, CamelException *ex);
-static gint maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-static gint maildir_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-static CamelMessageInfo *maildir_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);
+static gint maildir_summary_load(CamelLocalSummary *cls, gint forceindex, GError **error);
+static gint maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, GError **error);
+static gint maildir_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, GError **error);
+static CamelMessageInfo *maildir_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, GError **error);
 
 static gchar *maildir_summary_next_uid_string(CamelFolderSummary *s);
 static gint maildir_summary_decode_x_evolution(CamelLocalSummary *cls, const gchar *xev, CamelLocalMessageInfo *mi);
@@ -249,7 +250,7 @@ maildir_summary_add (CamelLocalSummary *cls,
                      CamelMimeMessage *msg,
                      const CamelMessageInfo *info,
                      CamelFolderChangeInfo *changes,
-                     CamelException *ex)
+                     GError **error)
 {
 	CamelLocalSummaryClass *local_summary_class;
 	CamelMaildirMessageInfo *mi;
@@ -257,7 +258,7 @@ maildir_summary_add (CamelLocalSummary *cls,
 	/* Chain up to parent's add() method. */
 	local_summary_class = CAMEL_LOCAL_SUMMARY_CLASS (camel_maildir_summary_parent_class);
 	mi = (CamelMaildirMessageInfo *) local_summary_class->add (
-		cls, msg, info, changes, ex);
+		cls, msg, info, changes, error);
 	if (mi) {
 		if (info) {
 			camel_maildir_info_set_filename(mi, camel_maildir_summary_info_to_name(mi));
@@ -377,7 +378,7 @@ static gchar *maildir_summary_next_uid_string(CamelFolderSummary *s)
 			uid = g_strdup_printf("%ld.%d_%u.%s", time(NULL), getpid(), nextuid, mds->priv->hostname);
 			name = g_strdup_printf("%s/tmp/%s", cls->folder_path, uid);
 			retry++;
-		} while (stat(name, &st) == 0 && retry<3);
+		} while (g_stat(name, &st) == 0 && retry<3);
 
 		/* I dont know what we're supposed to do if it fails to find a unique name?? */
 
@@ -411,7 +412,7 @@ message_info_migrate (CamelFolderSummary *s, FILE *in)
 static gint
 maildir_summary_load (CamelLocalSummary *cls,
                       gint forceindex,
-                      CamelException *ex)
+                      GError **error)
 {
 	CamelLocalSummaryClass *local_summary_class;
 	gchar *cur;
@@ -428,8 +429,9 @@ maildir_summary_load (CamelLocalSummary *cls,
 
 	dir = opendir(cur);
 	if (dir == NULL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Cannot open maildir directory path: %s: %s"),
 			cls->folder_path, g_strerror (errno));
 		g_free(cur);
@@ -461,7 +463,7 @@ maildir_summary_load (CamelLocalSummary *cls,
 
 	/* Chain up to parent's load() method. */
 	local_summary_class = CAMEL_LOCAL_SUMMARY_CLASS (camel_maildir_summary_parent_class);
-	ret = local_summary_class->load (cls, forceindex, ex);
+	ret = local_summary_class->load (cls, forceindex, error);
 
 	g_hash_table_destroy(mds->priv->load_map);
 	mds->priv->load_map = NULL;
@@ -522,7 +524,7 @@ remove_summary(gchar *key, CamelMessageInfo *info, struct _remove_data *rd)
 }
 
 static gint
-maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, CamelException *ex)
+maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, GError **error)
 {
 	DIR *dir;
 	struct dirent *d;
@@ -550,8 +552,9 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca
 	   no longer exist */
 	dir = opendir(cur);
 	if (dir == NULL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Cannot open maildir directory path: %s: %s"),
 			cls->folder_path, g_strerror (errno));
 		g_free(cur);
@@ -563,7 +566,7 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca
 
 	/* keeps track of all uid's that have not been processed */
 	left = g_hash_table_new(g_str_hash, g_str_equal);
-	camel_folder_summary_prepare_fetch_all (s, ex);
+	camel_folder_summary_prepare_fetch_all (s, error);
 	count = camel_folder_summary_count (s);
 	forceindex = count == 0;
 	for (i=0;i<count;i++) {
@@ -678,7 +681,7 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca
 
 			/* FIXME: This should probably use link/unlink */
 
-			if (rename(src, dest) == 0) {
+			if (g_rename (src, dest) == 0) {
 				camel_maildir_summary_add (cls, destfilename, forceindex);
 				if (changes) {
 					camel_folder_change_info_add_uid(changes, destname);
@@ -712,7 +715,7 @@ static gint
 maildir_summary_sync (CamelLocalSummary *cls,
                       gboolean expunge,
                       CamelFolderChangeInfo *changes,
-                      CamelException *ex)
+                      GError **error)
 {
 	CamelLocalSummaryClass *local_summary_class;
 	gint count, i;
@@ -723,12 +726,12 @@ maildir_summary_sync (CamelLocalSummary *cls,
 
 	d(printf("summary_sync(expunge=%s)\n", expunge?"true":"false"));
 
-	if (camel_local_summary_check(cls, changes, ex) == -1)
+	if (camel_local_summary_check(cls, changes, error) == -1)
 		return -1;
 
 	camel_operation_start(NULL, _("Storing folder"));
 
-	camel_folder_summary_prepare_fetch_all ((CamelFolderSummary *)cls, ex);
+	camel_folder_summary_prepare_fetch_all ((CamelFolderSummary *)cls, error);
 	count = camel_folder_summary_count((CamelFolderSummary *)cls);
 	for (i=count-1;i>=0;i--) {
 		camel_operation_progress(NULL, (count-i)*100/count);
@@ -759,8 +762,8 @@ maildir_summary_sync (CamelLocalSummary *cls,
 			if (strcmp(newname, camel_maildir_info_filename(mdi))) {
 				name = g_strdup_printf("%s/cur/%s", cls->folder_path, camel_maildir_info_filename(mdi));
 				dest = g_strdup_printf("%s/cur/%s", cls->folder_path, newname);
-				rename(name, dest);
-				if (stat(dest, &st) == -1) {
+				g_rename (name, dest);
+				if (g_stat(dest, &st) == -1) {
 					/* we'll assume it didn't work, but dont change anything else */
 					g_free(newname);
 				} else {
@@ -786,6 +789,6 @@ maildir_summary_sync (CamelLocalSummary *cls,
 
 	/* Chain up to parent's sync() method. */
 	local_summary_class = CAMEL_LOCAL_SUMMARY_CLASS (camel_maildir_summary_parent_class);
-	return local_summary_class->sync (cls, expunge, changes, ex);
+	return local_summary_class->sync (cls, expunge, changes, error);
 }
 
diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c
index 640262e..dbe2e0b 100644
--- a/camel/providers/local/camel-mbox-folder.c
+++ b/camel/providers/local/camel-mbox-folder.c
@@ -46,13 +46,13 @@
 
 #define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
 
-static gint mbox_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex);
+static gint mbox_lock(CamelLocalFolder *lf, CamelLockType type, GError **error);
 static void mbox_unlock(CamelLocalFolder *lf);
 
-static gboolean mbox_append_message(CamelFolder *folder, CamelMimeMessage * message, const CamelMessageInfo * info,	gchar **appended_uid, CamelException *ex);
-static CamelMimeMessage *mbox_get_message(CamelFolder *folder, const gchar * uid, CamelException *ex);
+static gboolean mbox_append_message(CamelFolder *folder, CamelMimeMessage * message, const CamelMessageInfo * info,	gchar **appended_uid, GError **error);
+static CamelMimeMessage *mbox_get_message(CamelFolder *folder, const gchar * uid, GError **error);
 static CamelLocalSummary *mbox_create_summary(CamelLocalFolder *lf, const gchar *path, const gchar *folder, CamelIndex *index);
-static gchar * mbox_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex);
+static gchar * mbox_get_filename (CamelFolder *folder, const gchar *uid, GError **error);
 static gint mbox_cmp_uids (CamelFolder *folder, const gchar *uid1, const gchar *uid2);
 static void mbox_sort_uids (CamelFolder *folder, GPtrArray *uids);
 
@@ -84,7 +84,7 @@ camel_mbox_folder_init (CamelMboxFolder *mbox_folder)
 }
 
 CamelFolder *
-camel_mbox_folder_new(CamelStore *parent_store, const gchar *full_name, guint32 flags, CamelException *ex)
+camel_mbox_folder_new(CamelStore *parent_store, const gchar *full_name, guint32 flags, GError **error)
 {
 	CamelFolder *folder;
 	gchar *basename;
@@ -96,7 +96,7 @@ camel_mbox_folder_new(CamelStore *parent_store, const gchar *full_name, guint32
 		"name", basename, "full-name", full_name,
 		"parent-store", parent_store, NULL);
 	folder = (CamelFolder *)camel_local_folder_construct (
-		(CamelLocalFolder *)folder, flags, ex);
+		(CamelLocalFolder *)folder, flags, error);
 
 	g_free (basename);
 
@@ -108,7 +108,7 @@ static CamelLocalSummary *mbox_create_summary(CamelLocalFolder *lf, const gchar
 	return (CamelLocalSummary *)camel_mbox_summary_new((CamelFolder *)lf, path, folder, index);
 }
 
-static gint mbox_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex)
+static gint mbox_lock(CamelLocalFolder *lf, CamelLockType type, GError **error)
 {
 #ifndef G_OS_WIN32
 	CamelMboxFolder *mf = (CamelMboxFolder *)lf;
@@ -118,14 +118,15 @@ static gint mbox_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *
 
 	mf->lockfd = open(lf->folder_path, O_RDWR|O_LARGEFILE, 0);
 	if (mf->lockfd == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Cannot create folder lock on %s: %s"),
 			lf->folder_path, g_strerror (errno));
 		return -1;
 	}
 
-	if (camel_lock_folder(lf->folder_path, mf->lockfd, type, ex) == -1) {
+	if (camel_lock_folder(lf->folder_path, mf->lockfd, type, error) == -1) {
 		close(mf->lockfd);
 		mf->lockfd = -1;
 		return -1;
@@ -151,7 +152,7 @@ mbox_append_message (CamelFolder *folder,
                      CamelMimeMessage *message,
                      const CamelMessageInfo *info,
                      gchar **appended_uid,
-                     CamelException *ex)
+                     GError **error)
 {
 	CamelLocalFolder *lf = (CamelLocalFolder *)folder;
 	CamelStream *output_stream = NULL, *filter_stream = NULL;
@@ -165,18 +166,18 @@ mbox_append_message (CamelFolder *folder,
 	gchar *xev;
 #endif
 	/* If we can't lock, dont do anything */
-	if (camel_local_folder_lock(lf, CAMEL_LOCK_WRITE, ex) == -1)
+	if (camel_local_folder_lock(lf, CAMEL_LOCK_WRITE, error) == -1)
 		return FALSE;
 
 	d(printf("Appending message\n"));
 
 	/* first, check the summary is correct (updates folder_size too) */
-	retval = camel_local_summary_check ((CamelLocalSummary *)folder->summary, lf->changes, ex);
+	retval = camel_local_summary_check ((CamelLocalSummary *)folder->summary, lf->changes, error);
 	if (retval == -1)
 		goto fail;
 
 	/* add it to the summary/assign the uid, etc */
-	mi = camel_local_summary_add((CamelLocalSummary *)folder->summary, message, info, lf->changes, ex);
+	mi = camel_local_summary_add((CamelLocalSummary *)folder->summary, message, info, lf->changes, error);
 	if (mi == NULL)
 		goto fail;
 
@@ -187,12 +188,11 @@ mbox_append_message (CamelFolder *folder,
 
 	output_stream = camel_stream_fs_new_with_name (
 		lf->folder_path, O_WRONLY | O_APPEND |
-		O_LARGEFILE, 0666);
+		O_LARGEFILE, 0666, error);
 	if (output_stream == NULL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Cannot open mailbox: %s: %s\n"),
-			lf->folder_path, g_strerror (errno));
+		g_prefix_error (
+			error, _("Cannot open mailbox: %s: "),
+			lf->folder_path);
 		goto fail;
 	}
 
@@ -210,7 +210,7 @@ mbox_append_message (CamelFolder *folder,
 
 	/* we must write this to the non-filtered stream ... */
 	fromline = camel_mime_message_build_mbox_from(message);
-	if (camel_stream_write(output_stream, fromline, strlen(fromline)) == -1)
+	if (camel_stream_write(output_stream, fromline, strlen(fromline), error) == -1)
 		goto fail_write;
 
 	/* and write the content to the filtering stream, that translates '\nFrom' into '\n>From' */
@@ -219,9 +219,10 @@ mbox_append_message (CamelFolder *folder,
 	camel_stream_filter_add((CamelStreamFilter *) filter_stream, filter_from);
 	g_object_unref (filter_from);
 
-	if (camel_data_wrapper_write_to_stream ((CamelDataWrapper *) message, filter_stream) == -1 ||
-	    camel_stream_write (filter_stream, "\n", 1) == -1 ||
-	    camel_stream_flush (filter_stream) == -1)
+	if (camel_data_wrapper_write_to_stream (
+		(CamelDataWrapper *) message, filter_stream, error) == -1 ||
+	    camel_stream_write (filter_stream, "\n", 1, error) == -1 ||
+	    camel_stream_flush (filter_stream, error) == -1)
 		goto fail_write;
 
 	/* filter stream ref's the output stream itself, so we need to unref it too */
@@ -255,15 +256,9 @@ mbox_append_message (CamelFolder *folder,
 	return TRUE;
 
 fail_write:
-	if (errno == EINTR)
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_USER_CANCEL,
-			_("Mail append canceled"));
-	else
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Cannot append message to mbox file: %s: %s"),
-			lf->folder_path, g_strerror (errno));
+	g_prefix_error (
+		error, _("Cannot append message to mbox file: %s: "),
+		lf->folder_path);
 
 	if (output_stream) {
 		gint fd;
@@ -306,7 +301,7 @@ fail:
 }
 
 static gchar *
-mbox_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex)
+mbox_get_filename (CamelFolder *folder, const gchar *uid, GError **error)
 {
 	CamelLocalFolder *lf = (CamelLocalFolder *)folder;
 	CamelMboxMessageInfo *info;
@@ -316,11 +311,11 @@ mbox_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex)
 	d(printf("Getting message %s\n", uid));
 
 	/* lock the folder first, burn if we can't, need write lock for summary check */
-	if (camel_local_folder_lock(lf, CAMEL_LOCK_WRITE, ex) == -1)
+	if (camel_local_folder_lock(lf, CAMEL_LOCK_WRITE, error) == -1)
 		return NULL;
 
 	/* check for new messages always */
-	if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, ex) == -1) {
+	if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, error) == -1) {
 		camel_local_folder_unlock(lf);
 		return NULL;
 	}
@@ -330,7 +325,7 @@ mbox_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex)
 
 	if (info == NULL) {
 		set_cannot_get_message_ex (
-			ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+			error, CAMEL_FOLDER_ERROR_INVALID_UID,
 			uid, lf->folder_path, _("No such message"));
 		goto fail;
 	}
@@ -353,7 +348,7 @@ fail:
 }
 
 static CamelMimeMessage *
-mbox_get_message(CamelFolder *folder, const gchar * uid, CamelException *ex)
+mbox_get_message(CamelFolder *folder, const gchar * uid, GError **error)
 {
 	CamelLocalFolder *lf = (CamelLocalFolder *)folder;
 	CamelMimeMessage *message = NULL;
@@ -366,11 +361,11 @@ mbox_get_message(CamelFolder *folder, const gchar * uid, CamelException *ex)
 	d(printf("Getting message %s\n", uid));
 
 	/* lock the folder first, burn if we can't, need write lock for summary check */
-	if (camel_local_folder_lock(lf, CAMEL_LOCK_WRITE, ex) == -1)
+	if (camel_local_folder_lock(lf, CAMEL_LOCK_WRITE, error) == -1)
 		return NULL;
 
 	/* check for new messages always */
-	if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, ex) == -1) {
+	if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, error) == -1) {
 		camel_local_folder_unlock(lf);
 		return NULL;
 	}
@@ -381,7 +376,7 @@ retry:
 
 	if (info == NULL) {
 		set_cannot_get_message_ex (
-			ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+			error, CAMEL_FOLDER_ERROR_INVALID_UID,
 			uid, lf->folder_path, _("No such message"));
 		goto fail;
 	}
@@ -402,7 +397,7 @@ retry:
 	fd = g_open(lf->folder_path, O_LARGEFILE | O_RDONLY | O_BINARY, 0);
 	if (fd == -1) {
 		set_cannot_get_message_ex (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+			error, CAMEL_ERROR_GENERIC,
 			uid, lf->folder_path, g_strerror (errno));
 		goto fail;
 	}
@@ -427,25 +422,23 @@ retry:
 		if (!retried) {
 			retried = TRUE;
 			camel_local_summary_check_force((CamelLocalSummary *)folder->summary);
-			retval = camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, ex);
+			retval = camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, error);
 			if (retval != -1)
 				goto retry;
 		}
 
 		set_cannot_get_message_ex (
-			ex, CAMEL_EXCEPTION_FOLDER_INVALID,
+			error, CAMEL_FOLDER_ERROR_INVALID,
 			uid, lf->folder_path,
 			_("The folder appears to be irrecoverably corrupted."));
 		goto fail;
 	}
 
 	message = camel_mime_message_new();
-	if (camel_mime_part_construct_from_parser((CamelMimePart *)message, parser) == -1) {
-		set_cannot_get_message_ex (
-			ex, errno == EINTR ?
-			CAMEL_EXCEPTION_USER_CANCEL : CAMEL_EXCEPTION_SYSTEM,
-			uid, lf->folder_path,
-			_("Message construction failed."));
+	if (camel_mime_part_construct_from_parser((CamelMimePart *)message, parser, error) == -1) {
+		g_prefix_error (
+			error, _("Cannot get message %s from folder %s: "),
+			uid, lf->folder_path);
 		g_object_unref (message);
 		message = NULL;
 		goto fail;
@@ -498,18 +491,8 @@ mbox_sort_uids (CamelFolder *folder, GPtrArray *uids)
 	g_return_if_fail (camel_mbox_folder_parent_class != NULL);
 	g_return_if_fail (folder != NULL);
 
-	if (uids && uids->len > 1) {
-		CamelException ex;
-
-		camel_exception_init (&ex);
-
-		camel_folder_summary_prepare_fetch_all (folder->summary, &ex);
-
-		if (camel_exception_is_set (&ex))
-			g_warning ("%s: %s", G_STRFUNC, camel_exception_get_description (&ex));
-
-		camel_exception_clear (&ex);
-	}
+	if (uids && uids->len > 1)
+		camel_folder_summary_prepare_fetch_all (folder->summary, NULL);
 
 	CAMEL_FOLDER_CLASS (camel_mbox_folder_parent_class)->sort_uids (folder, uids);
 }
diff --git a/camel/providers/local/camel-mbox-folder.h b/camel/providers/local/camel-mbox-folder.h
index 89b03b7..02d3cf8 100644
--- a/camel/providers/local/camel-mbox-folder.h
+++ b/camel/providers/local/camel-mbox-folder.h
@@ -61,7 +61,7 @@ struct _CamelMboxFolderClass {
 
 /* public methods */
 /* flags are taken from CAMEL_STORE_FOLDER_* flags */
-CamelFolder *camel_mbox_folder_new(CamelStore *parent_store, const gchar *full_name, guint32 flags, CamelException *ex);
+CamelFolder *camel_mbox_folder_new(CamelStore *parent_store, const gchar *full_name, guint32 flags, GError **error);
 
 GType camel_mbox_folder_get_type(void);
 
diff --git a/camel/providers/local/camel-mbox-store.c b/camel/providers/local/camel-mbox-store.c
index dc22492..c6d9a55 100644
--- a/camel/providers/local/camel-mbox-store.c
+++ b/camel/providers/local/camel-mbox-store.c
@@ -38,11 +38,11 @@
 
 #define d(x)
 
-static CamelFolder *get_folder(CamelStore *store, const gchar *folder_name, guint32 flags, CamelException *ex);
-static gboolean delete_folder(CamelStore *store, const gchar *folder_name, CamelException *ex);
-static gboolean rename_folder(CamelStore *store, const gchar *old, const gchar *new, CamelException *ex);
-static CamelFolderInfo *create_folder(CamelStore *store, const gchar *parent_name, const gchar *folder_name, CamelException *ex);
-static CamelFolderInfo *get_folder_info(CamelStore *store, const gchar *top, guint32 flags, CamelException *ex);
+static CamelFolder *get_folder(CamelStore *store, const gchar *folder_name, guint32 flags, GError **error);
+static gboolean delete_folder(CamelStore *store, const gchar *folder_name, GError **error);
+static gboolean rename_folder(CamelStore *store, const gchar *old, const gchar *new, GError **error);
+static CamelFolderInfo *create_folder(CamelStore *store, const gchar *parent_name, const gchar *folder_name, GError **error);
+static CamelFolderInfo *get_folder_info(CamelStore *store, const gchar *top, guint32 flags, GError **error);
 static gchar *mbox_get_meta_path(CamelLocalStore *ls, const gchar *full_name, const gchar *ext);
 static gchar *mbox_get_full_path(CamelLocalStore *ls, const gchar *full_name);
 
@@ -102,7 +102,7 @@ static CamelFolder *
 get_folder (CamelStore *store,
             const gchar *folder_name,
             guint32 flags,
-            CamelException *ex)
+            GError **error)
 {
 	CamelStoreClass *store_class;
 	struct stat st;
@@ -110,7 +110,7 @@ get_folder (CamelStore *store,
 
 	/* Chain up to parent's get_folder() method. */
 	store_class = CAMEL_STORE_CLASS (camel_mbox_store_parent_class);
-	if (!store_class->get_folder (store, folder_name, flags, ex))
+	if (!store_class->get_folder (store, folder_name, flags, error))
 		return NULL;
 
 	name = camel_local_store_get_full_path(store, folder_name);
@@ -121,8 +121,9 @@ get_folder (CamelStore *store,
 		gint fd;
 
 		if (errno != ENOENT) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Cannot get folder '%s': %s"),
 				folder_name, g_strerror (errno));
 			g_free(name);
@@ -130,8 +131,9 @@ get_folder (CamelStore *store,
 		}
 
 		if ((flags & CAMEL_STORE_FOLDER_CREATE) == 0) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+			g_set_error (
+				error, CAMEL_STORE_ERROR,
+				CAMEL_STORE_ERROR_NO_FOLDER,
 				_("Cannot get folder '%s': folder does not exist."),
 				folder_name);
 			g_free(name);
@@ -142,8 +144,8 @@ get_folder (CamelStore *store,
 		basename = g_path_get_basename (folder_name);
 
 		if (basename[0] == '.' || ignore_file (basename, TRUE)) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Cannot create a folder by this name."));
 			g_free (name);
 			g_free (basename);
@@ -153,8 +155,9 @@ get_folder (CamelStore *store,
 
 		dirname = g_path_get_dirname(name);
 		if (g_mkdir_with_parents(dirname, 0700) == -1 && errno != EEXIST) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Cannot create folder '%s': %s"),
 				folder_name, g_strerror (errno));
 			g_free(dirname);
@@ -166,8 +169,9 @@ get_folder (CamelStore *store,
 
 		fd = g_open(name, O_LARGEFILE | O_WRONLY | O_CREAT | O_APPEND | O_BINARY, 0666);
 		if (fd == -1) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Cannot create folder '%s': %s"),
 				folder_name, g_strerror (errno));
 			g_free(name);
@@ -177,15 +181,15 @@ get_folder (CamelStore *store,
 		g_free(name);
 		close(fd);
 	} else if (!S_ISREG(st.st_mode)) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot get folder '%s': not a regular file."),
 			folder_name);
 		g_free(name);
 		return NULL;
 	} else if (flags & CAMEL_STORE_FOLDER_EXCL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot create folder '%s': folder exists."),
 			folder_name);
 		g_free (name);
@@ -193,14 +197,13 @@ get_folder (CamelStore *store,
 	} else
 		g_free(name);
 
-	return camel_mbox_folder_new(store, folder_name, flags, ex);
+	return camel_mbox_folder_new(store, folder_name, flags, error);
 }
 
 static gboolean
-delete_folder(CamelStore *store, const gchar *folder_name, CamelException *ex)
+delete_folder(CamelStore *store, const gchar *folder_name, GError **error)
 {
 	CamelFolderInfo *fi;
-	CamelException lex;
 	CamelFolder *lf;
 	gchar *name, *path;
 	struct stat st;
@@ -209,8 +212,9 @@ delete_folder(CamelStore *store, const gchar *folder_name, CamelException *ex)
 	path = g_strdup_printf("%s.sbd", name);
 
 	if (g_rmdir(path) == -1 && errno != ENOENT) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not delete folder '%s':\n%s"),
 			folder_name, g_strerror (errno));
 		g_free(path);
@@ -221,8 +225,9 @@ delete_folder(CamelStore *store, const gchar *folder_name, CamelException *ex)
 	g_free(path);
 
 	if (g_stat(name, &st) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not delete folder '%s':\n%s"),
 			folder_name, g_strerror (errno));
 		g_free(name);
@@ -230,16 +235,18 @@ delete_folder(CamelStore *store, const gchar *folder_name, CamelException *ex)
 	}
 
 	if (!S_ISREG(st.st_mode)) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("'%s' is not a regular file."), name);
 		g_free(name);
 		return FALSE;
 	}
 
 	if (st.st_size != 0) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_FOLDER_NON_EMPTY,
+		g_set_error (
+			error, CAMEL_FOLDER_ERROR,
+			CAMEL_FOLDER_ERROR_NON_EMPTY,
 			_("Folder '%s' is not empty. Not deleted."),
 			folder_name);
 		g_free(name);
@@ -247,8 +254,9 @@ delete_folder(CamelStore *store, const gchar *folder_name, CamelException *ex)
 	}
 
 	if (g_unlink(name) == -1 && errno != ENOENT) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not delete folder '%s':\n%s"),
 			name, g_strerror(errno));
 		g_free(name);
@@ -262,8 +270,9 @@ delete_folder(CamelStore *store, const gchar *folder_name, CamelException *ex)
 	 * paths itself */
 	path = camel_local_store_get_meta_path(store, folder_name, ".ev-summary");
 	if (g_unlink(path) == -1 && errno != ENOENT) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not delete folder summary file '%s': %s"),
 			path, g_strerror(errno));
 		g_free(path);
@@ -275,8 +284,9 @@ delete_folder(CamelStore *store, const gchar *folder_name, CamelException *ex)
 
 	path = camel_local_store_get_meta_path(store, folder_name, ".ev-summary-meta");
 	if (g_unlink(path) == -1 && errno != ENOENT) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not delete folder summary file '%s': %s"),
 			path, g_strerror(errno));
 		g_free(path);
@@ -288,8 +298,9 @@ delete_folder(CamelStore *store, const gchar *folder_name, CamelException *ex)
 
 	path = camel_local_store_get_meta_path(store, folder_name, ".ibex");
 	if (camel_text_index_remove(path) == -1 && errno != ENOENT) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not delete folder index file '%s': %s"),
 			path, g_strerror(errno));
 		g_free(path);
@@ -300,8 +311,7 @@ delete_folder(CamelStore *store, const gchar *folder_name, CamelException *ex)
 	g_free(path);
 
 	path = NULL;
-	camel_exception_init(&lex);
-	if ((lf = camel_store_get_folder(store, folder_name, 0, &lex))) {
+	if ((lf = camel_store_get_folder(store, folder_name, 0, NULL))) {
 		CamelObject *object = CAMEL_OBJECT (lf);
 		const gchar *state_filename;
 
@@ -311,16 +321,15 @@ delete_folder(CamelStore *store, const gchar *folder_name, CamelException *ex)
 		camel_object_set_state_filename (object, NULL);
 
 		g_object_unref (lf);
-	} else {
-		camel_exception_clear(&lex);
 	}
 
 	if (path == NULL)
 		path = camel_local_store_get_meta_path(store, folder_name, ".cmeta");
 
 	if (g_unlink(path) == -1 && errno != ENOENT) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not delete folder meta file '%s': %s"),
 			path, g_strerror (errno));
 
@@ -345,7 +354,7 @@ delete_folder(CamelStore *store, const gchar *folder_name, CamelException *ex)
 }
 
 static CamelFolderInfo *
-create_folder(CamelStore *store, const gchar *parent_name, const gchar *folder_name, CamelException *ex)
+create_folder(CamelStore *store, const gchar *parent_name, const gchar *folder_name, GError **error)
 {
 	/* FIXME: this is almost an exact copy of CamelLocalStore::create_folder() except that we use
 	 * different path schemes... need to find a way to share parent's code? */
@@ -356,16 +365,17 @@ create_folder(CamelStore *store, const gchar *parent_name, const gchar *folder_n
 	struct stat st;
 
 	if (!g_path_is_absolute(toplevel_dir)) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("Store root %s is not an absolute path"),
 			toplevel_dir);
 		return NULL;
 	}
 
 	if (folder_name[0] == '.' || ignore_file(folder_name, TRUE)) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot create a folder by this name."));
 		return NULL;
 	}
@@ -379,8 +389,9 @@ create_folder(CamelStore *store, const gchar *parent_name, const gchar *folder_n
 
 	dir = g_path_get_dirname(path);
 	if (g_mkdir_with_parents(dir, 0777) == -1 && errno != EEXIST) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Cannot create directory '%s': %s."),
 			dir, g_strerror (errno));
 
@@ -394,8 +405,9 @@ create_folder(CamelStore *store, const gchar *parent_name, const gchar *folder_n
 	g_free(dir);
 
 	if (g_stat(path, &st) == 0 || errno != ENOENT) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Cannot create folder: %s: %s"),
 			path, errno ? g_strerror (errno) :
 			_("Folder already exists"));
@@ -409,11 +421,11 @@ create_folder(CamelStore *store, const gchar *parent_name, const gchar *folder_n
 	g_free(path);
 
 	folder = CAMEL_STORE_GET_CLASS (store)->get_folder (
-		store, name, CAMEL_STORE_FOLDER_CREATE, ex);
+		store, name, CAMEL_STORE_FOLDER_CREATE, error);
 	if (folder) {
 		g_object_unref (folder);
 		info = CAMEL_STORE_GET_CLASS (store)->get_folder_info (
-			store, name, 0, ex);
+			store, name, 0, error);
 	}
 
 	g_free(name);
@@ -448,14 +460,14 @@ xrename(CamelStore *store, const gchar *old_name, const gchar *new_name, const g
 #ifndef G_OS_WIN32
 	} else if (S_ISDIR(st.st_mode)) {
 		/* use rename for dirs */
-		if (rename(oldpath, newpath) == 0 || stat(newpath, &st) == 0) {
+		if (g_rename (oldpath, newpath) == 0 || g_stat(newpath, &st) == 0) {
 			ret = 0;
 		} else {
 			err = errno;
 			ret = -1;
 		}
 	} else if (link(oldpath, newpath) == 0 /* and link for files */
-		   ||(stat(newpath, &st) == 0 && st.st_nlink == 2)) {
+		   ||(g_stat(newpath, &st) == 0 && st.st_nlink == 2)) {
 		if (unlink(oldpath) == 0) {
 			ret = 0;
 		} else {
@@ -483,15 +495,15 @@ xrename(CamelStore *store, const gchar *old_name, const gchar *new_name, const g
 }
 
 static gboolean
-rename_folder(CamelStore *store, const gchar *old, const gchar *new, CamelException *ex)
+rename_folder(CamelStore *store, const gchar *old, const gchar *new, GError **error)
 {
 	CamelLocalFolder *folder = NULL;
 	gchar *oldibex, *newibex, *newdir;
 	gint errnosav;
 
 	if (new[0] == '.' || ignore_file(new, TRUE)) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("The new folder name is illegal."));
 		return FALSE;
 	}
@@ -504,8 +516,9 @@ rename_folder(CamelStore *store, const gchar *old, const gchar *new, CamelExcept
 	newdir = g_path_get_dirname(newibex);
 	if (g_mkdir_with_parents(newdir, 0700) == -1) {
 		if (errno != EEXIST) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Could not rename '%s': '%s': %s"),
 				old, new, g_strerror(errno));
 			g_free(oldibex);
@@ -586,8 +599,9 @@ ibex_failed:
 		g_free(newdir);
 	}
 
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, G_IO_ERROR,
+		g_io_error_from_errno (errnosav),
 		_("Could not rename '%s' to %s: %s"),
 		old, new, g_strerror(errnosav));
 
@@ -666,7 +680,7 @@ fill_fi(CamelStore *store, CamelFolderInfo *fi, guint32 flags)
 
 static CamelFolderInfo *
 scan_dir(CamelStore *store, CamelURL *url, GHashTable *visited, CamelFolderInfo *parent, const gchar *root,
-	 const gchar *name, guint32 flags, CamelException *ex)
+	 const gchar *name, guint32 flags, GError **error)
 {
 	CamelFolderInfo *folders, *tail, *fi;
 	GHashTable *folder_hash;
@@ -766,7 +780,7 @@ scan_dir(CamelStore *store, CamelURL *url, GHashTable *visited, CamelFolderInfo
 				*inew = in;
 				g_hash_table_insert(visited, inew, inew);
 #endif
-				if ((fi->child = scan_dir (store, url, visited, fi, path, fi->full_name, flags, ex)))
+				if ((fi->child = scan_dir (store, url, visited, fi, path, fi->full_name, flags, error)))
 					fi->flags |= CAMEL_FOLDER_CHILDREN;
 				else
 					fi->flags =(fi->flags & ~CAMEL_FOLDER_CHILDREN) | CAMEL_FOLDER_NOCHILDREN;
@@ -784,7 +798,7 @@ scan_dir(CamelStore *store, CamelURL *url, GHashTable *visited, CamelFolderInfo
 }
 
 static CamelFolderInfo *
-get_folder_info(CamelStore *store, const gchar *top, guint32 flags, CamelException *ex)
+get_folder_info(CamelStore *store, const gchar *top, guint32 flags, GError **error)
 {
 	GHashTable *visited;
 #ifndef G_OS_WIN32
@@ -815,7 +829,7 @@ get_folder_info(CamelStore *store, const gchar *top, guint32 flags, CamelExcepti
 		g_hash_table_insert(visited, inode, inode);
 #endif
 		url = camel_url_copy (((CamelService *) store)->url);
-		fi = scan_dir (store, url, visited, NULL, path, NULL, flags, ex);
+		fi = scan_dir (store, url, visited, NULL, path, NULL, flags, error);
 		g_hash_table_foreach(visited, inode_free, NULL);
 		g_hash_table_destroy(visited);
 		camel_url_free (url);
@@ -848,7 +862,7 @@ get_folder_info(CamelStore *store, const gchar *top, guint32 flags, CamelExcepti
 	subdir = g_strdup_printf("%s.sbd", path);
 	if (g_stat(subdir, &st) == 0) {
 		if  (S_ISDIR(st.st_mode))
-			fi->child = scan_dir (store, url, visited, fi, subdir, top, flags, ex);
+			fi->child = scan_dir (store, url, visited, fi, subdir, top, flags, error);
 		else
 			fill_fi(store, fi, flags);
 	} else
diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c
index 36f5ad4..14856b0 100644
--- a/camel/providers/local/camel-mbox-summary.c
+++ b/camel/providers/local/camel-mbox-summary.c
@@ -46,7 +46,7 @@
 #define EXTRACT_DIGIT(val) part++; val=strtoul (part, &part, 10);
 #define EXTRACT_FIRST_DIGIT(val) val=strtoul (part, &part, 10);
 
-static CamelFIRecord * summary_header_to_db (CamelFolderSummary *, CamelException *ex);
+static CamelFIRecord * summary_header_to_db (CamelFolderSummary *, GError **error);
 static gint summary_header_from_db (CamelFolderSummary *, CamelFIRecord *);
 static CamelMessageInfo * message_info_from_db(CamelFolderSummary *s, CamelMIRecord *record);
 static CamelMIRecord * message_info_to_db(CamelFolderSummary *s, CamelMessageInfo *info);
@@ -61,14 +61,14 @@ static CamelMessageInfo * message_info_migrate (CamelFolderSummary *, FILE *);
 
 static gchar *mbox_summary_encode_x_evolution (CamelLocalSummary *cls, const CamelLocalMessageInfo *mi);
 
-static gint mbox_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-static gint mbox_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
+static gint mbox_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, GError **error);
+static gint mbox_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, GError **error);
 #ifdef STATUS_PINE
-static CamelMessageInfo *mbox_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *ci, CamelException *ex);
+static CamelMessageInfo *mbox_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *ci, GError **error);
 #endif
 
-static gint mbox_summary_sync_quick(CamelMboxSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-static gint mbox_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
+static gint mbox_summary_sync_quick(CamelMboxSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, GError **error);
+static gint mbox_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, GError **error);
 
 #ifdef STATUS_PINE
 /* Which status flags are stored in each separate header */
@@ -258,7 +258,7 @@ summary_header_load(CamelFolderSummary *s, FILE *in)
 }
 
 static CamelFIRecord *
-summary_header_to_db (CamelFolderSummary *s, CamelException *ex)
+summary_header_to_db (CamelFolderSummary *s, GError **error)
 {
 	CamelFolderSummaryClass *folder_summary_class;
 	CamelMboxSummary *mbs = CAMEL_MBOX_SUMMARY(s);
@@ -267,7 +267,7 @@ summary_header_to_db (CamelFolderSummary *s, CamelException *ex)
 
 	/* Chain up to parent's summary_header_to_db() method. */
 	folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (camel_mbox_summary_parent_class);
-	fir = folder_summary_class->summary_header_to_db (s, ex);
+	fir = folder_summary_class->summary_header_to_db (s, error);
 	if (fir) {
 		tmp = fir->bdata;
 		fir->bdata = g_strdup_printf ("%s %d %d", tmp ? tmp : "", CAMEL_MBOX_SUMMARY_VERSION, (gint) mbs->folder_size);
@@ -443,7 +443,7 @@ message_info_to_db(CamelFolderSummary *s, CamelMessageInfo *info)
 
 /* like summary_rebuild, but also do changeinfo stuff (if supplied) */
 static gint
-summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *changeinfo, CamelException *ex)
+summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *changeinfo, GError **error)
 {
 	gint i, count;
 	CamelFolderSummary *s = (CamelFolderSummary *)cls;
@@ -467,8 +467,9 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
 	fd = g_open(cls->folder_path, O_LARGEFILE | O_RDONLY | O_BINARY, 0);
 	if (fd == -1) {
 		d(printf("%s failed to open: %s\n", cls->folder_path, g_strerror (errno)));
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not open folder: %s: %s"),
 			cls->folder_path, g_strerror (errno));
 		camel_operation_end(NULL);
@@ -498,7 +499,7 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
 	/* we mark messages as to whether we've seen them or not.
 	   If we're not starting from the start, we must be starting
 	   from the old end, so everything must be treated as new */
-	camel_folder_summary_prepare_fetch_all (s, ex);
+	camel_folder_summary_prepare_fetch_all (s, NULL);
 	count = camel_folder_summary_count(s);
 	for (i=0;i<count;i++) {
 		mi = (CamelMboxMessageInfo *)camel_folder_summary_index(s, i);
@@ -518,10 +519,10 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
 
 		info = camel_folder_summary_add_from_parser(s, mp);
 		if (info == NULL) {
-			camel_exception_setv (
-				ex, 1,
-				_("Fatal mail parser error near position %ld in folder %s"),
-				camel_mime_parser_tell(mp), cls->folder_path);
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+				_("Fatal mail parser error near position %" G_GINT64_FORMAT " in folder %s"),
+				(gint64) camel_mime_parser_tell(mp), cls->folder_path);
 			ok = -1;
 			break;
 		}
@@ -564,7 +565,7 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
 	/* Delete all in one transaction */
 	full_name = camel_folder_get_full_name (s->folder);
 	parent_store = camel_folder_get_parent_store (s->folder);
-	camel_db_delete_uids (parent_store->cdb_w, full_name, del, ex);
+	camel_db_delete_uids (parent_store->cdb_w, full_name, del, NULL);
 	g_slist_foreach (del, (GFunc) camel_pstring_free, NULL);
 	g_slist_free (del);
 
@@ -585,7 +586,7 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
 }
 
 static gint
-mbox_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, CamelException *ex)
+mbox_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, GError **error)
 {
 	CamelMboxSummary *mbs = (CamelMboxSummary *)cls;
 	CamelFolderSummary *s = (CamelFolderSummary *)cls;
@@ -598,8 +599,9 @@ mbox_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Camel
 	/* check if the summary is up-to-date */
 	if (g_stat(cls->folder_path, &st) == -1) {
 		camel_folder_summary_clear(s);
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Cannot check folder: %s: %s"),
 			cls->folder_path, g_strerror (errno));
 		return -1;
@@ -612,7 +614,7 @@ mbox_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Camel
 	if (st.st_size == 0) {
 		/* empty?  No need to scan at all */
 		d(printf("Empty mbox, clearing summary\n"));
-		camel_folder_summary_prepare_fetch_all (s, ex);
+		camel_folder_summary_prepare_fetch_all (s, NULL);
 		count= camel_folder_summary_count(s);
 		for (i=0;i<count;i++) {
 			CamelMessageInfo *info = camel_folder_summary_index(s, i);
@@ -630,10 +632,10 @@ mbox_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Camel
 			if (mbs->folder_size < st.st_size) {
 				/* this will automatically rescan from 0 if there is a problem */
 				d(printf("folder grew, attempting to rebuild from %d\n", mbs->folder_size));
-				ret = summary_update(cls, mbs->folder_size, changes, ex);
+				ret = summary_update(cls, mbs->folder_size, changes, error);
 			} else {
 				d(printf("folder shrank!  rebuilding from start\n"));
-				 ret = summary_update(cls, 0, changes, ex);
+				 ret = summary_update(cls, 0, changes, error);
 			}
 		} else {
 			d(printf("Folder unchanged, do nothing\n"));
@@ -655,7 +657,7 @@ mbox_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Camel
 
 /* perform a full sync */
 static gint
-mbox_summary_sync_full(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex)
+mbox_summary_sync_full(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChangeInfo *changeinfo, GError **error)
 {
 	CamelLocalSummary *cls = (CamelLocalSummary *)mbs;
 	gint fd = -1, fdout = -1;
@@ -668,8 +670,9 @@ mbox_summary_sync_full(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChang
 
 	fd = g_open(cls->folder_path, O_LARGEFILE | O_RDONLY | O_BINARY, 0);
 	if (fd == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not open file: %s: %s"),
 			cls->folder_path, g_strerror (errno));
 		camel_operation_end(NULL);
@@ -681,22 +684,24 @@ mbox_summary_sync_full(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChang
 	d(printf("Writing temporary file to %s\n", tmpname));
 	fdout = g_open(tmpname, O_LARGEFILE|O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0600);
 	if (fdout == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Cannot open temporary mailbox: %s"),
 			g_strerror (errno));
 		goto error;
 	}
 
-	if (camel_mbox_summary_sync_mbox((CamelMboxSummary *)cls, flags, changeinfo, fd, fdout, ex) == -1)
+	if (camel_mbox_summary_sync_mbox((CamelMboxSummary *)cls, flags, changeinfo, fd, fdout, error) == -1)
 		goto error;
 
 	d(printf("Closing folders\n"));
 
 	if (close(fd) == -1) {
 		g_warning("Cannot close source folder: %s", g_strerror (errno));
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not close source folder %s: %s"),
 			cls->folder_path, g_strerror (errno));
 		fd = -1;
@@ -705,8 +710,9 @@ mbox_summary_sync_full(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChang
 
 	if (close(fdout) == -1) {
 		g_warning("Cannot close temporary folder: %s", g_strerror (errno));
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not close temporary folder: %s"),
 			g_strerror (errno));
 		fdout = -1;
@@ -721,8 +727,9 @@ mbox_summary_sync_full(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChang
 #endif
 	if (g_rename(tmpname, cls->folder_path) == -1) {
 		g_warning("Cannot rename folder: %s", g_strerror (errno));
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not rename folder: %s"),
 			g_strerror (errno));
 		goto error;
@@ -773,7 +780,7 @@ cms_sort_frompos (gpointer a, gpointer b, gpointer data)
 
 /* perform a quick sync - only system flags have changed */
 static gint
-mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex)
+mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChangeInfo *changeinfo, GError **error)
 {
 	CamelLocalSummary *cls = (CamelLocalSummary *)mbs;
 	CamelFolderSummary *s = (CamelFolderSummary *)mbs;
@@ -793,8 +800,9 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
 
 	fd = g_open(cls->folder_path, O_LARGEFILE|O_RDWR|O_BINARY, 0);
 	if (fd == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not open file: %s: %s"),
 			cls->folder_path, g_strerror (errno));
 
@@ -805,8 +813,9 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
 	/* need to dup since mime parser closes its fd once it is finalized */
 	pfd = dup(fd);
 	if (pfd == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not store folder: %s"),
 			g_strerror(errno));
 		close(fd);
@@ -846,8 +855,8 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
 
 		if (camel_mime_parser_step(mp, NULL, NULL) != CAMEL_MIME_PARSER_STATE_FROM) {
 			g_warning("Expected a From line here, didn't get it");
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Summary and folder mismatch, even after a sync"));
 			goto error;
 		}
@@ -855,8 +864,8 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
 		if (camel_mime_parser_tell_start_from(mp) != info->frompos) {
 			g_warning("Didn't get the next message where I expected (%d) got %d instead",
 				  (gint)info->frompos, (gint)camel_mime_parser_tell_start_from(mp));
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Summary and folder mismatch, even after a sync"));
 			goto error;
 		}
@@ -908,8 +917,9 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
 
 	if (close(fd) == -1) {
 		g_warning ("Cannot close source folder: %s", g_strerror (errno));
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not close source folder %s: %s"),
 			cls->folder_path, g_strerror (errno));
 		fd = -1;
@@ -941,7 +951,7 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
 }
 
 static gint
-mbox_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex)
+mbox_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, GError **error)
 {
 	struct stat st;
 	CamelMboxSummary *mbs = (CamelMboxSummary *)cls;
@@ -954,7 +964,7 @@ mbox_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInf
 	GPtrArray *summary = NULL;
 
 	/* first, sync ourselves up, just to make sure */
-	if (camel_local_summary_check(cls, changeinfo, ex) == -1)
+	if (camel_local_summary_check(cls, changeinfo, error) == -1)
 		return -1;
 
 	full_name = camel_folder_get_full_name (s->folder);
@@ -980,7 +990,7 @@ mbox_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInf
 	if (quick && expunge) {
 		guint32 dcount =0;
 
-		if (camel_db_count_deleted_message_info (parent_store->cdb_w, full_name, &dcount, ex) == -1)
+		if (camel_db_count_deleted_message_info (parent_store->cdb_w, full_name, &dcount, error) == -1)
 			return -1;
 		if (dcount)
 			quick = FALSE;
@@ -990,24 +1000,23 @@ mbox_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInf
 	ret = -1;
 	if (quick) {
 		if (work) {
-			ret = CAMEL_MBOX_SUMMARY_GET_CLASS (cls)->sync_quick (mbs, expunge, changeinfo, ex);
-			if (ret == -1) {
+			ret = CAMEL_MBOX_SUMMARY_GET_CLASS (cls)->sync_quick (mbs, expunge, changeinfo, NULL);
+			if (ret == -1)
 				g_warning("failed a quick-sync, trying a full sync");
-				camel_exception_clear (ex);
-			}
 		} else {
 			ret = 0;
 		}
 	}
 
 	if (ret == -1)
-		ret = CAMEL_MBOX_SUMMARY_GET_CLASS (cls)->sync_full (mbs, expunge, changeinfo, ex);
+		ret = CAMEL_MBOX_SUMMARY_GET_CLASS (cls)->sync_full (mbs, expunge, changeinfo, error);
 	if (ret == -1)
 		return -1;
 
 	if (g_stat(cls->folder_path, &st) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Unknown error: %s"), g_strerror (errno));
 		return -1;
 	}
@@ -1018,11 +1027,11 @@ mbox_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInf
 		camel_folder_summary_touch(s);
 	}
 
-	return CAMEL_LOCAL_SUMMARY_CLASS (camel_mbox_summary_parent_class)->sync(cls, expunge, changeinfo, ex);
+	return CAMEL_LOCAL_SUMMARY_CLASS (camel_mbox_summary_parent_class)->sync(cls, expunge, changeinfo, error);
 }
 
 gint
-camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderChangeInfo *changeinfo, gint fd, gint fdout, CamelException *ex)
+camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderChangeInfo *changeinfo, gint fd, gint fdout, GError **error)
 {
 	CamelMboxSummary *mbs = (CamelMboxSummary *)cls;
 	CamelFolderSummary *s = (CamelFolderSummary *)mbs;
@@ -1046,8 +1055,9 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 	/* need to dup this because the mime-parser owns the fd after we give it to it */
 	fd = dup(fd);
 	if (fd == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not store folder: %s"),
 			g_strerror (errno));
 		return -1;
@@ -1059,7 +1069,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 	camel_mime_parser_init_with_fd(mp, fd);
 
 	camel_folder_summary_lock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
-	camel_folder_summary_prepare_fetch_all (s, ex);
+	camel_folder_summary_prepare_fetch_all (s, NULL);
 	count = camel_folder_summary_count(s);
 	for (i = 0; i < count; i++) {
 		gint pc = (i + 1) * 100 / count;
@@ -1079,8 +1089,8 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 
 		if (camel_mime_parser_step(mp, &buffer, &len) != CAMEL_MIME_PARSER_STATE_FROM) {
 			g_warning("Expected a From line here, didn't get it %d", (gint)camel_mime_parser_tell(mp));
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Summary and folder mismatch, even after a sync"));
 			goto error;
 		}
@@ -1088,8 +1098,8 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 		if (camel_mime_parser_tell_start_from(mp) != info->frompos) {
 			g_warning("Didn't get the next message where I expected (%d) got %d instead",
 				  (gint)info->frompos, (gint)camel_mime_parser_tell_start_from(mp));
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Summary and folder mismatch, even after a sync"));
 			goto error;
 		}
@@ -1157,8 +1167,9 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 #endif
 			if (len == -1) {
 				d(printf("Error writing to temporary mailbox\n"));
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_SYSTEM,
+				g_set_error (
+					error, G_IO_ERROR,
+					g_io_error_from_errno (errno),
 					_("Writing to temporary mailbox failed: %s"),
 					g_strerror (errno));
 				goto error;
@@ -1175,8 +1186,9 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 			while (camel_mime_parser_step(mp, &buffer, &len) == CAMEL_MIME_PARSER_STATE_PRE_FROM) {
 				/*d(printf("copying mbox contents to temporary: '%.*s'\n", len, buffer));*/
 				if (write(fdout, buffer, len) != len) {
-					camel_exception_setv (
-						ex, CAMEL_EXCEPTION_SYSTEM,
+					g_set_error (
+						error, G_IO_ERROR,
+						g_io_error_from_errno (errno),
 						_("Writing to temporary mailbox failed: %s: %s"),
 						((CamelLocalSummary *)cls)->folder_path,
 						g_strerror (errno));
@@ -1185,8 +1197,9 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 			}
 
 			if (write(fdout, "\n", 1) != 1) {
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_SYSTEM,
+				g_set_error (
+					error, G_IO_ERROR,
+					g_io_error_from_errno (errno),
 					_("Writing to temporary mailbox failed: %s"),
 					g_strerror (errno));
 				goto error;
@@ -1202,7 +1215,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 
 	full_name = camel_folder_get_full_name (s->folder);
 	parent_store = camel_folder_get_parent_store (s->folder);
-	camel_db_delete_uids (parent_store->cdb_w, full_name, del, ex);
+	camel_db_delete_uids (parent_store->cdb_w, full_name, del, NULL);
 	g_slist_foreach (del, (GFunc) camel_pstring_free, NULL);
 	g_slist_free (del);
 
@@ -1231,7 +1244,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 	}
 
 	if (touched)
-		camel_folder_summary_header_save_to_db (s, ex);
+		camel_folder_summary_header_save_to_db (s, NULL);
 
 	camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
 
@@ -1251,7 +1264,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 
 #ifdef STATUS_PINE
 static CamelMessageInfo *
-mbox_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *ci, CamelException *ex)
+mbox_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *ci, GError **error)
 {
 	CamelLocalSummaryClass *local_summary_class;
 	CamelMboxMessageInfo *mi;
@@ -1259,7 +1272,7 @@ mbox_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessa
 	/* Chain up to parent's add() method. */
 	local_summary_class = CAMEL_LOCAL_SUMMARY_CLASS (camel_mbox_summary_parent_class);
 	mi = (CamelMboxMessageInfo *) local_summary_class->add (
-		cls, msg, info, ci, ex);
+		cls, msg, info, ci, error);
 	if (mi && ((CamelMboxSummary *)cls)->xstatus) {
 		gchar status[8];
 
diff --git a/camel/providers/local/camel-mbox-summary.h b/camel/providers/local/camel-mbox-summary.h
index bc0a150..d05b6a8 100644
--- a/camel/providers/local/camel-mbox-summary.h
+++ b/camel/providers/local/camel-mbox-summary.h
@@ -75,9 +75,9 @@ struct _CamelMboxSummaryClass {
 	CamelLocalSummaryClass parent_class;
 
 	/* sync in-place */
-	gint (*sync_quick)(CamelMboxSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
+	gint (*sync_quick)(CamelMboxSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, GError **error);
 	/* sync requires copy */
-	gint (*sync_full)(CamelMboxSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
+	gint (*sync_full)(CamelMboxSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, GError **error);
 };
 
 GType		camel_mbox_summary_get_type	(void);
@@ -87,7 +87,7 @@ CamelMboxSummary      *camel_mbox_summary_new	(struct _CamelFolder *, const gcha
 void camel_mbox_summary_xstatus(CamelMboxSummary *mbs, gint state);
 
 /* build a new mbox from an existing mbox storing summary information */
-gint camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderChangeInfo *changeinfo, gint fd, gint fdout, CamelException *ex);
+gint camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderChangeInfo *changeinfo, gint fd, gint fdout, GError **error);
 
 G_END_DECLS
 
diff --git a/camel/providers/local/camel-mh-folder.c b/camel/providers/local/camel-mh-folder.c
index 23bc663..0ca279c 100644
--- a/camel/providers/local/camel-mh-folder.c
+++ b/camel/providers/local/camel-mh-folder.c
@@ -42,9 +42,9 @@
 
 static CamelLocalSummary *mh_create_summary(CamelLocalFolder *lf, const gchar *path, const gchar *folder, CamelIndex *index);
 
-static gboolean mh_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, gchar **appended_uid, CamelException * ex);
-static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex);
-static gchar * mh_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex);
+static gboolean mh_append_message(CamelFolder *folder, CamelMimeMessage * message, const CamelMessageInfo *info, gchar **appended_uid, GError **error);
+static CamelMimeMessage *mh_get_message(CamelFolder *folder, const gchar *uid, GError **error);
+static gchar * mh_get_filename (CamelFolder *folder, const gchar *uid, GError **error);
 
 G_DEFINE_TYPE (CamelMhFolder, camel_mh_folder, CAMEL_TYPE_LOCAL_FOLDER)
 
@@ -72,7 +72,7 @@ CamelFolder *
 camel_mh_folder_new (CamelStore *parent_store,
                      const gchar *full_name,
                      guint32 flags,
-                     CamelException *ex)
+                     GError **error)
 {
 	CamelFolder *folder;
 	gchar *basename;
@@ -86,7 +86,7 @@ camel_mh_folder_new (CamelStore *parent_store,
 		"name", basename, "full-name", full_name,
 		"parent-store", parent_store, NULL);
 	folder = (CamelFolder *) camel_local_folder_construct (
-		CAMEL_LOCAL_FOLDER (folder), flags, ex);
+		CAMEL_LOCAL_FOLDER (folder), flags, error);
 
 	g_free (basename);
 
@@ -108,7 +108,7 @@ mh_append_message (CamelFolder *folder,
                    CamelMimeMessage *message,
                    const CamelMessageInfo *info,
                    gchar **appended_uid,
-                   CamelException *ex)
+                   GError **error)
 {
 	CamelLocalFolder *lf = (CamelLocalFolder *)folder;
 	CamelStream *output_stream;
@@ -120,11 +120,11 @@ mh_append_message (CamelFolder *folder,
 	d(printf("Appending message\n"));
 
 	/* If we can't lock, don't do anything */
-	if (camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, ex) == -1)
+	if (camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, error) == -1)
 		return FALSE;
 
 	/* add it to the summary/assign the uid, etc */
-	mi = camel_local_summary_add((CamelLocalSummary *)folder->summary, message, info, lf->changes, ex);
+	mi = camel_local_summary_add((CamelLocalSummary *)folder->summary, message, info, lf->changes, error);
 	if (mi == NULL)
 		goto check_changed;
 
@@ -136,12 +136,13 @@ mh_append_message (CamelFolder *folder,
 	/* write it out, use the uid we got from the summary */
 	name = g_strdup_printf("%s/%s", lf->folder_path, camel_message_info_uid(mi));
 	output_stream = camel_stream_fs_new_with_name (
-		name, O_WRONLY|O_CREAT, 0600);
+		name, O_WRONLY|O_CREAT, 0600, error);
 	if (output_stream == NULL)
 		goto fail_write;
 
-	if (camel_data_wrapper_write_to_stream ((CamelDataWrapper *)message, output_stream) == -1
-	    || camel_stream_close (output_stream) == -1)
+	if (camel_data_wrapper_write_to_stream (
+		(CamelDataWrapper *)message, output_stream, error) == -1
+	    || camel_stream_close (output_stream, error) == -1)
 		goto fail_write;
 
 	/* close this? */
@@ -160,15 +161,8 @@ mh_append_message (CamelFolder *folder,
 	camel_folder_summary_remove_uid (CAMEL_FOLDER_SUMMARY (folder->summary),
 					 camel_message_info_uid (mi));
 
-	if (errno == EINTR)
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_USER_CANCEL,
-			_("MH append message canceled"));
-	else
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Cannot append message to mh folder: %s: %s"),
-			name, g_strerror (errno));
+	g_prefix_error (
+		error, _("Cannot append message to mh folder: %s: "), name);
 
 	if (output_stream) {
 		g_object_unref (CAMEL_OBJECT (output_stream));
@@ -191,7 +185,7 @@ mh_append_message (CamelFolder *folder,
 static gchar *
 mh_get_filename (CamelFolder *folder,
                  const gchar *uid,
-                 CamelException *ex)
+                 GError **error)
 {
 	CamelLocalFolder *lf = (CamelLocalFolder *)folder;
 
@@ -201,7 +195,7 @@ mh_get_filename (CamelFolder *folder,
 static CamelMimeMessage *
 mh_get_message (CamelFolder *folder,
                 const gchar *uid,
-                CamelException * ex)
+                GError **error)
 {
 	CamelLocalFolder *lf = (CamelLocalFolder *)folder;
 	CamelStream *message_stream = NULL;
@@ -211,13 +205,13 @@ mh_get_message (CamelFolder *folder,
 
 	d(printf("getting message: %s\n", uid));
 
-	if (camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, ex) == -1)
+	if (camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, error) == -1)
 		return NULL;
 
 	/* get the message summary info */
 	if ((info = camel_folder_summary_uid(folder->summary, uid)) == NULL) {
 		set_cannot_get_message_ex (
-			ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+			error, CAMEL_FOLDER_ERROR_INVALID_UID,
 			uid, lf->folder_path, _("No such message"));
 		goto fail;
 	}
@@ -226,19 +220,20 @@ mh_get_message (CamelFolder *folder,
 	camel_message_info_free(info);
 
 	name = g_strdup_printf("%s/%s", lf->folder_path, uid);
-	if ((message_stream = camel_stream_fs_new_with_name(name, O_RDONLY, 0)) == NULL) {
-		set_cannot_get_message_ex (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			name, lf->folder_path, g_strerror (errno));
+	message_stream = camel_stream_fs_new_with_name (
+		name, O_RDONLY, 0, error);
+	if (message_stream == NULL) {
+		g_prefix_error (
+			error, _("Cannot get message %s from folder %s: "),
+			name, lf->folder_path);
 		goto fail;
 	}
 
 	message = camel_mime_message_new();
-	if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)message, message_stream) == -1) {
-		set_cannot_get_message_ex (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			name, lf->folder_path,
-			_("Message construction failed."));
+	if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)message, message_stream, error) == -1) {
+		g_prefix_error (
+			error, _("Cannot get message %s from folder %s: "),
+			name, lf->folder_path);
 		g_object_unref (message);
 		message = NULL;
 
diff --git a/camel/providers/local/camel-mh-folder.h b/camel/providers/local/camel-mh-folder.h
index 9857a3e..264f36c 100644
--- a/camel/providers/local/camel-mh-folder.h
+++ b/camel/providers/local/camel-mh-folder.h
@@ -57,7 +57,7 @@ struct _CamelMhFolderClass {
 };
 
 /* public methods */
-CamelFolder *camel_mh_folder_new(CamelStore *parent_store, const gchar *full_name, guint32 flags, CamelException *ex);
+CamelFolder *camel_mh_folder_new(CamelStore *parent_store, const gchar *full_name, guint32 flags, GError **error);
 
 GType camel_mh_folder_get_type(void);
 
diff --git a/camel/providers/local/camel-mh-store.c b/camel/providers/local/camel-mh-store.c
index d0c2277..7ff99bb 100644
--- a/camel/providers/local/camel-mh-store.c
+++ b/camel/providers/local/camel-mh-store.c
@@ -29,6 +29,7 @@
 #include <unistd.h>
 #include <sys/stat.h>
 
+#include <glib/gstdio.h>
 #include <glib/gi18n-lib.h>
 
 #include "camel-mh-folder.h"
@@ -37,12 +38,12 @@
 
 #define d(x)
 
-static gboolean construct (CamelService *service, CamelSession *session, CamelProvider *provider, CamelURL *url, CamelException *ex);
-static CamelFolder *get_folder(CamelStore * store, const gchar *folder_name, guint32 flags, CamelException * ex);
-static CamelFolder *get_inbox (CamelStore *store, CamelException *ex);
-static gboolean delete_folder(CamelStore * store, const gchar *folder_name, CamelException * ex);
-static gboolean rename_folder(CamelStore *store, const gchar *old, const gchar *new, CamelException *ex);
-static CamelFolderInfo * get_folder_info (CamelStore *store, const gchar *top, guint32 flags, CamelException *ex);
+static gboolean construct (CamelService *service, CamelSession *session, CamelProvider *provider, CamelURL *url, GError **error);
+static CamelFolder *get_folder(CamelStore *store, const gchar *folder_name, guint32 flags, GError **error);
+static CamelFolder *get_inbox (CamelStore *store, GError **error);
+static gboolean delete_folder(CamelStore *store, const gchar *folder_name, GError **error);
+static gboolean rename_folder(CamelStore *store, const gchar *old, const gchar *new, GError **error);
+static CamelFolderInfo * get_folder_info (CamelStore *store, const gchar *top, guint32 flags, GError **error);
 
 G_DEFINE_TYPE (CamelMhStore, camel_mh_store, CAMEL_TYPE_LOCAL_STORE)
 
@@ -73,14 +74,14 @@ construct (CamelService *service,
            CamelSession *session,
            CamelProvider *provider,
            CamelURL *url,
-           CamelException *ex)
+           GError **error)
 {
 	CamelServiceClass *service_class;
 	CamelMhStore *mh_store = (CamelMhStore *)service;
 
 	/* Chain up to parent's construct() method. */
 	service_class = CAMEL_SERVICE_CLASS (camel_mh_store_parent_class);
-	if (!service_class->construct (service, session, provider, url, ex))
+	if (!service_class->construct (service, session, provider, url, error))
 		return FALSE;
 
 	if (camel_url_get_param(url, "dotfolders"))
@@ -111,13 +112,13 @@ folders_update (const gchar *root,
 	sprintf (tmpnew, "%s.folders~", root);
 
 	out = camel_stream_fs_new_with_name (
-		tmpnew, O_WRONLY|O_CREAT|O_TRUNC, 0666);
+		tmpnew, O_WRONLY|O_CREAT|O_TRUNC, 0666, NULL);
 	if (out == NULL)
 		goto fail;
 
 	tmp = g_alloca (strlen (root) + 16);
 	sprintf (tmp, "%s.folders", root);
-	stream = camel_stream_fs_new_with_name (tmp, O_RDONLY, 0);
+	stream = camel_stream_fs_new_with_name (tmp, O_RDONLY, 0, NULL);
 	if (stream) {
 		in = camel_stream_buffer_new(stream, CAMEL_STREAM_BUFFER_READ);
 		g_object_unref (stream);
@@ -128,7 +129,7 @@ folders_update (const gchar *root,
 		goto done;
 	}
 
-	while ((line = camel_stream_buffer_read_line((CamelStreamBuffer *)in))) {
+	while ((line = camel_stream_buffer_read_line((CamelStreamBuffer *)in, NULL))) {
 		gint copy = TRUE;
 
 		switch (mode) {
@@ -139,9 +140,9 @@ folders_update (const gchar *root,
 		case UPDATE_RENAME:
 			if (strncmp(line, folder, flen) == 0
 			    && (line[flen] == 0 || line[flen] == '/')) {
-				if (camel_stream_write(out, new, strlen(new)) == -1
-				    || camel_stream_write(out, line+flen, strlen(line)-flen) == -1
-				    || camel_stream_write(out, "\n", 1) == -1)
+				if (camel_stream_write(out, new, strlen(new), NULL) == -1
+				    || camel_stream_write(out, line+flen, strlen(line)-flen, NULL) == -1
+				    || camel_stream_write(out, "\n", 1, NULL) == -1)
 					goto fail;
 				copy = FALSE;
 			}
@@ -174,12 +175,12 @@ folders_update (const gchar *root,
 	if (mode == UPDATE_ADD && camel_stream_printf(out, "%s\n", folder) == -1)
 		goto fail;
 
-	if (camel_stream_close(out) == -1)
+	if (camel_stream_close(out, NULL) == -1)
 		goto fail;
 
 done:
 	/* should we care if this fails?  I suppose so ... */
-	rename(tmpnew, tmp);
+	g_rename (tmpnew, tmp);
 fail:
 	unlink(tmpnew);		/* remove it if its there */
 	g_free(line);
@@ -193,7 +194,7 @@ static CamelFolder *
 get_folder (CamelStore *store,
             const gchar *folder_name,
             guint32 flags,
-            CamelException * ex)
+            GError **error)
 {
 	CamelStoreClass *store_class;
 	gchar *name;
@@ -201,23 +202,25 @@ get_folder (CamelStore *store,
 
 	/* Chain up to parent's get_folder() method. */
 	store_class = CAMEL_STORE_CLASS (camel_mh_store_parent_class);
-	if (store_class->get_folder (store, folder_name, flags, ex) == NULL)
+	if (store_class->get_folder (store, folder_name, flags, error) == NULL)
 		return NULL;
 
 	name = g_strdup_printf("%s%s", CAMEL_LOCAL_STORE(store)->toplevel_dir, folder_name);
 
-	if (stat(name, &st) == -1) {
+	if (g_stat(name, &st) == -1) {
 		if (errno != ENOENT) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Cannot get folder '%s': %s"),
 				folder_name, g_strerror (errno));
 			g_free (name);
 			return NULL;
 		}
 		if ((flags & CAMEL_STORE_FOLDER_CREATE) == 0) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+			g_set_error (
+				error, CAMEL_STORE_ERROR,
+				CAMEL_STORE_ERROR_NO_FOLDER,
 				_("Cannot get folder '%s': folder does not exist."),
 				folder_name);
 			g_free (name);
@@ -225,8 +228,9 @@ get_folder (CamelStore *store,
 		}
 
 		if (mkdir(name, 0777) != 0) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Could not create folder '%s': %s"),
 				folder_name, g_strerror (errno));
 			g_free (name);
@@ -238,15 +242,16 @@ get_folder (CamelStore *store,
 		if (((CamelMhStore *)store)->flags & CAMEL_MH_DOTFOLDERS)
 			folders_update(((CamelLocalStore *)store)->toplevel_dir, UPDATE_ADD, folder_name, NULL);
 	} else if (!S_ISDIR(st.st_mode)) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("Cannot get folder '%s': not a directory."),
 			folder_name);
 		g_free (name);
 		return NULL;
 	} else if (flags & CAMEL_STORE_FOLDER_EXCL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot create folder '%s': folder exists."),
 			folder_name);
 		g_free (name);
@@ -255,20 +260,20 @@ get_folder (CamelStore *store,
 
 	g_free(name);
 
-	return camel_mh_folder_new(store, folder_name, flags, ex);
+	return camel_mh_folder_new(store, folder_name, flags, error);
 }
 
 static CamelFolder *
 get_inbox (CamelStore *store,
-           CamelException *ex)
+           GError **error)
 {
-	return get_folder (store, "inbox", 0, ex);
+	return get_folder (store, "inbox", 0, error);
 }
 
 static gboolean
 delete_folder (CamelStore *store,
                const gchar *folder_name,
-               CamelException *ex)
+               GError **error)
 {
 	CamelStoreClass *store_class;
 	gchar *name;
@@ -276,8 +281,9 @@ delete_folder (CamelStore *store,
 	/* remove folder directory - will fail if not empty */
 	name = g_strdup_printf("%s%s", CAMEL_LOCAL_STORE(store)->toplevel_dir, folder_name);
 	if (rmdir(name) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not delete folder '%s': %s"),
 			folder_name, g_strerror (errno));
 		g_free(name);
@@ -291,20 +297,20 @@ delete_folder (CamelStore *store,
 
 	/* Chain up to parent's delete_folder() method. */
 	store_class = CAMEL_STORE_CLASS (camel_mh_store_parent_class);
-	return store_class->delete_folder (store, folder_name, ex);
+	return store_class->delete_folder (store, folder_name, error);
 }
 
 static gboolean
 rename_folder (CamelStore *store,
                const gchar *old,
                const gchar *new,
-               CamelException *ex)
+               GError **error)
 {
 	CamelStoreClass *store_class;
 
 	/* Chain up to parent's rename_folder() method. */
 	store_class = CAMEL_STORE_CLASS (camel_mh_store_parent_class);
-	if (!store_class->rename_folder (store, old, new, ex))
+	if (!store_class->rename_folder (store, old, new, error))
 		return FALSE;
 
 	if (((CamelMhStore *)store)->flags & CAMEL_MH_DOTFOLDERS) {
@@ -418,7 +424,7 @@ recursive_scan (CamelStore *store,
 	} else
 		fullpath = (gchar *)root;
 
-	if (stat(fullpath, &st) == -1 || !S_ISDIR(st.st_mode))
+	if (g_stat(fullpath, &st) == -1 || !S_ISDIR(st.st_mode))
 		return;
 
 	in.dnode = st.st_dev;
@@ -489,7 +495,7 @@ folders_scan (CamelStore *store,
 
 	tmp = g_alloca (strlen (root) + 16);
 	sprintf (tmp, "%s/.folders", root);
-	stream = camel_stream_fs_new_with_name(tmp, 0, O_RDONLY);
+	stream = camel_stream_fs_new_with_name(tmp, 0, O_RDONLY, NULL);
 	if (stream == NULL)
 		return;
 
@@ -501,7 +507,7 @@ folders_scan (CamelStore *store,
 	visited = g_hash_table_new(g_str_hash, g_str_equal);
 	folders = g_ptr_array_new();
 
-	while ( (len = camel_stream_buffer_gets((CamelStreamBuffer *)in, line, sizeof(line))) > 0) {
+	while ( (len = camel_stream_buffer_gets((CamelStreamBuffer *)in, line, sizeof(line), NULL)) > 0) {
 		/* ignore blank lines */
 		if (len <= 1)
 			continue;
@@ -540,7 +546,7 @@ folders_scan (CamelStore *store,
 		g_hash_table_insert(visited, tmp, tmp);
 
 		path = g_strdup_printf("%s/%s", root, line);
-		if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) {
+		if (g_stat(path, &st) == 0 && S_ISDIR(st.st_mode)) {
 			fi = folder_info_new(store, url, root, line, flags);
 			g_ptr_array_add(folders, fi);
 		}
@@ -584,7 +590,7 @@ static CamelFolderInfo *
 get_folder_info (CamelStore *store,
                  const gchar *top,
                  guint32 flags,
-                 CamelException *ex)
+                 GError **error)
 {
 	CamelFolderInfo *fi = NULL;
 	CamelURL *url;
diff --git a/camel/providers/local/camel-mh-summary.c b/camel/providers/local/camel-mh-summary.c
index 0d12156..a41a586 100644
--- a/camel/providers/local/camel-mh-summary.c
+++ b/camel/providers/local/camel-mh-summary.c
@@ -45,9 +45,9 @@
 	(G_TYPE_INSTANCE_GET_PRIVATE \
 	((obj), CAMEL_TYPE_MH_SUMMARY, CamelMhSummaryPrivate))
 
-static gint mh_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-static gint mh_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-/*static gint mh_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);*/
+static gint mh_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, GError **error);
+static gint mh_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, GError **error);
+/*static gint mh_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, CamelMessageInfo *info, CamelFolderChangeInfo *, GError **error);*/
 
 static gchar *mh_summary_next_uid_string(CamelFolderSummary *s);
 
@@ -203,7 +203,7 @@ remove_summary (gchar *key,
 static gint
 mh_summary_check (CamelLocalSummary *cls,
                   CamelFolderChangeInfo *changeinfo,
-                  CamelException *ex)
+                  GError **error)
 {
 	DIR *dir;
 	struct dirent *d;
@@ -222,8 +222,9 @@ mh_summary_check (CamelLocalSummary *cls,
 	   no longer exist */
 	dir = opendir(cls->folder_path);
 	if (dir == NULL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Cannot open MH directory path: %s: %s"),
 			cls->folder_path, g_strerror (errno));
 		return -1;
@@ -231,7 +232,7 @@ mh_summary_check (CamelLocalSummary *cls,
 
 	/* keeps track of all uid's that have not been processed */
 	left = g_hash_table_new(g_str_hash, g_str_equal);
-	camel_folder_summary_prepare_fetch_all ((CamelFolderSummary *)cls, ex);
+	camel_folder_summary_prepare_fetch_all ((CamelFolderSummary *)cls, error);
 	count = camel_folder_summary_count((CamelFolderSummary *)cls);
 	forceindex = count == 0;
 	for (i=0;i<count;i++) {
@@ -286,7 +287,7 @@ static gint
 mh_summary_sync (CamelLocalSummary *cls,
                  gboolean expunge,
                  CamelFolderChangeInfo *changes,
-                 CamelException *ex)
+                 GError **error)
 {
 	CamelLocalSummaryClass *local_summary_class;
 	gint count, i;
@@ -298,12 +299,12 @@ mh_summary_sync (CamelLocalSummary *cls,
 
 	/* we could probably get away without this ... but why not use it, esp if we're going to
 	   be doing any significant io already */
-	if (camel_local_summary_check(cls, changes, ex) == -1)
+	if (camel_local_summary_check(cls, changes, error) == -1)
 		return -1;
 
 	/* FIXME: need to update/honour .mh_sequences or whatever it is */
 
-	camel_folder_summary_prepare_fetch_all ((CamelFolderSummary *)cls, ex);
+	camel_folder_summary_prepare_fetch_all ((CamelFolderSummary *)cls, error);
 	count = camel_folder_summary_count((CamelFolderSummary *)cls);
 	for (i=count-1;i>=0;i--) {
 		info = (CamelLocalMessageInfo *)camel_folder_summary_index((CamelFolderSummary *)cls, i);
@@ -330,5 +331,5 @@ mh_summary_sync (CamelLocalSummary *cls,
 
 	/* Chain up to parent's sync() method. */
 	local_summary_class = CAMEL_LOCAL_SUMMARY_CLASS (camel_mh_summary_parent_class);
-	return local_summary_class->sync (cls, expunge, changes, ex);
+	return local_summary_class->sync (cls, expunge, changes, error);
 }
diff --git a/camel/providers/local/camel-spool-folder.c b/camel/providers/local/camel-spool-folder.c
index 98511b5..78579eb 100644
--- a/camel/providers/local/camel-spool-folder.c
+++ b/camel/providers/local/camel-spool-folder.c
@@ -42,7 +42,7 @@
 
 static CamelLocalSummary *spool_create_summary(CamelLocalFolder *lf, const gchar *path, const gchar *folder, CamelIndex *index);
 
-static gint spool_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex);
+static gint spool_lock(CamelLocalFolder *lf, CamelLockType type, GError **error);
 static void spool_unlock(CamelLocalFolder *lf);
 
 G_DEFINE_TYPE (CamelSpoolFolder, camel_spool_folder, CAMEL_TYPE_MBOX_FOLDER)
@@ -68,7 +68,7 @@ CamelFolder *
 camel_spool_folder_new (CamelStore *parent_store,
                         const gchar *full_name,
                         guint32 flags,
-                        CamelException *ex)
+                        GError **error)
 {
 	CamelFolder *folder;
 	gchar *basename;
@@ -86,7 +86,7 @@ camel_spool_folder_new (CamelStore *parent_store,
 	flags &= ~CAMEL_STORE_FOLDER_BODY_INDEX;
 
 	folder = (CamelFolder *)camel_local_folder_construct (
-		(CamelLocalFolder *)folder, flags, ex);
+		(CamelLocalFolder *)folder, flags, error);
 	if (folder) {
 		if (camel_url_get_param(((CamelService *)parent_store)->url, "xstatus"))
 			camel_mbox_summary_xstatus((CamelMboxSummary *)folder->summary, TRUE);
@@ -110,16 +110,18 @@ spool_create_summary (CamelLocalFolder *lf,
 static gint
 spool_lock (CamelLocalFolder *lf,
             CamelLockType type,
-            CamelException *ex)
+            GError **error)
 {
 	gint retry = 0;
 	CamelMboxFolder *mf = (CamelMboxFolder *)lf;
 	CamelSpoolFolder *sf = (CamelSpoolFolder *)lf;
+	GError *local_error = NULL;
 
 	mf->lockfd = open(lf->folder_path, O_RDWR|O_LARGEFILE, 0);
 	if (mf->lockfd == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Cannot create folder lock on %s: %s"),
 			lf->folder_path, g_strerror (errno));
 		return -1;
@@ -129,11 +131,11 @@ spool_lock (CamelLocalFolder *lf,
 		if (retry > 0)
 			sleep(CAMEL_LOCK_DELAY);
 
-		camel_exception_clear(ex);
+		g_clear_error (&local_error);
 
-		if (camel_lock_fcntl(mf->lockfd, type, ex) == 0) {
-			if (camel_lock_flock(mf->lockfd, type, ex) == 0) {
-				if ((sf->lockid = camel_lock_helper_lock(lf->folder_path, ex)) != -1)
+		if (camel_lock_fcntl(mf->lockfd, type, &local_error) == 0) {
+			if (camel_lock_flock(mf->lockfd, type, &local_error) == 0) {
+				if ((sf->lockid = camel_lock_helper_lock(lf->folder_path, &local_error)) != -1)
 					return 0;
 				camel_unlock_flock(mf->lockfd);
 			}
@@ -145,6 +147,9 @@ spool_lock (CamelLocalFolder *lf,
 	close (mf->lockfd);
 	mf->lockfd = -1;
 
+	if (local_error != NULL)
+		g_propagate_error (error, local_error);
+
 	return -1;
 }
 
diff --git a/camel/providers/local/camel-spool-folder.h b/camel/providers/local/camel-spool-folder.h
index 7ae32af..042d5b7 100644
--- a/camel/providers/local/camel-spool-folder.h
+++ b/camel/providers/local/camel-spool-folder.h
@@ -63,7 +63,7 @@ struct _CamelSpoolFolderClass {
 
 GType camel_spool_folder_get_type(void);
 
-CamelFolder *camel_spool_folder_new(CamelStore *parent_store, const gchar *full_name, guint32 flags, CamelException *ex);
+CamelFolder *camel_spool_folder_new(CamelStore *parent_store, const gchar *full_name, guint32 flags, GError **error);
 
 G_END_DECLS
 
diff --git a/camel/providers/local/camel-spool-store.c b/camel/providers/local/camel-spool-store.c
index 811efb0..a83ce0b 100644
--- a/camel/providers/local/camel-spool-store.c
+++ b/camel/providers/local/camel-spool-store.c
@@ -32,10 +32,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
+#include <glib/gstdio.h>
 #include <glib/gi18n-lib.h>
 
 #include "camel-spool-folder.h"
@@ -43,15 +40,15 @@
 
 #define d(x)
 
-static gboolean construct (CamelService *service, CamelSession *session, CamelProvider *provider, CamelURL *url, CamelException *ex);
-static CamelFolder *get_folder(CamelStore * store, const gchar *folder_name, guint32 flags, CamelException * ex);
+static gboolean construct (CamelService *service, CamelSession *session, CamelProvider *provider, CamelURL *url, GError **error);
+static CamelFolder *get_folder(CamelStore* store, const gchar *folder_name, guint32 flags, GError **error);
 static gchar *get_name(CamelService *service, gboolean brief);
-static CamelFolder *get_inbox (CamelStore *store, CamelException *ex);
-static gboolean rename_folder(CamelStore *store, const gchar *old_name, const gchar *new_name, CamelException *ex);
-static CamelFolderInfo *get_folder_info (CamelStore *store, const gchar *top, guint32 flags, CamelException *ex);
+static CamelFolder *get_inbox (CamelStore *store, GError **error);
+static gboolean rename_folder(CamelStore *store, const gchar *old_name, const gchar *new_name, GError **error);
+static CamelFolderInfo *get_folder_info (CamelStore *store, const gchar *top, guint32 flags, GError **error);
 static void free_folder_info (CamelStore *store, CamelFolderInfo *fi);
 
-static gboolean delete_folder(CamelStore *store, const gchar *folder_name, CamelException *ex);
+static gboolean delete_folder(CamelStore *store, const gchar *folder_name, GError **error);
 
 static gchar *spool_get_meta_path(CamelLocalStore *ls, const gchar *full_name, const gchar *ext);
 static gchar *spool_get_full_path(CamelLocalStore *ls, const gchar *full_name);
@@ -92,7 +89,7 @@ construct (CamelService *service,
            CamelSession *session,
            CamelProvider *provider,
            CamelURL *url,
-           CamelException *ex)
+           GError **error)
 {
 	CamelServiceClass *service_class;
 	struct stat st;
@@ -102,20 +99,22 @@ construct (CamelService *service,
 
 	/* Chain up to parent's construct() method. */
 	service_class = CAMEL_SERVICE_CLASS (camel_spool_store_parent_class);
-	if (!service_class->construct (service, session, provider, url, ex))
+	if (!service_class->construct (service, session, provider, url, error))
 		return FALSE;
 
 	if (service->url->path[0] != '/') {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("Store root %s is not an absolute path"),
 			service->url->path);
 		return FALSE;
 	}
 
-	if (stat(service->url->path, &st) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+	if (g_stat(service->url->path, &st) == -1) {
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Spool '%s' cannot be opened: %s"),
 			service->url->path, g_strerror (errno));
 		return FALSE;
@@ -127,8 +126,9 @@ construct (CamelService *service,
 		/* we could check here for slight variations */
 		((CamelSpoolStore *)service)->type = CAMEL_SPOOL_STORE_ELM;
 	else {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("Spool '%s' is not a regular file or directory"),
 			service->url->path);
 		return FALSE;
@@ -141,7 +141,7 @@ static CamelFolder *
 get_folder (CamelStore *store,
             const gchar *folder_name,
             guint32 flags,
-            CamelException * ex)
+            GError **error)
 {
 	CamelFolder *folder = NULL;
 	struct stat st;
@@ -152,42 +152,47 @@ get_folder (CamelStore *store,
 	/* we only support an 'INBOX' in mbox mode */
 	if (((CamelSpoolStore *)store)->type == CAMEL_SPOOL_STORE_MBOX) {
 		if (strcmp(folder_name, "INBOX") != 0) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+			g_set_error (
+				error, CAMEL_STORE_ERROR,
+				CAMEL_STORE_ERROR_NO_FOLDER,
 				_("Folder '%s/%s' does not exist."),
 				((CamelService *)store)->url->path, folder_name);
 		} else {
-			folder = camel_spool_folder_new(store, folder_name, flags, ex);
+			folder = camel_spool_folder_new(store, folder_name, flags, error);
 		}
 	} else {
 		name = g_strdup_printf("%s%s", CAMEL_LOCAL_STORE(store)->toplevel_dir, folder_name);
-		if (stat(name, &st) == -1) {
+		if (g_stat(name, &st) == -1) {
 			if (errno != ENOENT) {
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_SYSTEM,
+				g_set_error (
+					error, G_IO_ERROR,
+					g_io_error_from_errno (errno),
 					_("Could not open folder '%s':\n%s"),
 					folder_name, g_strerror (errno));
 			} else if ((flags & CAMEL_STORE_FOLDER_CREATE) == 0) {
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+				g_set_error (
+					error, CAMEL_STORE_ERROR,
+					CAMEL_STORE_ERROR_NO_FOLDER,
 					_("Folder '%s' does not exist."),
 					folder_name);
 			} else {
 				if (creat (name, 0600) == -1) {
-					camel_exception_setv (
-						ex, CAMEL_EXCEPTION_SYSTEM,
+					g_set_error (
+						error, G_IO_ERROR,
+						g_io_error_from_errno (errno),
 						_("Could not create folder '%s':\n%s"),
 						folder_name, g_strerror (errno));
 				} else {
-					folder = camel_spool_folder_new(store, folder_name, flags, ex);
+					folder = camel_spool_folder_new(store, folder_name, flags, error);
 				}
 			}
 		} else if (!S_ISREG(st.st_mode)) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+			g_set_error (
+				error, CAMEL_STORE_ERROR,
+				CAMEL_STORE_ERROR_NO_FOLDER,
 				_("'%s' is not a mailbox file."), name);
 		} else {
-			folder = camel_spool_folder_new(store, folder_name, flags, ex);
+			folder = camel_spool_folder_new(store, folder_name, flags, error);
 		}
 		g_free(name);
 	}
@@ -197,13 +202,14 @@ get_folder (CamelStore *store,
 
 static CamelFolder *
 get_inbox (CamelStore *store,
-           CamelException *ex)
+           GError **error)
 {
 	if (((CamelSpoolStore *)store)->type == CAMEL_SPOOL_STORE_MBOX)
-		return get_folder (store, "INBOX", CAMEL_STORE_FOLDER_CREATE, ex);
+		return get_folder (store, "INBOX", CAMEL_STORE_FOLDER_CREATE, error);
 	else {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+		g_set_error (
+			error, CAMEL_STORE_ERROR,
+			CAMEL_STORE_ERROR_NO_FOLDER,
 			_("Store does not support an INBOX"));
 		return NULL;
 	}
@@ -225,10 +231,10 @@ static gboolean
 rename_folder (CamelStore *store,
                const gchar *old,
                const gchar *new,
-               CamelException *ex)
+               GError **error)
 {
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 		_("Spool folders cannot be renamed"));
 
 	return FALSE;
@@ -238,10 +244,10 @@ rename_folder (CamelStore *store,
 static gboolean
 delete_folder (CamelStore *store,
                const gchar *folder_name,
-               CamelException *ex)
+               GError **error)
 {
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 		_("Spool folders cannot be deleted"));
 
 	return FALSE;
@@ -331,7 +337,7 @@ scan_dir (CamelStore *store,
           guint32 flags,
           CamelFolderInfo *parent,
           CamelFolderInfo **fip,
-          CamelException *ex)
+          GError **error)
 {
 	DIR *dir;
 	struct dirent *d;
@@ -351,9 +357,10 @@ scan_dir (CamelStore *store,
 	} else
 		name = root;
 
-	if (stat(name, &st) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+	if (g_stat(name, &st) == -1) {
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not scan folder '%s': %s"),
 			name, g_strerror (errno));
 	} else if (S_ISREG(st.st_mode)) {
@@ -367,8 +374,9 @@ scan_dir (CamelStore *store,
 
 	dir = opendir(name);
 	if (dir == NULL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not scan folder '%s': %s"),
 			name, g_strerror (errno));
 		return -1;
@@ -386,7 +394,7 @@ scan_dir (CamelStore *store,
 			continue;
 
 		tmp = g_strdup_printf("%s/%s", name, d->d_name);
-		if (stat(tmp, &st) == 0) {
+		if (g_stat(tmp, &st) == 0) {
 			if (path)
 				fname = g_strdup_printf("%s/%s", path, d->d_name);
 			else
@@ -424,7 +432,7 @@ scan_dir (CamelStore *store,
 					*inew = in;
 					g_hash_table_insert(visited, inew, inew);
 
-					if (scan_dir(store, visited, root, fname, flags, parent, fip, ex) == -1) {
+					if (scan_dir(store, visited, root, fname, flags, parent, fip, error) == -1) {
 						g_free(tmp);
 						g_free(fname);
 						closedir(dir);
@@ -468,14 +476,14 @@ static CamelFolderInfo *
 get_folder_info_elm (CamelStore *store,
                      const gchar *top,
                      guint32 flags,
-                     CamelException *ex)
+                     GError **error)
 {
 	CamelFolderInfo *fi = NULL;
 	GHashTable *visited;
 
 	visited = g_hash_table_new(inode_hash, inode_equal);
 
-	if (scan_dir(store, visited, ((CamelService *)store)->url->path, top, flags, NULL, &fi, ex) == -1 && fi != NULL) {
+	if (scan_dir(store, visited, ((CamelService *)store)->url->path, top, flags, NULL, &fi, error) == -1 && fi != NULL) {
 		camel_store_free_folder_info_full(store, fi);
 		fi = NULL;
 	}
@@ -490,7 +498,7 @@ static CamelFolderInfo *
 get_folder_info_mbox (CamelStore *store,
                       const gchar *top,
                       guint32 flags,
-                      CamelException *ex)
+                      GError **error)
 {
 	CamelFolderInfo *fi = NULL, *fip = NULL;
 
@@ -508,12 +516,12 @@ static CamelFolderInfo *
 get_folder_info (CamelStore *store,
                  const gchar *top,
                  guint32 flags,
-                 CamelException *ex)
+                 GError **error)
 {
 	if (((CamelSpoolStore *)store)->type == CAMEL_SPOOL_STORE_MBOX)
-		return get_folder_info_mbox (store, top, flags, ex);
+		return get_folder_info_mbox (store, top, flags, error);
 	else
-		return get_folder_info_elm (store, top, flags, ex);
+		return get_folder_info_elm (store, top, flags, error);
 }
 
 static gchar *
diff --git a/camel/providers/local/camel-spool-summary.c b/camel/providers/local/camel-spool-summary.c
index aa75427..5c0c9a6 100644
--- a/camel/providers/local/camel-spool-summary.c
+++ b/camel/providers/local/camel-spool-summary.c
@@ -32,6 +32,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#include <glib/gstdio.h>
 #include <glib/gi18n-lib.h>
 
 #include "camel-spool-summary.h"
@@ -43,10 +44,10 @@
 
 #define CAMEL_SPOOL_SUMMARY_VERSION (0x400)
 
-static gint spool_summary_load(CamelLocalSummary *cls, gint forceindex, CamelException *ex);
-static gint spool_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
+static gint spool_summary_load(CamelLocalSummary *cls, gint forceindex, GError **error);
+static gint spool_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, GError **error);
 
-static gint spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
+static gint spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, GError **error);
 static gint spool_summary_need_index(void);
 
 G_DEFINE_TYPE (CamelSpoolSummary, camel_spool_summary, CAMEL_TYPE_MBOX_SUMMARY)
@@ -103,7 +104,7 @@ camel_spool_summary_new (CamelFolder *folder,
 static gint
 spool_summary_load (CamelLocalSummary *cls,
                     gint forceindex,
-                    CamelException *ex)
+                    GError **error)
 {
 	g_warning("spool summary - not loading anything\n");
 	return 0;
@@ -114,7 +115,7 @@ static gint
 spool_summary_sync_full (CamelMboxSummary *cls,
                          gboolean expunge,
                          CamelFolderChangeInfo *changeinfo,
-                         CamelException *ex)
+                         GError **error)
 {
 	gint fd = -1, fdout = -1;
 	gchar tmpname[64] = { '\0' };
@@ -130,8 +131,9 @@ spool_summary_sync_full (CamelMboxSummary *cls,
 
 	fd = open(((CamelLocalSummary *)cls)->folder_path, O_RDWR|O_LARGEFILE);
 	if (fd == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not open file: %s: %s"),
 			((CamelLocalSummary *)cls)->folder_path,
 			g_strerror (errno));
@@ -144,21 +146,23 @@ spool_summary_sync_full (CamelMboxSummary *cls,
 
 	d(printf("Writing tmp file to %s\n", tmpname));
 	if (fdout == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Cannot open temporary mailbox: %s"),
 			g_strerror (errno));
 		goto error;
 	}
 
-	if (camel_mbox_summary_sync_mbox((CamelMboxSummary *)cls, flags, changeinfo, fd, fdout, ex) == -1)
+	if (camel_mbox_summary_sync_mbox((CamelMboxSummary *)cls, flags, changeinfo, fd, fdout, error) == -1)
 		goto error;
 
 	/* sync out content */
 	if (fsync(fdout) == -1) {
 		g_warning("Cannot sync temporary folder: %s", g_strerror (errno));
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not sync temporary folder %s: %s"),
 			((CamelLocalSummary *)cls)->folder_path,
 			g_strerror (errno));
@@ -168,8 +172,9 @@ spool_summary_sync_full (CamelMboxSummary *cls,
 	/* see if we can write this much to the spool file */
 	if (fstat(fd, &st) == -1) {
 		g_warning("Cannot sync temporary folder: %s", g_strerror (errno));
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not sync temporary folder %s: %s"),
 			((CamelLocalSummary *)cls)->folder_path,
 			g_strerror (errno));
@@ -179,8 +184,9 @@ spool_summary_sync_full (CamelMboxSummary *cls,
 
 	if (fstat(fdout, &st) == -1) {
 		g_warning("Cannot sync temporary folder: %s", g_strerror (errno));
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not sync temporary folder %s: %s"),
 			((CamelLocalSummary *)cls)->folder_path,
 			g_strerror (errno));
@@ -196,8 +202,9 @@ spool_summary_sync_full (CamelMboxSummary *cls,
 		|| lseek(fd, 0, SEEK_SET) == -1
 		|| lseek(fdout, 0, SEEK_SET) == -1)) {
 		g_warning("Cannot sync spool folder: %s", g_strerror (errno));
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not sync spool folder %s: %s"),
 			((CamelLocalSummary *)cls)->folder_path,
 			g_strerror (errno));
@@ -227,8 +234,9 @@ spool_summary_sync_full (CamelMboxSummary *cls,
 		}
 
 		if (size == -1) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Could not sync spool folder %s: %s\n"
 				  "Folder may be corrupt, copy saved in '%s'"),
 				((CamelLocalSummary *)cls)->folder_path,
@@ -245,8 +253,9 @@ spool_summary_sync_full (CamelMboxSummary *cls,
 	d(printf("Closing folders\n"));
 
 	if (ftruncate(fd, outlen) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not sync spool folder %s: %s\n"
 			  "Folder may be corrupt, copy saved in '%s'"),
 			((CamelLocalSummary *)cls)->folder_path,
@@ -257,8 +266,9 @@ spool_summary_sync_full (CamelMboxSummary *cls,
 
 	if (close(fd) == -1) {
 		g_warning("Cannot close source folder: %s", g_strerror (errno));
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not sync spool folder %s: %s\n"
 			  "Folder may be corrupt, copy saved in '%s'"),
 			((CamelLocalSummary *)cls)->folder_path,
@@ -294,18 +304,18 @@ spool_summary_sync_full (CamelMboxSummary *cls,
 static gint
 spool_summary_check (CamelLocalSummary *cls,
                      CamelFolderChangeInfo *changeinfo,
-                     CamelException *ex)
+                     GError **error)
 {
 	gint i, work, count;
 	struct stat st;
 	CamelFolderSummary *s = (CamelFolderSummary *)cls;
 
-	if (CAMEL_LOCAL_SUMMARY_CLASS (camel_spool_summary_parent_class)->check(cls, changeinfo, ex) == -1)
+	if (CAMEL_LOCAL_SUMMARY_CLASS (camel_spool_summary_parent_class)->check(cls, changeinfo, error) == -1)
 		return -1;
 
 	/* check to see if we need to copy/update the file; missing xev headers prompt this */
 	work = FALSE;
-	camel_folder_summary_prepare_fetch_all (s, ex);
+	camel_folder_summary_prepare_fetch_all (s, error);
 	count = camel_folder_summary_count(s);
 	for (i=0;!work && i<count; i++) {
 		CamelMboxMessageInfo *info = (CamelMboxMessageInfo *)camel_folder_summary_index(s, i);
@@ -317,12 +327,13 @@ spool_summary_check (CamelLocalSummary *cls,
 	/* if we do, then write out the headers using sync_full, etc */
 	if (work) {
 		d(printf("Have to add new headers, re-syncing from the start to accomplish this\n"));
-		if (CAMEL_MBOX_SUMMARY_GET_CLASS (cls)->sync_full (CAMEL_MBOX_SUMMARY (cls), FALSE, changeinfo, ex) == -1)
+		if (CAMEL_MBOX_SUMMARY_GET_CLASS (cls)->sync_full (CAMEL_MBOX_SUMMARY (cls), FALSE, changeinfo, error) == -1)
 			return -1;
 
-		if (stat(cls->folder_path, &st) == -1) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+		if (g_stat(cls->folder_path, &st) == -1) {
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Unknown error: %s"),
 				g_strerror (errno));
 			return -1;
diff --git a/camel/providers/local/camel-spool-summary.h b/camel/providers/local/camel-spool-summary.h
index 98aa960..37ccaaa 100644
--- a/camel/providers/local/camel-spool-summary.h
+++ b/camel/providers/local/camel-spool-summary.h
@@ -65,13 +65,13 @@ void	camel_spool_summary_construct	(CamelSpoolSummary *new, const gchar *filenam
 CamelSpoolSummary *camel_spool_summary_new(struct _CamelFolder *, const gchar *filename);
 
 /* load/check the summary */
-gint camel_spool_summary_load(CamelSpoolSummary *cls, gint forceindex, CamelException *ex);
+gint camel_spool_summary_load(CamelSpoolSummary *cls, gint forceindex, GError **error);
 /* check for new/removed messages */
-gint camel_spool_summary_check(CamelSpoolSummary *cls, CamelFolderChangeInfo *, CamelException *ex);
+gint camel_spool_summary_check(CamelSpoolSummary *cls, CamelFolderChangeInfo *, GError **error);
 /* perform a folder sync or expunge, if needed */
-gint camel_spool_summary_sync(CamelSpoolSummary *cls, gboolean expunge, CamelFolderChangeInfo *, CamelException *ex);
+gint camel_spool_summary_sync(CamelSpoolSummary *cls, gboolean expunge, CamelFolderChangeInfo *, GError **error);
 /* add a new message to the summary */
-CamelMessageInfo *camel_spool_summary_add(CamelSpoolSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);
+CamelMessageInfo *camel_spool_summary_add(CamelSpoolSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, GError **error);
 
 /* generate an X-Evolution header line */
 gchar *camel_spool_summary_encode_x_evolution(CamelSpoolSummary *cls, const CamelMessageInfo *info);
diff --git a/camel/providers/nntp/Makefile.am b/camel/providers/nntp/Makefile.am
index 913bb8a..e44bf8d 100644
--- a/camel/providers/nntp/Makefile.am
+++ b/camel/providers/nntp/Makefile.am
@@ -13,21 +13,21 @@ libcamelnntp_la_CPPFLAGS = \
 	-DG_LOG_DOMAIN=\"camel-nntp-provider\"
 
 libcamelnntp_la_SOURCES = 			\
+	camel-nntp-folder.c			\
 	camel-nntp-provider.c			\
+	camel-nntp-store-summary.c		\
 	camel-nntp-store.c			\
-	camel-nntp-folder.c			\
 	camel-nntp-stream.c			\
-	camel-nntp-summary.c			\
-	camel-nntp-store-summary.c
+	camel-nntp-summary.c
 
-noinst_HEADERS =			\
-	camel-nntp-store.h			\
+noinst_HEADERS =				\
 	camel-nntp-folder.h			\
+	camel-nntp-private.h			\
 	camel-nntp-resp-codes.h			\
-	camel-nntp-stream.h			\
-	camel-nntp-summary.h			\
 	camel-nntp-store-summary.h		\
-	camel-nntp-private.h
+	camel-nntp-store.h			\
+	camel-nntp-stream.h			\
+	camel-nntp-summary.h
 
 libcamelnntp_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED)
 
diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c
index 67c8d6d..bc01453 100644
--- a/camel/providers/nntp/camel-nntp-folder.c
+++ b/camel/providers/nntp/camel-nntp-folder.c
@@ -72,7 +72,7 @@ nntp_folder_finalize (GObject *object)
 gboolean
 camel_nntp_folder_selected (CamelNNTPFolder *nntp_folder,
                             gchar *line,
-                            CamelException *ex)
+                            GError **error)
 {
 	CamelFolder *folder;
 	CamelStore *parent_store;
@@ -83,12 +83,12 @@ camel_nntp_folder_selected (CamelNNTPFolder *nntp_folder,
 	return camel_nntp_summary_check (
 		CAMEL_NNTP_SUMMARY (folder->summary),
 		CAMEL_NNTP_STORE (parent_store),
-		line, nntp_folder->changes, ex);
+		line, nntp_folder->changes, error);
 }
 
 static gboolean
 nntp_folder_refresh_info_online (CamelFolder *folder,
-                                 CamelException *ex)
+                                 GError **error)
 {
 	CamelStore *parent_store;
 	CamelNNTPStore *nntp_store;
@@ -107,7 +107,7 @@ nntp_folder_refresh_info_online (CamelFolder *folder,
 	/* When invoked with no fmt, camel_nntp_command() just selects the folder
 	   and should return zero. */
 	success = !camel_nntp_command (
-		nntp_store, ex, nntp_folder, &line, NULL);
+		nntp_store, error, nntp_folder, &line, NULL);
 
 	if (camel_folder_change_info_changed(nntp_folder->changes)) {
 		changes = nntp_folder->changes;
@@ -143,7 +143,7 @@ unset_flagged_flag (const gchar *uid, CamelFolderSummary *summary)
 }
 
 static gboolean
-nntp_folder_sync (CamelFolder *folder, CamelException *ex)
+nntp_folder_sync (CamelFolder *folder, GError **error)
 {
 	CamelStore *parent_store;
 	GPtrArray *changed;
@@ -160,7 +160,7 @@ nntp_folder_sync (CamelFolder *folder, CamelException *ex)
 		g_ptr_array_free (changed, TRUE);
 		camel_folder_summary_touch (folder->summary);
 	}
-	success = camel_folder_summary_save_to_db (folder->summary, ex);
+	success = camel_folder_summary_save_to_db (folder->summary, NULL);
 
 	camel_service_unlock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
@@ -168,19 +168,19 @@ nntp_folder_sync (CamelFolder *folder, CamelException *ex)
 }
 
 static gboolean
-nntp_folder_sync_online (CamelFolder *folder, CamelException *ex)
+nntp_folder_sync_online (CamelFolder *folder, GError **error)
 {
-	return nntp_folder_sync (folder, ex);
+	return nntp_folder_sync (folder, error);
 }
 
 static gboolean
-nntp_folder_sync_offline (CamelFolder *folder, CamelException *ex)
+nntp_folder_sync_offline (CamelFolder *folder, GError **error)
 {
-	return nntp_folder_sync (folder, ex);
+	return nntp_folder_sync (folder, error);
 }
 
 static gchar *
-nntp_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex)
+nntp_get_filename (CamelFolder *folder, const gchar *uid, GError **error)
 {
 	CamelStore *parent_store;
 	CamelNNTPStore *nntp_store;
@@ -193,18 +193,18 @@ nntp_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex)
 	strcpy(article, uid);
 	msgid = strchr (article, ',');
 	if (msgid == NULL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Internal error: UID in invalid format: %s"), uid);
 		return NULL;
 	}
 	*msgid++ = 0;
 
-	return camel_data_cache_get_filename (nntp_store->cache, "cache", msgid, ex);
+	return camel_data_cache_get_filename (nntp_store->cache, "cache", msgid, error);
 }
 
 static CamelStream *
-nntp_folder_download_message (CamelNNTPFolder *nntp_folder, const gchar *id, const gchar *msgid, CamelException *ex)
+nntp_folder_download_message (CamelNNTPFolder *nntp_folder, const gchar *id, const gchar *msgid, GError **error)
 {
 	CamelFolder *folder;
 	CamelStore *parent_store;
@@ -217,39 +217,32 @@ nntp_folder_download_message (CamelNNTPFolder *nntp_folder, const gchar *id, con
 	parent_store = camel_folder_get_parent_store (folder);
 	nntp_store = CAMEL_NNTP_STORE (parent_store);
 
-	ret = camel_nntp_command (nntp_store, ex, nntp_folder, &line, "article %s", id);
+	ret = camel_nntp_command (nntp_store, error, nntp_folder, &line, "article %s", id);
 	if (ret == 220) {
 		stream = camel_data_cache_add (nntp_store->cache, "cache", msgid, NULL);
 		if (stream) {
-			if (camel_stream_write_to_stream ((CamelStream *) nntp_store->stream, stream) == -1)
+			if (camel_stream_write_to_stream ((CamelStream *) nntp_store->stream, stream, error) == -1)
 				goto fail;
-			if (camel_stream_reset (stream) == -1)
+			if (camel_stream_reset (stream, error) == -1)
 				goto fail;
 		} else {
 			stream = g_object_ref (nntp_store->stream);
 		}
 	} else if (ret == 423 || ret == 430) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+		g_set_error (
+			error, CAMEL_FOLDER_ERROR,
+			CAMEL_FOLDER_ERROR_INVALID_UID,
 			_("Cannot get message %s: %s"), msgid, line);
 	} else if (ret != -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot get message %s: %s"), msgid, line);
 	}
 
 	return stream;
 
 fail:
-	if (errno == EINTR)
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_USER_CANCEL,
-			_("User cancelled the operation"));
-	else
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Cannot get message %s: %s"), msgid,
-			g_strerror (errno));
+	g_prefix_error (error, _("Cannot get message %s: "), msgid);
 
 	return NULL;
 }
@@ -257,7 +250,7 @@ fail:
 static gboolean
 nntp_folder_cache_message (CamelDiscoFolder *disco_folder,
                            const gchar *uid,
-                           CamelException *ex)
+                           GError **error)
 {
 	CamelFolder *folder;
 	CamelStore *parent_store;
@@ -274,8 +267,8 @@ nntp_folder_cache_message (CamelDiscoFolder *disco_folder,
 	strcpy(article, uid);
 	msgid = strchr(article, ',');
 	if (!msgid) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Internal error: UID in invalid format: %s"), uid);
 		return FALSE;
 	}
@@ -284,7 +277,7 @@ nntp_folder_cache_message (CamelDiscoFolder *disco_folder,
 	camel_service_lock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
 	stream = nntp_folder_download_message (
-		(CamelNNTPFolder *) disco_folder, article, msgid, ex);
+		(CamelNNTPFolder *) disco_folder, article, msgid, error);
 	if (stream)
 		g_object_unref (stream);
 	else
@@ -296,7 +289,7 @@ nntp_folder_cache_message (CamelDiscoFolder *disco_folder,
 }
 
 static CamelMimeMessage *
-nntp_folder_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
+nntp_folder_get_message (CamelFolder *folder, const gchar *uid, GError **error)
 {
 	CamelStore *parent_store;
 	CamelMimeMessage *message = NULL;
@@ -315,8 +308,8 @@ nntp_folder_get_message (CamelFolder *folder, const gchar *uid, CamelException *
 	strcpy(article, uid);
 	msgid = strchr (article, ',');
 	if (msgid == NULL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Internal error: UID in invalid format: %s"), uid);
 		return NULL;
 	}
@@ -328,28 +321,21 @@ nntp_folder_get_message (CamelFolder *folder, const gchar *uid, CamelException *
 	stream = camel_data_cache_get (nntp_store->cache, "cache", msgid, NULL);
 	if (stream == NULL) {
 		if (camel_disco_store_status ((CamelDiscoStore *) nntp_store) == CAMEL_DISCO_STORE_OFFLINE) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_UNAVAILABLE,
 				_("This message is not currently available"));
 			goto fail;
 		}
 
-		stream = nntp_folder_download_message (nntp_folder, article, msgid, ex);
+		stream = nntp_folder_download_message (nntp_folder, article, msgid, error);
 		if (stream == NULL)
 			goto fail;
 	}
 
 	message = camel_mime_message_new ();
-	if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream) == -1) {
-		if (errno == EINTR)
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_USER_CANCEL,
-				_("User cancelled the operation"));
-		else
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
-				_("Cannot get message %s: %s"), uid,
-				g_strerror (errno));
+	if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream, error) == -1) {
+		g_prefix_error (error, _("Cannot get message %s: "), uid);
 		g_object_unref (message);
 		message = NULL;
 	}
@@ -374,7 +360,7 @@ fail:
 }
 
 static GPtrArray*
-nntp_folder_search_by_expression (CamelFolder *folder, const gchar *expression, CamelException *ex)
+nntp_folder_search_by_expression (CamelFolder *folder, const gchar *expression, GError **error)
 {
 	CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder);
 	GPtrArray *matches;
@@ -385,7 +371,7 @@ nntp_folder_search_by_expression (CamelFolder *folder, const gchar *expression,
 		nntp_folder->search = camel_folder_search_new ();
 
 	camel_folder_search_set_folder (nntp_folder->search, folder);
-	matches = camel_folder_search_search(nntp_folder->search, expression, NULL, ex);
+	matches = camel_folder_search_search(nntp_folder->search, expression, NULL, error);
 
 	CAMEL_NNTP_FOLDER_UNLOCK(nntp_folder, search_lock);
 
@@ -393,7 +379,7 @@ nntp_folder_search_by_expression (CamelFolder *folder, const gchar *expression,
 }
 
 static guint32
-nntp_folder_count_by_expression (CamelFolder *folder, const gchar *expression, CamelException *ex)
+nntp_folder_count_by_expression (CamelFolder *folder, const gchar *expression, GError **error)
 {
 	CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder);
 	guint32 count;
@@ -404,7 +390,7 @@ nntp_folder_count_by_expression (CamelFolder *folder, const gchar *expression, C
 		nntp_folder->search = camel_folder_search_new ();
 
 	camel_folder_search_set_folder (nntp_folder->search, folder);
-	count = camel_folder_search_count(nntp_folder->search, expression, ex);
+	count = camel_folder_search_count(nntp_folder->search, expression, error);
 
 	CAMEL_NNTP_FOLDER_UNLOCK(nntp_folder, search_lock);
 
@@ -412,7 +398,7 @@ nntp_folder_count_by_expression (CamelFolder *folder, const gchar *expression, C
 }
 
 static GPtrArray *
-nntp_folder_search_by_uids (CamelFolder *folder, const gchar *expression, GPtrArray *uids, CamelException *ex)
+nntp_folder_search_by_uids (CamelFolder *folder, const gchar *expression, GPtrArray *uids, GError **error)
 {
 	CamelNNTPFolder *nntp_folder = (CamelNNTPFolder *) folder;
 	GPtrArray *matches;
@@ -426,7 +412,7 @@ nntp_folder_search_by_uids (CamelFolder *folder, const gchar *expression, GPtrAr
 		nntp_folder->search = camel_folder_search_new ();
 
 	camel_folder_search_set_folder (nntp_folder->search, folder);
-	matches = camel_folder_search_search(nntp_folder->search, expression, uids, ex);
+	matches = camel_folder_search_search(nntp_folder->search, expression, uids, error);
 
 	CAMEL_NNTP_FOLDER_UNLOCK(folder, search_lock);
 
@@ -448,7 +434,7 @@ nntp_folder_append_message_online (CamelFolder *folder,
                                    CamelMimeMessage *mime_message,
                                    const CamelMessageInfo *info,
                                    gchar **appended_uid,
-                                   CamelException *ex)
+                                   GError **error)
 {
 	CamelStore *parent_store;
 	CamelNNTPStore *nntp_store;
@@ -471,16 +457,18 @@ nntp_folder_append_message_online (CamelFolder *folder,
 	camel_service_lock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
 	/* send 'POST' command */
-	ret = camel_nntp_command (nntp_store, ex, NULL, &line, "post");
+	ret = camel_nntp_command (nntp_store, error, NULL, &line, "post");
 	if (ret != 340) {
 		if (ret == 440) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
+			g_set_error (
+				error, CAMEL_FOLDER_ERROR,
+				CAMEL_FOLDER_ERROR_INSUFFICIENT_PERMISSION,
 				_("Posting failed: %s"), line);
 			success = FALSE;
 		} else if (ret != -1) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR,
+				CAMEL_ERROR_GENERIC,
 				_("Posting failed: %s"), line);
 			success = FALSE;
 		}
@@ -518,23 +506,16 @@ nntp_folder_append_message_online (CamelFolder *folder,
 	}
 
 	/* write the message */
-	if (camel_stream_write(stream, group, strlen(group)) == -1
-	    || camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (mime_message), filtered_stream) == -1
-	    || camel_stream_flush (filtered_stream) == -1
-	    || camel_stream_write (stream, "\r\n.\r\n", 5) == -1
-	    || (ret = camel_nntp_stream_line (nntp_store->stream, (guchar **)&line, &u)) == -1) {
-		if (errno == EINTR)
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_USER_CANCEL,
-				_("User cancelled the operation"));
-		else
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
-				_("Posting failed: %s"), g_strerror (errno));
+	if (camel_stream_write(stream, group, strlen(group), error) == -1
+	    || camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (mime_message), filtered_stream, error) == -1
+	    || camel_stream_flush (filtered_stream, error) == -1
+	    || camel_stream_write (stream, "\r\n.\r\n", 5, error) == -1
+	    || (ret = camel_nntp_stream_line (nntp_store->stream, (guchar **)&line, &u, error)) == -1) {
+		g_prefix_error (error, _("Posting failed: "));
 		success = FALSE;
 	} else if (atoi(line) != 240) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Posting failed: %s"), line);
 		success = FALSE;
 	}
@@ -553,10 +534,11 @@ nntp_folder_append_message_offline (CamelFolder *folder,
                                     CamelMimeMessage *mime_message,
                                     const CamelMessageInfo *info,
                                     gchar **appended_uid,
-                                    CamelException *ex)
+                                    GError **error)
 {
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+	g_set_error (
+		error, CAMEL_SERVICE_ERROR,
+		CAMEL_SERVICE_ERROR_UNAVAILABLE,
 		_("You cannot post NNTP messages while working offline!"));
 
 	return FALSE;
@@ -571,10 +553,11 @@ nntp_folder_transfer_message (CamelFolder *source,
                               CamelFolder *dest,
                               GPtrArray **transferred_uids,
                               gboolean delete_orig,
-                              CamelException *ex)
+                              GError **error)
 {
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+	g_set_error (
+		error, CAMEL_SERVICE_ERROR,
+		CAMEL_SERVICE_ERROR_UNAVAILABLE,
 		_("You cannot copy messages from a NNTP folder!"));
 
 	return FALSE;
@@ -628,7 +611,7 @@ camel_nntp_folder_init (CamelNNTPFolder *nntp_folder)
 CamelFolder *
 camel_nntp_folder_new (CamelStore *parent,
                        const gchar *folder_name,
-                       CamelException *ex)
+                       GError **error)
 {
 	CamelFolder *folder;
 	CamelNNTPFolder *nntp_folder;
@@ -638,7 +621,7 @@ camel_nntp_folder_new (CamelStore *parent,
 	gboolean subscribed = TRUE;
 
 	service = (CamelService *) parent;
-	root = camel_session_get_storage_path (service->session, service, ex);
+	root = camel_session_get_storage_path (service->session, service, error);
 	if (root == NULL)
 		return NULL;
 
@@ -666,7 +649,7 @@ camel_nntp_folder_new (CamelStore *parent,
 	folder->summary = (CamelFolderSummary *) camel_nntp_summary_new (folder, root);
 	g_free(root);
 
-	camel_folder_summary_load_from_db (folder->summary, ex);
+	camel_folder_summary_load_from_db (folder->summary, NULL);
 
 	si = camel_store_summary_path ((CamelStoreSummary *) ((CamelNNTPStore*) parent)->summary, folder_name);
 	if (si) {
@@ -674,7 +657,7 @@ camel_nntp_folder_new (CamelStore *parent,
 		camel_store_summary_info_free ((CamelStoreSummary *) ((CamelNNTPStore*) parent)->summary, si);
 	}
 
-	if (subscribed && !camel_folder_refresh_info (folder, ex)) {
+	if (subscribed && !camel_folder_refresh_info (folder, error)) {
 		g_object_unref (folder);
 		folder = NULL;
         }
diff --git a/camel/providers/nntp/camel-nntp-folder.h b/camel/providers/nntp/camel-nntp-folder.h
index 7eb11b8..79613bf 100644
--- a/camel/providers/nntp/camel-nntp-folder.h
+++ b/camel/providers/nntp/camel-nntp-folder.h
@@ -68,9 +68,9 @@ struct _CamelNNTPFolderClass {
 
 GType camel_nntp_folder_get_type (void);
 
-CamelFolder *camel_nntp_folder_new (CamelStore *parent, const gchar *folder_name, CamelException *ex);
+CamelFolder *camel_nntp_folder_new (CamelStore *parent, const gchar *folder_name, GError **error);
 
-gboolean camel_nntp_folder_selected(CamelNNTPFolder *folder, gchar *line, CamelException *ex);
+gboolean camel_nntp_folder_selected(CamelNNTPFolder *folder, gchar *line, GError **error);
 
 G_END_DECLS
 
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
index 9fb7f5e..8c45f6d 100644
--- a/camel/providers/nntp/camel-nntp-store.c
+++ b/camel/providers/nntp/camel-nntp-store.c
@@ -58,7 +58,7 @@
 	(G_TYPE_INSTANCE_GET_PRIVATE \
 	((obj), CAMEL_TYPE_NNTP_STORE, CamelNNTPStorePrivate))
 
-static gint camel_nntp_try_authenticate (CamelNNTPStore *store, CamelException *ex);
+static gint camel_nntp_try_authenticate (CamelNNTPStore *store, GError **error);
 
 G_DEFINE_TYPE (CamelNNTPStore, camel_nntp_store, CAMEL_TYPE_DISCO_STORE)
 
@@ -142,7 +142,7 @@ static struct {
 };
 
 static gint
-xover_setup(CamelNNTPStore *store, CamelException *ex)
+xover_setup(CamelNNTPStore *store, GError **error)
 {
 	gint ret, i;
 	gchar *line;
@@ -154,7 +154,7 @@ xover_setup(CamelNNTPStore *store, CamelException *ex)
 	if (store->xover || getenv("CAMEL_NNTP_DISABLE_XOVER") != NULL)
 		return 0;
 
-	ret = camel_nntp_raw_command_auth(store, ex, &line, "list overview.fmt");
+	ret = camel_nntp_raw_command_auth(store, error, &line, "list overview.fmt");
 	if (ret == -1) {
 		return -1;
 	} else if (ret != 215)
@@ -164,7 +164,7 @@ xover_setup(CamelNNTPStore *store, CamelException *ex)
 	last = (struct _xover_header *)&store->xover;
 
 	/* supported command */
-	while ((ret = camel_nntp_stream_line(store->stream, (guchar **)&line, &len)) > 0) {
+	while ((ret = camel_nntp_stream_line(store->stream, (guchar **)&line, &len, error)) > 0) {
 		p = (guchar *) line;
 		xover = g_malloc0(sizeof(*xover));
 		last->next = xover;
@@ -205,7 +205,7 @@ enum {
 #endif
 
 static gboolean
-connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, CamelException *ex)
+connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, GError **error)
 {
 	CamelNNTPStore *store = (CamelNNTPStore *) service;
 	CamelDiscoStore *disco_store = (CamelDiscoStore*) service;
@@ -228,8 +228,9 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 			tcp_stream = camel_tcp_stream_ssl_new (service->session, service->url->host, SSL_PORT_FLAGS);
 		}
 #else
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
 			_("Could not connect to %s: %s"),
 			service->url->host, _("SSL unavailable"));
 		goto fail;
@@ -246,16 +247,10 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 		g_free (socks_host);
 	}
 
-	if (camel_tcp_stream_connect ((CamelTcpStream *) tcp_stream, ai) == -1) {
-		if (errno == EINTR)
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_USER_CANCEL,
-				_("Connection canceled"));
-		else
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-				_("Could not connect to %s: %s"),
-				service->url->host, g_strerror (errno));
+	if (camel_tcp_stream_connect ((CamelTcpStream *) tcp_stream, ai, error) == -1) {
+		g_prefix_error (
+			error, _("Could not connect to %s: "),
+			service->url->host);
 		g_object_unref (tcp_stream);
 
 		goto fail;
@@ -265,14 +260,10 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 	g_object_unref (tcp_stream);
 
 	/* Read the greeting, if any. */
-	if (camel_nntp_stream_line (store->stream, &buf, &len) == -1) {
-		if (errno == EINTR)
-			camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
-					     _("Connection canceled"));
-		else
-			camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-					      _("Could not read greeting from %s: %s"),
-					      service->url->host, g_strerror (errno));
+	if (camel_nntp_stream_line (store->stream, &buf, &len, error) == -1) {
+		g_prefix_error (
+			error, _("Could not read greeting from %s: "),
+			service->url->host);
 
 		g_object_unref (store->stream);
 		store->stream = NULL;
@@ -282,9 +273,10 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 
 	len = strtoul ((gchar *) buf, (gchar **) &buf, 10);
 	if (len != 200 && len != 201) {
-		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-				      _("NNTP server %s returned error code %d: %s"),
-				      service->url->host, len, buf);
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+			_("NNTP server %s returned error code %d: %s"),
+			service->url->host, len, buf);
 
 		g_object_unref (store->stream);
 		store->stream = NULL;
@@ -295,20 +287,20 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 	/* if we have username, try it here */
 	if (service->url->user != NULL
 	    && service->url->user[0]
-	    && camel_nntp_try_authenticate(store, ex) != NNTP_AUTH_ACCEPTED)
+	    && camel_nntp_try_authenticate(store, error) != NNTP_AUTH_ACCEPTED)
 		goto fail;
 
 	/* set 'reader' mode & ignore return code, also ping the server, inn goes offline very quickly otherwise */
-	if (camel_nntp_raw_command_auth (store, ex, (gchar **) &buf, "mode reader") == -1
-	    || camel_nntp_raw_command_auth (store, ex, (gchar **) &buf, "date") == -1)
+	if (camel_nntp_raw_command_auth (store, error, (gchar **) &buf, "mode reader") == -1
+	    || camel_nntp_raw_command_auth (store, error, (gchar **) &buf, "date") == -1)
 		goto fail;
 
-	if (xover_setup(store, ex) == -1)
+	if (xover_setup(store, error) == -1)
 		goto fail;
 
 	if (!disco_store->diary) {
 		path = g_build_filename (store->storage_path, ".ev-journal", NULL);
-		disco_store->diary = camel_disco_diary_new (disco_store, path, ex);
+		disco_store->diary = camel_disco_diary_new (disco_store, path, error);
 		g_free (path);
 	}
 
@@ -336,13 +328,14 @@ static struct {
 };
 
 static gboolean
-nntp_connect_online (CamelService *service, CamelException *ex)
+nntp_connect_online (CamelService *service, GError **error)
 {
 	struct addrinfo hints, *ai;
 	const gchar *ssl_mode;
 	gint mode, ret, i;
 	gchar *serv;
 	const gchar *port;
+	GError *local_error = NULL;
 
 	if ((ssl_mode = camel_url_get_param (service->url, "use_ssl"))) {
 		for (i = 0; ssl_options[i].value; i++)
@@ -366,15 +359,17 @@ nntp_connect_online (CamelService *service, CamelException *ex)
 	memset (&hints, 0, sizeof (hints));
 	hints.ai_socktype = SOCK_STREAM;
 	hints.ai_family = PF_UNSPEC;
-	ai = camel_getaddrinfo(service->url->host, serv, &hints, ex);
-	if (ai == NULL && port != NULL && camel_exception_get_id(ex) != CAMEL_EXCEPTION_USER_CANCEL) {
-		camel_exception_clear (ex);
-		ai = camel_getaddrinfo(service->url->host, port, &hints, ex);
+	ai = camel_getaddrinfo(service->url->host, serv, &hints, &local_error);
+	if (ai == NULL && port != NULL && !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+		g_clear_error (&local_error);
+		ai = camel_getaddrinfo(service->url->host, port, &hints, &local_error);
 	}
-	if (ai == NULL)
+	if (ai == NULL) {
+		g_propagate_error (error, local_error);
 		return FALSE;
+	}
 
-	ret = connect_to_server (service, ai, mode, ex);
+	ret = connect_to_server (service, ai, mode, error);
 
 	camel_freeaddrinfo (ai);
 
@@ -382,7 +377,7 @@ nntp_connect_online (CamelService *service, CamelException *ex)
 }
 
 static gboolean
-nntp_connect_offline (CamelService *service, CamelException *ex)
+nntp_connect_offline (CamelService *service, GError **error)
 {
 	CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE(service);
 	CamelDiscoStore *disco_store = (CamelDiscoStore *) nntp_store;
@@ -393,7 +388,7 @@ nntp_connect_offline (CamelService *service, CamelException *ex)
 
 	/* setup store-wide cache */
 	if (nntp_store->cache == NULL) {
-		nntp_store->cache = camel_data_cache_new (nntp_store->storage_path, ex);
+		nntp_store->cache = camel_data_cache_new (nntp_store->storage_path, error);
 		if (nntp_store->cache == NULL)
 			return FALSE;
 
@@ -406,7 +401,7 @@ nntp_connect_offline (CamelService *service, CamelException *ex)
 		return TRUE;
 
 	path = g_build_filename (nntp_store->storage_path, ".ev-journal", NULL);
-	disco_store->diary = camel_disco_diary_new (disco_store, path, ex);
+	disco_store->diary = camel_disco_diary_new (disco_store, path, error);
 	g_free (path);
 
 	if (!disco_store->diary)
@@ -416,17 +411,15 @@ nntp_connect_offline (CamelService *service, CamelException *ex)
 }
 
 static gboolean
-nntp_disconnect_online (CamelService *service, gboolean clean, CamelException *ex)
+nntp_disconnect_online (CamelService *service, gboolean clean, GError **error)
 {
 	CamelNNTPStore *store = CAMEL_NNTP_STORE (service);
 	gchar *line;
 
 	camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	if (clean) {
-		camel_nntp_raw_command (store, ex, &line, "quit");
-		camel_exception_clear(ex);
-	}
+	if (clean)
+		camel_nntp_raw_command (store, NULL, &line, "quit");
 
 	g_object_unref (store->stream);
 	store->stream = NULL;
@@ -439,7 +432,7 @@ nntp_disconnect_online (CamelService *service, gboolean clean, CamelException *e
 }
 
 static gboolean
-nntp_disconnect_offline (CamelService *service, gboolean clean, CamelException *ex)
+nntp_disconnect_offline (CamelService *service, gboolean clean, GError **error)
 {
 	CamelDiscoStore *disco = CAMEL_DISCO_STORE(service);
 
@@ -464,20 +457,20 @@ nntp_store_get_name (CamelService *service, gboolean brief)
 extern CamelServiceAuthType camel_nntp_password_authtype;
 
 static GList *
-nntp_store_query_auth_types (CamelService *service, CamelException *ex)
+nntp_store_query_auth_types (CamelService *service, GError **error)
 {
 	return g_list_append (NULL, &camel_nntp_password_authtype);
 }
 
 static CamelFolder *
-nntp_get_folder(CamelStore *store, const gchar *folder_name, guint32 flags, CamelException *ex)
+nntp_get_folder(CamelStore *store, const gchar *folder_name, guint32 flags, GError **error)
 {
 	CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (store);
 	CamelFolder *folder;
 
 	camel_service_lock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-	folder = camel_nntp_folder_new(store, folder_name, ex);
+	folder = camel_nntp_folder_new(store, folder_name, error);
 
 	camel_service_unlock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
@@ -639,7 +632,7 @@ nntp_store_info_update(CamelNNTPStore *store, gchar *line)
 }
 
 static CamelFolderInfo *
-nntp_store_get_subscribed_folder_info (CamelNNTPStore *store, const gchar *top, guint flags, CamelException *ex)
+nntp_store_get_subscribed_folder_info (CamelNNTPStore *store, const gchar *top, guint flags, GError **error)
 {
 	gint i;
 	CamelStoreInfo *si;
@@ -660,12 +653,12 @@ nntp_store_get_subscribed_folder_info (CamelNNTPStore *store, const gchar *top,
 				CamelNNTPFolder *folder;
 				gchar *line;
 
-				folder = (CamelNNTPFolder *)camel_store_get_folder((CamelStore *)store, si->path, 0, ex);
+				folder = (CamelNNTPFolder *)camel_store_get_folder((CamelStore *)store, si->path, 0, NULL);
 				if (folder) {
 					CamelFolderChangeInfo *changes = NULL;
 
 					camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-					camel_nntp_command(store, ex, folder, &line, NULL);
+					camel_nntp_command(store, NULL, folder, &line, NULL);
 					if (camel_folder_change_info_changed(folder->changes)) {
 						changes = folder->changes;
 						folder->changes = camel_folder_change_info_new();
@@ -677,7 +670,6 @@ nntp_store_get_subscribed_folder_info (CamelNNTPStore *store, const gchar *top,
 					}
 					g_object_unref (folder);
 				}
-				camel_exception_clear(ex);
 			}
 			fi = nntp_folder_info_from_store_info (store, store->do_short_folder_notation, si);
 			fi->flags |= CAMEL_FOLDER_NOINFERIORS | CAMEL_FOLDER_NOCHILDREN | CAMEL_FOLDER_SYSTEM;
@@ -775,7 +767,7 @@ nntp_push_to_hierarchy (CamelURL *base_url, CamelFolderInfo *root, CamelFolderIn
  * get folder info, using the information in our StoreSummary
  */
 static CamelFolderInfo *
-nntp_store_get_cached_folder_info (CamelNNTPStore *store, const gchar *orig_top, guint flags, CamelException *ex)
+nntp_store_get_cached_folder_info (CamelNNTPStore *store, const gchar *orig_top, guint flags, GError **error)
 {
 	gint i;
 	gint subscribed_or_flag = (flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED) ? 0 : 1,
@@ -860,10 +852,10 @@ nntp_store_get_cached_folder_info (CamelNNTPStore *store, const gchar *orig_top,
 
 /* retrieves the date from the NNTP server */
 static gboolean
-nntp_get_date(CamelNNTPStore *nntp_store, CamelException *ex)
+nntp_get_date(CamelNNTPStore *nntp_store, GError **error)
 {
 	guchar *line;
-	gint ret = camel_nntp_command(nntp_store, ex, NULL, (gchar **)&line, "date");
+	gint ret = camel_nntp_command(nntp_store, error, NULL, (gchar **)&line, "date");
 	gchar *ptr;
 
 	nntp_store->summary->last_newslist[0] = 0;
@@ -897,7 +889,7 @@ store_info_sort (gconstpointer a, gconstpointer b)
 }
 
 static CamelFolderInfo *
-nntp_store_get_folder_info_all(CamelNNTPStore *nntp_store, const gchar *top, guint32 flags, gboolean online, CamelException *ex)
+nntp_store_get_folder_info_all(CamelNNTPStore *nntp_store, const gchar *top, guint32 flags, gboolean online, GError **error)
 {
 	CamelNNTPStoreSummary *summary = nntp_store->summary;
 	CamelNNTPStoreInfo *si;
@@ -924,7 +916,7 @@ nntp_store_get_folder_info_all(CamelNNTPStore *nntp_store, const gchar *top, gui
 			if (!nntp_get_date (nntp_store, NULL))
 				goto do_complete_list_nodate;
 
-			ret = camel_nntp_command (nntp_store, ex, NULL, (gchar **) &line, "newgroups %s", date);
+			ret = camel_nntp_command (nntp_store, error, NULL, (gchar **) &line, "newgroups %s", date);
 			if (ret == -1)
 				goto error;
 			else if (ret != 231) {
@@ -933,7 +925,7 @@ nntp_store_get_folder_info_all(CamelNNTPStore *nntp_store, const gchar *top, gui
 				goto do_complete_list;
 			}
 
-			while ((ret = camel_nntp_stream_line (nntp_store->stream, &line, &len)) > 0)
+			while ((ret = camel_nntp_stream_line (nntp_store->stream, &line, &len, error)) > 0)
 				nntp_store_info_update(nntp_store, (gchar *) line);
 		} else {
 			GHashTable *all;
@@ -944,12 +936,13 @@ nntp_store_get_folder_info_all(CamelNNTPStore *nntp_store, const gchar *top, gui
 			/* at first, we do a DATE to find out the last load occasion */
 			nntp_get_date (nntp_store, NULL);
 		do_complete_list_nodate:
-			ret = camel_nntp_command (nntp_store, ex, NULL, (gchar **)&line, "list");
+			ret = camel_nntp_command (nntp_store, error, NULL, (gchar **)&line, "list");
 			if (ret == -1)
 				goto error;
 			else if (ret != 215) {
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_SERVICE_INVALID,
+				g_set_error (
+					error, CAMEL_SERVICE_ERROR,
+					CAMEL_SERVICE_ERROR_INVALID,
 					_("Error retrieving newsgroups:\n\n%s"), line);
 				goto error;
 			}
@@ -958,7 +951,7 @@ nntp_store_get_folder_info_all(CamelNNTPStore *nntp_store, const gchar *top, gui
 			for (i = 0; (si = (CamelNNTPStoreInfo *)camel_store_summary_index ((CamelStoreSummary *)nntp_store->summary, i)); i++)
 				g_hash_table_insert(all, si->info.path, si);
 
-			while ((ret = camel_nntp_stream_line(nntp_store->stream, &line, &len)) > 0) {
+			while ((ret = camel_nntp_stream_line(nntp_store->stream, &line, &len, error)) > 0) {
 				si = nntp_store_info_update(nntp_store, (gchar *) line);
 				g_hash_table_remove(all, si->info.path);
 			}
@@ -975,7 +968,7 @@ nntp_store_get_folder_info_all(CamelNNTPStore *nntp_store, const gchar *top, gui
 		camel_store_summary_save ((CamelStoreSummary *) nntp_store->summary);
 	}
 
-	fi = nntp_store_get_cached_folder_info (nntp_store, top, flags, ex);
+	fi = nntp_store_get_cached_folder_info (nntp_store, top, flags, error);
  error:
 	camel_service_unlock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
@@ -983,7 +976,7 @@ nntp_store_get_folder_info_all(CamelNNTPStore *nntp_store, const gchar *top, gui
 }
 
 static CamelFolderInfo *
-nntp_get_folder_info (CamelStore *store, const gchar *top, guint32 flags, gboolean online, CamelException *ex)
+nntp_get_folder_info (CamelStore *store, const gchar *top, guint32 flags, gboolean online, GError **error)
 {
 	CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE(store);
 	CamelFolderInfo *first = NULL;
@@ -996,23 +989,23 @@ nntp_get_folder_info (CamelStore *store, const gchar *top, guint32 flags, gboole
 		top?top:""));
 
 	if (flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED)
-		first = nntp_store_get_subscribed_folder_info (nntp_store, top, flags, ex);
+		first = nntp_store_get_subscribed_folder_info (nntp_store, top, flags, error);
 	else
-		first = nntp_store_get_folder_info_all (nntp_store, top, flags, online, ex);
+		first = nntp_store_get_folder_info_all (nntp_store, top, flags, online, error);
 
 	return first;
 }
 
 static CamelFolderInfo *
-nntp_get_folder_info_online (CamelStore *store, const gchar *top, guint32 flags, CamelException *ex)
+nntp_get_folder_info_online (CamelStore *store, const gchar *top, guint32 flags, GError **error)
 {
-	return nntp_get_folder_info (store, top, flags, TRUE, ex);
+	return nntp_get_folder_info (store, top, flags, TRUE, error);
 }
 
 static CamelFolderInfo *
-nntp_get_folder_info_offline(CamelStore *store, const gchar *top, guint32 flags, CamelException *ex)
+nntp_get_folder_info_offline(CamelStore *store, const gchar *top, guint32 flags, GError **error)
 {
-	return nntp_get_folder_info (store, top, flags, FALSE, ex);
+	return nntp_get_folder_info (store, top, flags, FALSE, error);
 }
 
 static gboolean
@@ -1033,7 +1026,7 @@ nntp_store_folder_is_subscribed (CamelStore *store, const gchar *folder_name)
 
 static gboolean
 nntp_store_subscribe_folder (CamelStore *store, const gchar *folder_name,
-			     CamelException *ex)
+			     GError **error)
 {
 	CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE(store);
 	CamelStoreInfo *si;
@@ -1044,8 +1037,9 @@ nntp_store_subscribe_folder (CamelStore *store, const gchar *folder_name,
 
 	si = camel_store_summary_path(CAMEL_STORE_SUMMARY(nntp_store->summary), folder_name);
 	if (!si) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_FOLDER_INVALID,
+		g_set_error (
+			error, CAMEL_FOLDER_ERROR,
+			CAMEL_FOLDER_ERROR_INVALID,
 			_("You cannot subscribe to this newsgroup:\n\n"
 			  "No such newsgroup. The selected item is a "
 			  "probably a parent folder."));
@@ -1071,7 +1065,7 @@ nntp_store_subscribe_folder (CamelStore *store, const gchar *folder_name,
 
 static gboolean
 nntp_store_unsubscribe_folder (CamelStore *store, const gchar *folder_name,
-			       CamelException *ex)
+			       GError **error)
 {
 	CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE(store);
 	CamelFolderInfo *fi;
@@ -1083,8 +1077,9 @@ nntp_store_unsubscribe_folder (CamelStore *store, const gchar *folder_name,
 	fitem = camel_store_summary_path(CAMEL_STORE_SUMMARY(nntp_store->summary), folder_name);
 
 	if (!fitem) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_FOLDER_INVALID,
+		g_set_error (
+			error, CAMEL_FOLDER_ERROR,
+			CAMEL_FOLDER_ERROR_INVALID,
 			_("You cannot unsubscribe to this newsgroup:\n\n"
 			  "newsgroup does not exist!"));
 		success = FALSE;
@@ -1110,10 +1105,11 @@ nntp_store_unsubscribe_folder (CamelStore *store, const gchar *folder_name,
 
 static CamelFolderInfo *
 nntp_create_folder (CamelStore *store, const gchar *parent_name,
-                    const gchar *folder_name, CamelException *ex)
+                    const gchar *folder_name, GError **error)
 {
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_FOLDER_INVALID,
+	g_set_error (
+		error, CAMEL_FOLDER_ERROR,
+		CAMEL_FOLDER_ERROR_INVALID,
 		_("You cannot create a folder in a News store: "
 		  "subscribe instead."));
 
@@ -1121,22 +1117,24 @@ nntp_create_folder (CamelStore *store, const gchar *parent_name,
 }
 
 static gboolean
-nntp_rename_folder (CamelStore *store, const gchar *old_name, const gchar *new_name_in, CamelException *ex)
+nntp_rename_folder (CamelStore *store, const gchar *old_name, const gchar *new_name_in, GError **error)
 {
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_FOLDER_INVALID,
+	g_set_error (
+		error, CAMEL_FOLDER_ERROR,
+		CAMEL_FOLDER_ERROR_INVALID,
 		_("You cannot rename a folder in a News store."));
 
 	return FALSE;
 }
 
 static gboolean
-nntp_delete_folder (CamelStore *store, const gchar *folder_name, CamelException *ex)
+nntp_delete_folder (CamelStore *store, const gchar *folder_name, GError **error)
 {
-	nntp_store_unsubscribe_folder (store, folder_name, ex);
+	nntp_store_unsubscribe_folder (store, folder_name, NULL);
 
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_FOLDER_INVALID,
+	g_set_error (
+		error, CAMEL_FOLDER_ERROR,
+		CAMEL_FOLDER_ERROR_INVALID,
 		_("You cannot remove a folder in a News store: "
 		  "unsubscribe instead."));
 
@@ -1144,7 +1142,7 @@ nntp_delete_folder (CamelStore *store, const gchar *folder_name, CamelException
 }
 
 static gboolean
-nntp_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, CamelException *ex)
+nntp_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, GError **error)
 {
 	/* any nntp folder can be refreshed */
 	return TRUE;
@@ -1154,7 +1152,7 @@ nntp_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, CamelExceptio
 static gboolean
 nntp_construct (CamelService *service, CamelSession *session,
 		CamelProvider *provider, CamelURL *url,
-		CamelException *ex)
+		GError **error)
 {
 	CamelServiceClass *service_class;
 	CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE(service);
@@ -1163,11 +1161,11 @@ nntp_construct (CamelService *service, CamelSession *session,
 
 	/* construct the parent first */
 	service_class = CAMEL_SERVICE_CLASS (camel_nntp_store_parent_class);
-	if (!service_class->construct (service, session, provider, url, ex))
+	if (!service_class->construct (service, session, provider, url, error))
 		return FALSE;
 
 	/* find out the storage path, base url */
-	nntp_store->storage_path = camel_session_get_storage_path (session, service, ex);
+	nntp_store->storage_path = camel_session_get_storage_path (session, service, error);
 	if (!nntp_store->storage_path)
 		return FALSE;
 
@@ -1197,7 +1195,7 @@ nntp_construct (CamelService *service, CamelSession *session,
 		nntp_store->folder_hierarchy_relative = FALSE;
 
 	/* setup store-wide cache */
-	nntp_store->cache = camel_data_cache_new(nntp_store->storage_path, ex);
+	nntp_store->cache = camel_data_cache_new(nntp_store->storage_path, error);
 	if (nntp_store->cache == NULL)
 		return FALSE;
 
@@ -1264,16 +1262,17 @@ camel_nntp_store_init (CamelNNTPStore *nntp_store)
 }
 
 static gint
-camel_nntp_try_authenticate (CamelNNTPStore *store, CamelException *ex)
+camel_nntp_try_authenticate (CamelNNTPStore *store, GError **error)
 {
 	CamelService *service = (CamelService *) store;
 	CamelSession *session = camel_service_get_session (service);
 	gint ret;
 	gchar *line = NULL;
+	GError *local_error = NULL;
 
 	if (!service->url->user) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_INVALID_PARAM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Authentication requested but no username provided"));
 		return -1;
 	}
@@ -1297,7 +1296,7 @@ camel_nntp_try_authenticate (CamelNNTPStore *store, CamelException *ex)
 
 		service->url->passwd =
 			camel_session_get_password (session, service, NULL,
-						    prompt, "password", CAMEL_SESSION_PASSWORD_SECRET | (store->password_reprompt ? CAMEL_SESSION_PASSWORD_REPROMPT : 0), ex);
+						    prompt, "password", CAMEL_SESSION_PASSWORD_SECRET | (store->password_reprompt ? CAMEL_SESSION_PASSWORD_REPROMPT : 0), error);
 		g_free(prompt);
 		g_free(base);
 
@@ -1308,15 +1307,17 @@ camel_nntp_try_authenticate (CamelNNTPStore *store, CamelException *ex)
 	}
 
 	/* now, send auth info (currently, only authinfo user/pass is supported) */
-	ret = camel_nntp_raw_command(store, ex, &line, "authinfo user %s", service->url->user);
+	ret = camel_nntp_raw_command(store, &local_error, &line, "authinfo user %s", service->url->user);
 	if (ret == NNTP_AUTH_CONTINUE)
-		ret = camel_nntp_raw_command(store, ex, &line, "authinfo pass %s", service->url->passwd);
+		ret = camel_nntp_raw_command(store, &local_error, &line, "authinfo pass %s", service->url->passwd);
 
 	if (ret != NNTP_AUTH_ACCEPTED) {
 		if (ret != -1) {
-			if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL ||
-			    camel_exception_get_id (ex) == CAMEL_EXCEPTION_SERVICE_UNAVAILABLE)
+			if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ||
+			    g_error_matches (local_error, CAMEL_SERVICE_ERROR, CAMEL_SERVICE_ERROR_UNAVAILABLE)) {
+				g_propagate_error (error, local_error);
 				return ret;
+			}
 
 			/* To force password reprompt */
 			store->password_reprompt = TRUE;
@@ -1332,7 +1333,7 @@ camel_nntp_try_authenticate (CamelNNTPStore *store, CamelException *ex)
 
 /* Enter owning lock */
 gint
-camel_nntp_raw_commandv (CamelNNTPStore *store, CamelException *ex, gchar **line, const gchar *fmt, va_list ap)
+camel_nntp_raw_commandv (CamelNNTPStore *store, GError **error, gchar **line, const gchar *fmt, va_list ap)
 {
 	GByteArray *byte_array;
 	const guchar *p, *ps;
@@ -1352,12 +1353,12 @@ camel_nntp_raw_commandv (CamelNNTPStore *store, CamelException *ex, gchar **line
 		switch (c) {
 		case '%':
 			c = *p++;
-			camel_stream_write ((CamelStream *) store->mem, (const gchar *) ps, p - ps - (c == '%' ? 1 : 2));
+			camel_stream_write ((CamelStream *) store->mem, (const gchar *) ps, p - ps - (c == '%' ? 1 : 2), NULL);
 			ps = p;
 			switch (c) {
 			case 's':
 				s = va_arg(ap, gchar *);
-				camel_stream_write((CamelStream *)store->mem, s, strlen(s));
+				camel_stream_write((CamelStream *)store->mem, s, strlen(s), NULL);
 				break;
 			case 'd':
 				d = va_arg(ap, gint);
@@ -1386,19 +1387,19 @@ camel_nntp_raw_commandv (CamelNNTPStore *store, CamelException *ex, gchar **line
 		}
 	}
 
-	camel_stream_write ((CamelStream *) store->mem, (const gchar *) ps, p-ps-1);
-	camel_stream_write ((CamelStream *) store->mem, "\r\n", 2);
+	camel_stream_write ((CamelStream *) store->mem, (const gchar *) ps, p-ps-1, NULL);
+	camel_stream_write ((CamelStream *) store->mem, "\r\n", 2, NULL);
 
 	byte_array = camel_stream_mem_get_byte_array (store->mem);
 
-	if (camel_stream_write((CamelStream *) store->stream, (const gchar *) byte_array->data, byte_array->len) == -1)
+	if (camel_stream_write((CamelStream *) store->stream, (const gchar *) byte_array->data, byte_array->len, error) == -1)
 		goto ioerror;
 
 	/* FIXME: hack */
-	camel_stream_reset ((CamelStream *) store->mem);
+	camel_stream_reset ((CamelStream *) store->mem, NULL);
 	g_byte_array_set_size (byte_array, 0);
 
-	if (camel_nntp_stream_line (store->stream, (guchar **) line, &u) == -1)
+	if (camel_nntp_stream_line (store->stream, (guchar **) line, &u, error) == -1)
 		goto ioerror;
 
 	u = strtoul (*line, NULL, 10);
@@ -1410,25 +1411,18 @@ camel_nntp_raw_commandv (CamelNNTPStore *store, CamelException *ex, gchar **line
 	return u;
 
 ioerror:
-	if (errno == EINTR)
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_USER_CANCEL,
-			_("User cancelled the operation"));
-	else
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("NNTP Command failed: %s"), g_strerror(errno));
+	g_prefix_error (error, _("NNTP Command failed: "));
 	return -1;
 }
 
 gint
-camel_nntp_raw_command(CamelNNTPStore *store, CamelException *ex, gchar **line, const gchar *fmt, ...)
+camel_nntp_raw_command(CamelNNTPStore *store, GError **error, gchar **line, const gchar *fmt, ...)
 {
 	gint ret;
 	va_list ap;
 
 	va_start(ap, fmt);
-	ret = camel_nntp_raw_commandv(store, ex, line, fmt, ap);
+	ret = camel_nntp_raw_commandv(store, error, line, fmt, ap);
 	va_end(ap);
 
 	return ret;
@@ -1436,7 +1430,7 @@ camel_nntp_raw_command(CamelNNTPStore *store, CamelException *ex, gchar **line,
 
 /* use this where you also need auth to be handled, i.e. most cases where you'd try raw command */
 gint
-camel_nntp_raw_command_auth(CamelNNTPStore *store, CamelException *ex, gchar **line, const gchar *fmt, ...)
+camel_nntp_raw_command_auth(CamelNNTPStore *store, GError **error, gchar **line, const gchar *fmt, ...)
 {
 	gint ret, retry, go;
 	va_list ap;
@@ -1448,11 +1442,11 @@ camel_nntp_raw_command_auth(CamelNNTPStore *store, CamelException *ex, gchar **l
 		retry++;
 
 		va_start(ap, fmt);
-		ret = camel_nntp_raw_commandv(store, ex, line, fmt, ap);
+		ret = camel_nntp_raw_commandv(store, error, line, fmt, ap);
 		va_end(ap);
 
 		if (ret == NNTP_AUTH_REQUIRED) {
-			if (camel_nntp_try_authenticate(store, ex) != NNTP_AUTH_ACCEPTED)
+			if (camel_nntp_try_authenticate(store, error) != NNTP_AUTH_ACCEPTED)
 				return -1;
 			go = TRUE;
 		}
@@ -1462,17 +1456,19 @@ camel_nntp_raw_command_auth(CamelNNTPStore *store, CamelException *ex, gchar **l
 }
 
 gint
-camel_nntp_command (CamelNNTPStore *store, CamelException *ex, CamelNNTPFolder *folder, gchar **line, const gchar *fmt, ...)
+camel_nntp_command (CamelNNTPStore *store, GError **error, CamelNNTPFolder *folder, gchar **line, const gchar *fmt, ...)
 {
 	const gchar *full_name = NULL;
 	const guchar *p;
 	va_list ap;
 	gint ret, retry;
 	guint u;
+	GError *local_error = NULL;
 
 	if (((CamelDiscoStore *)store)->status == CAMEL_DISCO_STORE_OFFLINE) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_NOT_CONNECTED,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_NOT_CONNECTED,
 			_("Not connected."));
 		return -1;
 	}
@@ -1485,7 +1481,7 @@ camel_nntp_command (CamelNNTPStore *store, CamelException *ex, CamelNNTPFolder *
 		retry ++;
 
 		if (store->stream == NULL
-		    && !camel_service_connect (CAMEL_SERVICE (store), ex))
+		    && !camel_service_connect (CAMEL_SERVICE (store), error))
 			return -1;
 
 		/* Check for unprocessed data, !*/
@@ -1498,12 +1494,11 @@ camel_nntp_command (CamelNNTPStore *store, CamelException *ex, CamelNNTPFolder *
 
 		if (folder != NULL
 		    && (store->current_folder == NULL || strcmp(store->current_folder, full_name) != 0)) {
-			ret = camel_nntp_raw_command_auth(store, ex, line, "group %s", full_name);
+			ret = camel_nntp_raw_command_auth(store, &local_error, line, "group %s", full_name);
 			if (ret == 211) {
 				g_free(store->current_folder);
 				store->current_folder = g_strdup (full_name);
-				camel_nntp_folder_selected(folder, *line, ex);
-				if (camel_exception_is_set(ex)) {
+				if (!camel_nntp_folder_selected(folder, *line, &local_error)) {
 					ret = -1;
 					goto error;
 				}
@@ -1517,20 +1512,21 @@ camel_nntp_command (CamelNNTPStore *store, CamelException *ex, CamelNNTPFolder *
 			return 0;
 
 		va_start(ap, fmt);
-		ret = camel_nntp_raw_commandv(store, ex, line, fmt, ap);
+		ret = camel_nntp_raw_commandv(store, &local_error, line, fmt, ap);
 		va_end(ap);
 	error:
 		switch (ret) {
 		case NNTP_AUTH_REQUIRED:
-			if (camel_nntp_try_authenticate(store, ex) != NNTP_AUTH_ACCEPTED)
+			if (camel_nntp_try_authenticate(store, error) != NNTP_AUTH_ACCEPTED)
 				return -1;
 			retry--;
 			ret = -1;
 			continue;
 		case 411:	/* no such group */
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_FOLDER_INVALID,
-				_("No such folder: %s"), line);
+			g_set_error (
+				error, CAMEL_FOLDER_ERROR,
+				CAMEL_FOLDER_ERROR_INVALID,
+				_("No such folder: %s"), *line);
 			return -1;
 		case 400:	/* service discontinued */
 		case 401:	/* wrong client state - this should quit but this is what the old code did */
@@ -1540,9 +1536,11 @@ camel_nntp_command (CamelNNTPStore *store, CamelException *ex, CamelNNTPFolder *
 			continue;
 		case -1:	/* i/o error */
 			camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
-			if (camel_exception_get_id(ex) == CAMEL_EXCEPTION_USER_CANCEL || retry >= 3)
+			if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED) || retry >= 3) {
+				g_propagate_error (error, local_error);
 				return -1;
-			camel_exception_clear(ex);
+			}
+			g_clear_error (&local_error);
 			break;
 		}
 	} while (ret == -1 && retry < 3);
diff --git a/camel/providers/nntp/camel-nntp-store.h b/camel/providers/nntp/camel-nntp-store.h
index 95bede9..3f0de8d 100644
--- a/camel/providers/nntp/camel-nntp-store.h
+++ b/camel/providers/nntp/camel-nntp-store.h
@@ -59,7 +59,6 @@
 G_BEGIN_DECLS
 
 struct _CamelNNTPFolder;
-struct _CamelException;
 
 typedef struct _CamelNNTPStore CamelNNTPStore;
 typedef struct _CamelNNTPStoreClass CamelNNTPStoreClass;
@@ -110,10 +109,10 @@ struct _CamelNNTPStoreClass {
 
 GType camel_nntp_store_get_type (void);
 
-gint camel_nntp_raw_commandv (CamelNNTPStore *store, struct _CamelException *ex, gchar **line, const gchar *fmt, va_list ap);
-gint camel_nntp_raw_command(CamelNNTPStore *store, struct _CamelException *ex, gchar **line, const gchar *fmt, ...);
-gint camel_nntp_raw_command_auth(CamelNNTPStore *store, struct _CamelException *ex, gchar **line, const gchar *fmt, ...);
-gint camel_nntp_command (CamelNNTPStore *store, struct _CamelException *ex, struct _CamelNNTPFolder *folder, gchar **line, const gchar *fmt, ...);
+gint camel_nntp_raw_commandv (CamelNNTPStore *store, struct _GError **error, gchar **line, const gchar *fmt, va_list ap);
+gint camel_nntp_raw_command(CamelNNTPStore *store, struct _GError **error, gchar **line, const gchar *fmt, ...);
+gint camel_nntp_raw_command_auth(CamelNNTPStore *store, struct _GError **error, gchar **line, const gchar *fmt, ...);
+gint camel_nntp_command (CamelNNTPStore *store, struct _GError **error, struct _CamelNNTPFolder *folder, gchar **line, const gchar *fmt, ...);
 
 G_END_DECLS
 
diff --git a/camel/providers/nntp/camel-nntp-stream.c b/camel/providers/nntp/camel-nntp-stream.c
index c90ecf8..33d6605 100644
--- a/camel/providers/nntp/camel-nntp-stream.c
+++ b/camel/providers/nntp/camel-nntp-stream.c
@@ -27,6 +27,7 @@
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>
+#include <glib/gi18n-lib.h>
 
 #include "camel-nntp-stream.h"
 
@@ -68,7 +69,8 @@ nntp_stream_finalize (GObject *object)
 }
 
 static gint
-nntp_stream_fill (CamelNNTPStream *is)
+nntp_stream_fill (CamelNNTPStream *is,
+                  GError **error)
 {
 	gint left = 0;
 
@@ -77,14 +79,21 @@ nntp_stream_fill (CamelNNTPStream *is)
 		memcpy (is->buf, is->ptr, left);
 		is->end = is->buf + left;
 		is->ptr = is->buf;
-		left = camel_stream_read (is->source, (gchar *) is->end, CAMEL_NNTP_STREAM_SIZE - (is->end - is->buf));
+		left = camel_stream_read (
+			is->source, (gchar *) is->end,
+			CAMEL_NNTP_STREAM_SIZE - (is->end - is->buf), error);
 		if (left > 0) {
 			is->end += left;
 			is->end[0] = '\n';
 			return is->end - is->ptr;
 		} else {
-			if (left == 0)
+			if (left == 0) {
 				errno = ECONNRESET;
+				g_set_error (
+					error, G_IO_ERROR,
+					g_io_error_from_errno (errno),
+					"%s", g_strerror (errno));
+			}
 			dd (printf ("NNTP_STREAM_FILL (ERROR): %d - '%s'\n", left, g_strerror (errno)));
 			return -1;
 		}
@@ -96,7 +105,8 @@ nntp_stream_fill (CamelNNTPStream *is)
 static gssize
 nntp_stream_read (CamelStream *stream,
                   gchar *buffer,
-                  gsize n)
+                  gsize n,
+                  GError **error)
 {
 	CamelNNTPStream *is = (CamelNNTPStream *)stream;
 	gchar *o, *oe;
@@ -119,7 +129,7 @@ nntp_stream_read (CamelStream *stream,
 	case 0:		/* start of line, always read at least 3 chars */
 		while (e - p < 3) {
 			is->ptr = p;
-			if (nntp_stream_fill (is) == -1)
+			if (nntp_stream_fill (is, error) == -1)
 				return -1;
 			p = is->ptr;
 			e = is->end;
@@ -143,7 +153,7 @@ nntp_stream_read (CamelStream *stream,
 				/* end of input sentinal check */
 				if (p > e) {
 					is->ptr = e;
-					if (nntp_stream_fill (is) == -1)
+					if (nntp_stream_fill (is, error) == -1)
 						return -1;
 					p = is->ptr;
 					e = is->end;
@@ -170,22 +180,25 @@ nntp_stream_read (CamelStream *stream,
 static gssize
 nntp_stream_write (CamelStream *stream,
                    const gchar *buffer,
-                   gsize n)
+                   gsize n,
+                   GError **error)
 {
 	CamelNNTPStream *is = (CamelNNTPStream *)stream;
 
-	return camel_stream_write (is->source, buffer, n);
+	return camel_stream_write (is->source, buffer, n, error);
 }
 
 static gint
-nntp_stream_close (CamelStream *stream)
+nntp_stream_close (CamelStream *stream,
+                   GError **error)
 {
 	/* nop? */
 	return 0;
 }
 
 static gint
-nntp_stream_flush (CamelStream *stream)
+nntp_stream_flush (CamelStream *stream,
+                   GError **error)
 {
 	/* nop? */
 	return 0;
@@ -200,7 +213,8 @@ nntp_stream_eos (CamelStream *stream)
 }
 
 static gint
-nntp_stream_reset (CamelStream *stream)
+nntp_stream_reset (CamelStream *stream,
+                   GError **error)
 {
 	/* nop?  reset literal mode? */
 	return 0;
@@ -263,7 +277,8 @@ camel_nntp_stream_new (CamelStream *source)
 gint
 camel_nntp_stream_line (CamelNNTPStream *is,
                         guchar **data,
-                        guint *len)
+                        guint *len,
+                        GError **error)
 {
 	register guchar c, *p, *o, *oe;
 	gint newlen, oldlen;
@@ -285,7 +300,7 @@ camel_nntp_stream_line (CamelNNTPStream *is,
 		/* need at least 3 chars in buffer */
 		while (e-p < 3) {
 			is->ptr = p;
-			if (nntp_stream_fill (is) == -1)
+			if (nntp_stream_fill (is, error) == -1)
 				return -1;
 			p = is->ptr;
 			e = is->end;
@@ -315,7 +330,7 @@ camel_nntp_stream_line (CamelNNTPStream *is,
 				/* sentinal? */
 				if (p> e) {
 					is->ptr = e;
-					if (nntp_stream_fill (is) == -1)
+					if (nntp_stream_fill (is, error) == -1)
 						return -1;
 					p = is->ptr;
 					e = is->end;
@@ -342,8 +357,6 @@ camel_nntp_stream_line (CamelNNTPStream *is,
 		oe = is->lineend - 1;
 		o = is->linebuf + oldlen;
 	}
-
-	return -1;
 }
 
 /* returns -1 on error, 0 if last lot of data, >0 if more remaining */
@@ -359,7 +372,7 @@ camel_nntp_stream_gets (CamelNNTPStream *is,
 
 	max = is->end - is->ptr;
 	if (max == 0) {
-		max = nntp_stream_fill (is);
+		max = nntp_stream_fill (is, NULL);
 		if (max <= 0)
 			return max;
 	}
@@ -409,7 +422,7 @@ camel_nntp_stream_getd (CamelNNTPStream *is,
 
 	while (e - p < 3) {
 		is->ptr = p;
-		if (nntp_stream_fill (is) == -1)
+		if (nntp_stream_fill (is, NULL) == -1)
 			return -1;
 		p = is->ptr;
 		e = is->end;
diff --git a/camel/providers/nntp/camel-nntp-stream.h b/camel/providers/nntp/camel-nntp-stream.h
index f4375d4..6675243 100644
--- a/camel/providers/nntp/camel-nntp-stream.h
+++ b/camel/providers/nntp/camel-nntp-stream.h
@@ -77,7 +77,8 @@ void		camel_nntp_stream_set_mode	(CamelNNTPStream *is,
 						 camel_nntp_stream_mode_t mode);
 gint		camel_nntp_stream_line		(CamelNNTPStream *is,
 						 guchar **data,
-						 guint *len);
+						 guint *len,
+						 GError **error);
 gint		camel_nntp_stream_gets		(CamelNNTPStream *is,
 						 guchar **start,
 						 guint *len);
diff --git a/camel/providers/nntp/camel-nntp-summary.c b/camel/providers/nntp/camel-nntp-summary.c
index 6012e48..815a42e 100644
--- a/camel/providers/nntp/camel-nntp-summary.c
+++ b/camel/providers/nntp/camel-nntp-summary.c
@@ -64,7 +64,7 @@ static CamelMessageInfo * message_info_new_from_header (CamelFolderSummary *, st
 static gint summary_header_load (CamelFolderSummary *, FILE *);
 static gint summary_header_save (CamelFolderSummary *, FILE *);
 static gint summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir);
-static CamelFIRecord * summary_header_to_db (CamelFolderSummary *s, CamelException *ex);
+static CamelFIRecord * summary_header_to_db (CamelFolderSummary *s, GError **error);
 
 G_DEFINE_TYPE (CamelNNTPSummary, camel_nntp_summary, CAMEL_TYPE_FOLDER_SUMMARY)
 
@@ -189,12 +189,12 @@ summary_header_load (CamelFolderSummary *s, FILE *in)
 }
 
 static CamelFIRecord *
-summary_header_to_db (CamelFolderSummary *s, CamelException *ex)
+summary_header_to_db (CamelFolderSummary *s, GError **error)
 {
 	CamelNNTPSummary *cns = CAMEL_NNTP_SUMMARY (s);
 	struct _CamelFIRecord *fir;
 
-	fir = CAMEL_FOLDER_SUMMARY_CLASS (camel_nntp_summary_parent_class)->summary_header_to_db (s, ex);
+	fir = CAMEL_FOLDER_SUMMARY_CLASS (camel_nntp_summary_parent_class)->summary_header_to_db (s, error);
 	if (!fir)
 		return NULL;
 	fir->bdata = g_strdup_printf ("%d %d %d", CAMEL_NNTP_SUMMARY_VERSION, cns->high, cns->low);
@@ -220,7 +220,7 @@ summary_header_save (CamelFolderSummary *s, FILE *out)
 
 /* Note: This will be called from camel_nntp_command, so only use camel_nntp_raw_command */
 static gint
-add_range_xover (CamelNNTPSummary *cns, CamelNNTPStore *store, guint high, guint low, CamelFolderChangeInfo *changes, CamelException *ex)
+add_range_xover (CamelNNTPSummary *cns, CamelNNTPStore *store, guint high, guint low, CamelFolderChangeInfo *changes, GError **error)
 {
 	CamelFolderSummary *s;
 	CamelMessageInfoBase *mi;
@@ -237,22 +237,22 @@ add_range_xover (CamelNNTPSummary *cns, CamelNNTPStore *store, guint high, guint
 
 	camel_operation_start (NULL, _("%s: Scanning new messages"), ((CamelService *)store)->url->host);
 
-	ret = camel_nntp_raw_command_auth (store, ex, &line, "over %r", low, high);
+	ret = camel_nntp_raw_command_auth (store, error, &line, "over %r", low, high);
 	if (ret != 224)
-		ret = camel_nntp_raw_command_auth (store, ex, &line, "xover %r", low, high);
+		ret = camel_nntp_raw_command_auth (store, error, &line, "xover %r", low, high);
 
 	if (ret != 224) {
 		camel_operation_end (NULL);
 		if (ret != -1)
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Unexpected server response from xover: %s"), line);
 		return -1;
 	}
 
 	count = 0;
 	total = high-low+1;
-	while ((ret = camel_nntp_stream_line (store->stream, (guchar **)&line, &len)) > 0) {
+	while ((ret = camel_nntp_stream_line (store->stream, (guchar **)&line, &len, error)) > 0) {
 		camel_operation_progress (NULL, (count * 100) / total);
 		count++;
 		n = strtoul (line, &tab, 10);
@@ -321,7 +321,7 @@ add_range_xover (CamelNNTPSummary *cns, CamelNNTPStore *store, guint high, guint
 
 /* Note: This will be called from camel_nntp_command, so only use camel_nntp_raw_command */
 static gint
-add_range_head (CamelNNTPSummary *cns, CamelNNTPStore *store, guint high, guint low, CamelFolderChangeInfo *changes, CamelException *ex)
+add_range_head (CamelNNTPSummary *cns, CamelNNTPStore *store, guint high, guint low, CamelFolderChangeInfo *changes, GError **error)
 {
 	CamelFolderSummary *s;
 	gint ret = -1;
@@ -344,15 +344,15 @@ add_range_head (CamelNNTPSummary *cns, CamelNNTPStore *store, guint high, guint
 	for (i=low;i<high+1;i++) {
 		camel_operation_progress (NULL, (count * 100) / total);
 		count++;
-		ret = camel_nntp_raw_command_auth (store, ex, &line, "head %u", i);
+		ret = camel_nntp_raw_command_auth (store, error, &line, "head %u", i);
 		/* unknown article, ignore */
 		if (ret == 423)
 			continue;
 		else if (ret == -1)
 			goto ioerror;
 		else if (ret != 221) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Unexpected server response from head: %s"),
 				line);
 			goto ioerror;
@@ -367,7 +367,7 @@ add_range_head (CamelNNTPSummary *cns, CamelNNTPStore *store, guint high, guint
 			line[1] = 0;
 			cns->priv->uid = g_strdup_printf ("%u,%s\n", n, msgid);
 			if (!GPOINTER_TO_INT (g_hash_table_lookup (summary_table, cns->priv->uid))) {
-				if (camel_mime_parser_init_with_stream (mp, (CamelStream *)store->stream) == -1)
+				if (camel_mime_parser_init_with_stream (mp, (CamelStream *)store->stream, error) == -1)
 					goto error;
 				mi = camel_folder_summary_add_from_parser (s, mp);
 				while (camel_mime_parser_step (mp, NULL, NULL) != CAMEL_MIME_PARSER_STATE_EOF)
@@ -390,13 +390,16 @@ add_range_head (CamelNNTPSummary *cns, CamelNNTPStore *store, guint high, guint
 error:
 	if (ret == -1) {
 		if (errno == EINTR)
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_USER_CANCEL,
-				_("User cancelled the operation"));
+			g_set_error (
+				error, G_IO_ERROR,
+				G_IO_ERROR_CANCELLED,
+				_("Cancelled"));
 		else
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
-				_("Operation failed: %s"), g_strerror(errno));
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
+				_("Operation failed: %s"),
+				g_strerror(errno));
 	}
 
 ioerror:
@@ -416,7 +419,7 @@ ioerror:
 /* Assumes we have the stream */
 /* Note: This will be called from camel_nntp_command, so only use camel_nntp_raw_command */
 gint
-camel_nntp_summary_check (CamelNNTPSummary *cns, CamelNNTPStore *store, gchar *line, CamelFolderChangeInfo *changes, CamelException *ex)
+camel_nntp_summary_check (CamelNNTPSummary *cns, CamelNNTPStore *store, gchar *line, CamelFolderChangeInfo *changes, GError **error)
 {
 	CamelFolderSummary *s;
 	gint ret = 0, i;
@@ -486,7 +489,7 @@ camel_nntp_summary_check (CamelNNTPSummary *cns, CamelNNTPStore *store, gchar *l
 		cns->low = f;
 	}
 
-	camel_db_delete_uids (parent_store->cdb_w, full_name, del, ex);
+	camel_db_delete_uids (parent_store->cdb_w, full_name, del, NULL);
 	g_slist_foreach (del, (GFunc) g_free, NULL);
 	g_slist_free (del);
 
@@ -495,15 +498,15 @@ camel_nntp_summary_check (CamelNNTPSummary *cns, CamelNNTPStore *store, gchar *l
 			cns->high = f-1;
 
 		if (store->xover) {
-			ret = add_range_xover (cns, store, l, cns->high+1, changes, ex);
+			ret = add_range_xover (cns, store, l, cns->high+1, changes, error);
 		} else {
-			ret = add_range_head (cns, store, l, cns->high+1, changes, ex);
+			ret = add_range_head (cns, store, l, cns->high+1, changes, error);
 		}
 	}
 
 	/* TODO: not from here */
 	camel_folder_summary_touch (s);
-	camel_folder_summary_save_to_db (s, ex);
+	camel_folder_summary_save_to_db (s, NULL);
 
 update:
 	/* update store summary if we have it */
@@ -512,7 +515,7 @@ update:
 		guint32 unread = 0;
 
 		count = camel_folder_summary_count (s);
-		camel_db_count_unread_message_info (parent_store->cdb_r, full_name, &unread, ex);
+		camel_db_count_unread_message_info (parent_store->cdb_r, full_name, &unread, NULL);
 
 		if (si->info.unread != unread
 		    || si->info.total != count
diff --git a/camel/providers/nntp/camel-nntp-summary.h b/camel/providers/nntp/camel-nntp-summary.h
index b69c735..71781ec 100644
--- a/camel/providers/nntp/camel-nntp-summary.h
+++ b/camel/providers/nntp/camel-nntp-summary.h
@@ -46,7 +46,6 @@ G_BEGIN_DECLS
 
 struct _CamelNNTPStore;
 struct _CamelFolderChangeInfo;
-struct _CamelException;
 
 typedef struct _CamelNNTPSummary CamelNNTPSummary;
 typedef struct _CamelNNTPSummaryClass CamelNNTPSummaryClass;
@@ -67,7 +66,7 @@ struct _CamelNNTPSummaryClass {
 GType	camel_nntp_summary_get_type	(void);
 CamelNNTPSummary *camel_nntp_summary_new(struct _CamelFolder *folder, const gchar *path);
 
-gint camel_nntp_summary_check(CamelNNTPSummary *cns, struct _CamelNNTPStore *store, gchar *line, struct _CamelFolderChangeInfo *changes, struct _CamelException *ex);
+gint camel_nntp_summary_check(CamelNNTPSummary *cns, struct _CamelNNTPStore *store, gchar *line, struct _CamelFolderChangeInfo *changes, struct _GError **error);
 
 G_END_DECLS
 
diff --git a/camel/providers/pop3/camel-pop3-engine.c b/camel/providers/pop3/camel-pop3-engine.c
index 408887c..ebf47d8 100644
--- a/camel/providers/pop3/camel-pop3-engine.c
+++ b/camel/providers/pop3/camel-pop3-engine.c
@@ -252,7 +252,7 @@ engine_command_queue(CamelPOP3Engine *pe, CamelPOP3Command *pc)
 	}
 
 	/* ??? */
-	if (camel_stream_write((CamelStream *)pe->stream, pc->data, strlen(pc->data)) == -1) {
+	if (camel_stream_write((CamelStream *)pe->stream, pc->data, strlen(pc->data), NULL) == -1) {
 		camel_dlist_addtail(&pe->queue, (CamelDListNode *)pc);
 		return FALSE;
 	}
@@ -333,7 +333,7 @@ camel_pop3_engine_iterate(CamelPOP3Engine *pe, CamelPOP3Command *pcwait)
 		    && pe->current != NULL)
 			break;
 
-		if (camel_stream_write((CamelStream *)pe->stream, pw->data, strlen(pw->data)) == -1)
+		if (camel_stream_write((CamelStream *)pe->stream, pw->data, strlen(pw->data), NULL) == -1)
 			goto ioerror;
 
 		camel_dlist_remove((CamelDListNode *)pw);
diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c
index ee33e01..8dc74fb 100644
--- a/camel/providers/pop3/camel-pop3-folder.c
+++ b/camel/providers/pop3/camel-pop3-folder.c
@@ -38,13 +38,13 @@
 
 #define d(x)
 
-static gboolean pop3_refresh_info (CamelFolder *folder, CamelException *ex);
-static gboolean pop3_sync (CamelFolder *folder, gboolean expunge, CamelException *ex);
+static gboolean pop3_refresh_info (CamelFolder *folder, GError **error);
+static gboolean pop3_sync (CamelFolder *folder, gboolean expunge, GError **error);
 static gint pop3_get_message_count (CamelFolder *folder);
 static GPtrArray *pop3_get_uids (CamelFolder *folder);
-static CamelMimeMessage *pop3_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex);
+static CamelMimeMessage *pop3_get_message (CamelFolder *folder, const gchar *uid, GError **error);
 static gboolean pop3_set_message_flags (CamelFolder *folder, const gchar *uid, guint32 flags, guint32 set);
-static gchar * pop3_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex);
+static gchar * pop3_get_filename (CamelFolder *folder, const gchar *uid, GError **error);
 
 G_DEFINE_TYPE (CamelPOP3Folder, camel_pop3_folder, CAMEL_TYPE_FOLDER)
 
@@ -108,7 +108,7 @@ camel_pop3_folder_init (CamelPOP3Folder *pop3_folder)
 }
 
 CamelFolder *
-camel_pop3_folder_new (CamelStore *parent, CamelException *ex)
+camel_pop3_folder_new (CamelStore *parent, GError **error)
 {
 	CamelFolder *folder;
 
@@ -120,7 +120,7 @@ camel_pop3_folder_new (CamelStore *parent, CamelException *ex)
 		"parent-store", parent, NULL);
 
 	/* mt-ok, since we dont have the folder-lock for new() */
-	if (!camel_folder_refresh_info (folder, ex)) { /* mt-ok */
+	if (!camel_folder_refresh_info (folder, error)) { /* mt-ok */
 		g_object_unref (folder);
 		folder = NULL;
 	}
@@ -148,7 +148,7 @@ cmd_builduid(CamelPOP3Engine *pe, CamelPOP3Stream *stream, gpointer data)
 
 	checksum = g_checksum_new (G_CHECKSUM_MD5);
 	mp = camel_mime_parser_new();
-	camel_mime_parser_init_with_stream(mp, (CamelStream *)stream);
+	camel_mime_parser_init_with_stream(mp, (CamelStream *)stream, NULL);
 	switch (camel_mime_parser_step(mp, NULL, NULL)) {
 	case CAMEL_MIME_PARSER_STATE_HEADER:
 	case CAMEL_MIME_PARSER_STATE_MESSAGE:
@@ -236,7 +236,7 @@ cmd_uidl(CamelPOP3Engine *pe, CamelPOP3Stream *stream, gpointer data)
 }
 
 static gboolean
-pop3_refresh_info (CamelFolder *folder, CamelException *ex)
+pop3_refresh_info (CamelFolder *folder, GError **error)
 {
 	CamelStore *parent_store;
 	CamelPOP3Store *pop3_store;
@@ -263,12 +263,14 @@ pop3_refresh_info (CamelFolder *folder, CamelException *ex)
 
 	if (i == -1) {
 		if (errno == EINTR)
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_USER_CANCEL,
-				_("User canceled"));
+			g_set_error (
+				error, G_IO_ERROR,
+				G_IO_ERROR_CANCELLED,
+				_("Cancelled"));
 		else
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Cannot get POP summary: %s"),
 				g_strerror (errno));
 		success = FALSE;
@@ -303,7 +305,7 @@ pop3_refresh_info (CamelFolder *folder, CamelException *ex)
 static gboolean
 pop3_sync (CamelFolder *folder,
            gboolean expunge,
-           CamelException *ex)
+           GError **error)
 {
 	CamelStore *parent_store;
 	CamelPOP3Folder *pop3_folder;
@@ -320,7 +322,7 @@ pop3_sync (CamelFolder *folder,
 		d(printf("%s(%d): pop3_store->delete_after = [%d], expunge=[%d]\n",
 			 __FILE__, __LINE__, pop3_store->delete_after, expunge));
 		camel_operation_start(NULL, _("Expunging old messages"));
-		camel_pop3_delete_old(folder, pop3_store->delete_after,ex);
+		camel_pop3_delete_old(folder, pop3_store->delete_after, error);
 	}
 
 	if (!expunge) {
@@ -367,7 +369,7 @@ pop3_sync (CamelFolder *folder,
 
 	camel_operation_end(NULL);
 
-	camel_pop3_store_expunge (pop3_store, ex);
+	camel_pop3_store_expunge (pop3_store, error);
 
 	return TRUE;
 }
@@ -391,12 +393,12 @@ pop3_get_message_time_from_cache (CamelFolder *folder, const gchar *uid, time_t
 	g_return_val_if_fail (pop3_store->cache != NULL, FALSE);
 
 	if ((stream = camel_data_cache_get (pop3_store->cache, "cache", uid, NULL)) != NULL
-	    && camel_stream_read (stream, buffer, 1) == 1
+	    && camel_stream_read (stream, buffer, 1, NULL) == 1
 	    && buffer[0] == '#') {
 		CamelMimeMessage *message;
 
 		message = camel_mime_message_new ();
-		if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)message, stream) == -1) {
+		if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)message, stream, NULL) == -1) {
 			g_warning (_("Cannot get message %s: %s"), uid, g_strerror (errno));
 			g_object_unref (message);
 			message = NULL;
@@ -419,7 +421,7 @@ pop3_get_message_time_from_cache (CamelFolder *folder, const gchar *uid, time_t
 gint
 camel_pop3_delete_old (CamelFolder *folder,
                        gint days_to_delete,
-                       CamelException *ex)
+                       GError **error)
 {
 	CamelStore *parent_store;
 	CamelPOP3Folder *pop3_folder;
@@ -442,7 +444,7 @@ camel_pop3_delete_old (CamelFolder *folder,
 		d(printf("%s(%d): fi->uid=[%s]\n", __FILE__, __LINE__, fi->uid));
 		if (!pop3_get_message_time_from_cache (folder, fi->uid, &message_time)) {
 			d(printf("could not get message time from cache, trying from pop3\n"));
-			message = pop3_get_message (folder, fi->uid, ex);
+			message = pop3_get_message (folder, fi->uid, error);
 			if (message) {
 				message_time = message->date + message->date_offset;
 				g_object_unref (message);
@@ -495,7 +497,7 @@ camel_pop3_delete_old (CamelFolder *folder,
 
 	camel_operation_end(NULL);
 
-	camel_pop3_store_expunge (pop3_store, ex);
+	camel_pop3_store_expunge (pop3_store, error);
 
 	return 0;
 }
@@ -511,11 +513,11 @@ cmd_tocache(CamelPOP3Engine *pe, CamelPOP3Stream *stream, gpointer data)
 
 	/* We write an '*' to the start of the stream to say its not complete yet */
 	/* This should probably be part of the cache code */
-	if ((n = camel_stream_write (fi->stream, "*", 1)) == -1)
+	if ((n = camel_stream_write (fi->stream, "*", 1, NULL)) == -1)
 		goto done;
 
-	while ((n = camel_stream_read((CamelStream *)stream, buffer, sizeof(buffer))) > 0) {
-		n = camel_stream_write(fi->stream, buffer, n);
+	while ((n = camel_stream_read((CamelStream *)stream, buffer, sizeof(buffer), NULL)) > 0) {
+		n = camel_stream_write(fi->stream, buffer, n, NULL);
 		if (n == -1)
 			break;
 
@@ -528,8 +530,8 @@ cmd_tocache(CamelPOP3Engine *pe, CamelPOP3Stream *stream, gpointer data)
 
 	/* it all worked, output a '#' to say we're a-ok */
 	if (n != -1) {
-		camel_stream_reset(fi->stream);
-		n = camel_stream_write(fi->stream, "#", 1);
+		camel_stream_reset(fi->stream, NULL);
+		n = camel_stream_write(fi->stream, "#", 1, NULL);
 	}
 done:
 	if (n == -1) {
@@ -544,7 +546,7 @@ done:
 }
 
 static gchar *
-pop3_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex)
+pop3_get_filename (CamelFolder *folder, const gchar *uid, GError **error)
 {
 	CamelStore *parent_store;
 	CamelPOP3Folder *pop3_folder;
@@ -558,8 +560,9 @@ pop3_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex)
 
 	fi = g_hash_table_lookup(pop3_folder->uids_uid, uid);
 	if (fi == NULL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+		g_set_error (
+			error, CAMEL_FOLDER_ERROR,
+			CAMEL_FOLDER_ERROR_INVALID_UID,
 			_("No message with UID %s"), uid);
 		return NULL;
 	}
@@ -568,7 +571,7 @@ pop3_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex)
 }
 
 static CamelMimeMessage *
-pop3_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
+pop3_get_message (CamelFolder *folder, const gchar *uid, GError **error)
 {
 	CamelStore *parent_store;
 	CamelMimeMessage *message = NULL;
@@ -587,8 +590,9 @@ pop3_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
 
 	fi = g_hash_table_lookup(pop3_folder->uids_uid, uid);
 	if (fi == NULL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+		g_set_error (
+			error, CAMEL_FOLDER_ERROR,
+			CAMEL_FOLDER_ERROR_INVALID_UID,
 			_("No message with UID %s"), uid);
 		return NULL;
 	}
@@ -615,12 +619,14 @@ pop3_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
 
 		if (fi->err != 0) {
 			if (fi->err == EINTR)
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_USER_CANCEL,
-					_("User canceled"));
+				g_set_error (
+					error, G_IO_ERROR,
+					G_IO_ERROR_CANCELLED,
+					_("Cancelled"));
 			else
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_SYSTEM,
+				g_set_error (
+					error, CAMEL_ERROR,
+					CAMEL_ERROR_GENERIC,
 					_("Cannot get message %s: %s"),
 					uid, g_strerror (fi->err));
 			goto fail;
@@ -630,7 +636,7 @@ pop3_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
 	/* check to see if we have safely written flag set */
 	if (pop3_store->cache == NULL
 	    || (stream = camel_data_cache_get(pop3_store->cache, "cache", fi->uid, NULL)) == NULL
-	    || camel_stream_read(stream, buffer, 1) != 1
+	    || camel_stream_read(stream, buffer, 1, NULL) != 1
 	    || buffer[0] != '#') {
 
 		/* Initiate retrieval, if disk backing fails, use a memory backing */
@@ -673,41 +679,39 @@ pop3_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
 		/* getting error code? */
 		/*g_assert (pcr->state == CAMEL_POP3_COMMAND_DATA);*/
 		camel_pop3_engine_command_free(pop3_store->engine, pcr);
-		camel_stream_reset(stream);
+		camel_stream_reset(stream, NULL);
 
 		/* Check to see we have safely written flag set */
 		if (fi->err != 0) {
 			if (fi->err == EINTR)
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_USER_CANCEL,
-					_("User canceled"));
+				g_set_error (
+					error, G_IO_ERROR,
+					G_IO_ERROR_CANCELLED,
+					_("Cancelled"));
 			else
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_SYSTEM,
+				g_set_error (
+					error, CAMEL_ERROR,
+					CAMEL_ERROR_GENERIC,
 					_("Cannot get message %s: %s"),
 					uid, g_strerror (fi->err));
 			goto done;
 		}
 
-		if (camel_stream_read(stream, buffer, 1) != 1 || buffer[0] != '#') {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
-				_("Cannot get message %s: %s"),
-				uid, _("Unknown reason"));
+		if (camel_stream_read (stream, buffer, 1, error) == -1)
+			goto done;
+
+		if (buffer[0] != '#') {
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+				_("Cannot get message %s: %s"), uid,
+				_("Unknown reason"));
 			goto done;
 		}
 	}
 
 	message = camel_mime_message_new ();
-	if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)message, stream) == -1) {
-		if (errno == EINTR)
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_USER_CANCEL, _("User canceled"));
-		else
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
-				_("Cannot get message %s: %s"),
-				uid, g_strerror (errno));
+	if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)message, stream, error) == -1) {
+		g_prefix_error (error, _("Cannot get message %s: "), uid);
 		g_object_unref (message);
 		message = NULL;
 	}
diff --git a/camel/providers/pop3/camel-pop3-folder.h b/camel/providers/pop3/camel-pop3-folder.h
index e40fe76..aba32a6 100644
--- a/camel/providers/pop3/camel-pop3-folder.h
+++ b/camel/providers/pop3/camel-pop3-folder.h
@@ -77,11 +77,11 @@ struct _CamelPOP3FolderClass {
 };
 
 /* public methods */
-CamelFolder *camel_pop3_folder_new (CamelStore *parent, CamelException *ex);
+CamelFolder *camel_pop3_folder_new (CamelStore *parent, GError **error);
 
 GType camel_pop3_folder_get_type (void);
 
-gint camel_pop3_delete_old(CamelFolder *folder, gint days_to_delete, CamelException *ex);
+gint camel_pop3_delete_old(CamelFolder *folder, gint days_to_delete, GError **error);
 
 G_END_DECLS
 
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 29d9df2..c7df3c2 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -52,18 +52,16 @@
 /* defines the length of the server error message we can display in the error dialog */
 #define POP3_ERROR_SIZE_LIMIT 60
 
-static gpointer camel_pop3_store_parent_class;
-
-static gboolean pop3_connect (CamelService *service, CamelException *ex);
-static gboolean pop3_disconnect (CamelService *service, gboolean clean, CamelException *ex);
-static GList *query_auth_types (CamelService *service, CamelException *ex);
+static gboolean pop3_connect (CamelService *service, GError **error);
+static gboolean pop3_disconnect (CamelService *service, gboolean clean, GError **error);
+static GList *query_auth_types (CamelService *service, GError **error);
 
 static CamelFolder *get_folder (CamelStore *store, const gchar *folder_name,
-				guint32 flags, CamelException *ex);
+				guint32 flags, GError **error);
 
-static CamelFolder *get_trash  (CamelStore *store, CamelException *ex);
+static CamelFolder *get_trash  (CamelStore *store, GError **error);
 
-static gboolean pop3_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, CamelException *ex);
+static gboolean pop3_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, GError **error);
 
 G_DEFINE_TYPE (CamelPOP3Store, camel_pop3_store, CAMEL_TYPE_STORE)
 
@@ -147,7 +145,7 @@ static gboolean
 connect_to_server (CamelService *service,
                    struct addrinfo *ai,
                    gint ssl_mode,
-                   CamelException *ex)
+                   GError **error)
 {
 	CamelPOP3Store *store = CAMEL_POP3_STORE (service);
 	CamelSession *session;
@@ -168,8 +166,9 @@ connect_to_server (CamelService *service,
 			tcp_stream = camel_tcp_stream_ssl_new (service->session, service->url->host, SSL_PORT_FLAGS);
 		}
 #else
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
 			_("Could not connect to %s: %s"),
 			service->url->host, _("SSL unavailable"));
 
@@ -186,24 +185,13 @@ connect_to_server (CamelService *service,
 		g_free (socks_host);
 	}
 
-	if ((ret = camel_tcp_stream_connect ((CamelTcpStream *) tcp_stream, ai)) == -1) {
-		if (errno == EINTR)
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_USER_CANCEL,
-				_("Connection canceled"));
-		else
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-				_("Could not connect to %s: %s"),
-				service->url->host, g_strerror (errno));
-
+	if (camel_tcp_stream_connect ((CamelTcpStream *) tcp_stream, ai, error) == -1) {
 		g_object_unref (tcp_stream);
-
 		return FALSE;
 	}
 
 	/* parent class connect initialization */
-	if (CAMEL_SERVICE_CLASS (camel_pop3_store_parent_class)->connect (service, ex) == FALSE) {
+	if (CAMEL_SERVICE_CLASS (camel_pop3_store_parent_class)->connect (service, error) == FALSE) {
 		g_object_unref (tcp_stream);
 		return FALSE;
 	}
@@ -215,8 +203,8 @@ connect_to_server (CamelService *service,
 		store->delete_after =  atoi(delete_days);
 
 	if (!(store->engine = camel_pop3_engine_new (tcp_stream, flags))) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Failed to read a valid greeting from POP server %s"),
 			service->url->host);
 		g_object_unref (tcp_stream);
@@ -233,8 +221,8 @@ connect_to_server (CamelService *service,
 	clean_quit = FALSE;
 
 	if (!(store->engine->capa & CAMEL_POP3_CAP_STLS)) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Failed to connect to POP server %s in secure mode: %s"),
 			service->url->host, _("STLS not supported by server"));
 		goto stls_exception;
@@ -251,8 +239,8 @@ connect_to_server (CamelService *service,
 		gchar *tmp;
 
 		tmp = get_valid_utf8_error ((gchar *) store->engine->line);
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			/* Translators: Last %s is an optional explanation beginning with ": " separator */
 			_("Failed to connect to POP server %s in secure mode%s"),
 			service->url->host, (tmp != NULL) ? tmp : "");
@@ -264,14 +252,15 @@ connect_to_server (CamelService *service,
 	ret = camel_tcp_stream_ssl_enable_ssl (CAMEL_TCP_STREAM_SSL (tcp_stream));
 
 	if (ret == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Failed to connect to POP server %s in secure mode: %s"),
 			service->url->host, _("TLS negotiations failed"));
 		goto stls_exception;
 	}
 #else
-	camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 		_("Failed to connect to POP server %s in secure mode: %s"),
 		service->url->host, _("TLS is not available in this build"));
 	goto stls_exception;
@@ -316,13 +305,14 @@ static struct {
 
 static gboolean
 connect_to_server_wrapper (CamelService *service,
-                           CamelException *ex)
+                           GError **error)
 {
 	struct addrinfo hints, *ai;
 	const gchar *ssl_mode;
 	gint mode, ret, i;
 	gchar *serv;
 	const gchar *port;
+	GError *local_error = NULL;
 
 	if ((ssl_mode = camel_url_get_param (service->url, "use_ssl"))) {
 		for (i = 0; ssl_options[i].value; i++)
@@ -346,16 +336,19 @@ connect_to_server_wrapper (CamelService *service,
 	memset (&hints, 0, sizeof (hints));
 	hints.ai_socktype = SOCK_STREAM;
 	hints.ai_family = PF_UNSPEC;
-	ai = camel_getaddrinfo(service->url->host, serv, &hints, ex);
-	if (ai == NULL && port != NULL && camel_exception_get_id(ex) != CAMEL_EXCEPTION_USER_CANCEL) {
-		camel_exception_clear (ex);
-		ai = camel_getaddrinfo(service->url->host, port, &hints, ex);
+	ai = camel_getaddrinfo(service->url->host, serv, &hints, &local_error);
+	if (ai == NULL && port != NULL &&
+		!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+		g_clear_error (&local_error);
+		ai = camel_getaddrinfo(service->url->host, port, &hints, &local_error);
 	}
 
-	if (ai == NULL)
+	if (ai == NULL) {
+		g_propagate_error (error, local_error);
 		return FALSE;
+	}
 
-	ret = connect_to_server (service, ai, mode, ex);
+	ret = connect_to_server (service, ai, mode, error);
 
 	camel_freeaddrinfo (ai);
 
@@ -367,25 +360,29 @@ extern CamelServiceAuthType camel_pop3_apop_authtype;
 
 static GList *
 query_auth_types (CamelService *service,
-                  CamelException *ex)
+                  GError **error)
 {
 	CamelServiceClass *service_class;
 	CamelPOP3Store *store = CAMEL_POP3_STORE (service);
 	GList *types = NULL;
+	GError *local_error = NULL;
 
 	/* Chain up to parent's query_auth_types() method. */
 	service_class = CAMEL_SERVICE_CLASS (camel_pop3_store_parent_class);
-	types = service_class->query_auth_types (service, ex);
+	types = service_class->query_auth_types (service, &local_error);
 
-	if (camel_exception_is_set (ex))
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
 		return NULL;
+	}
 
 	if (connect_to_server_wrapper (service, NULL)) {
 		types = g_list_concat(types, g_list_copy(store->engine->auth));
 		pop3_disconnect (service, TRUE, NULL);
 	} else {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
 			_("Could not connect to POP server %s"),
 			service->url->host);
 	}
@@ -396,14 +393,14 @@ query_auth_types (CamelService *service,
 /**
  * camel_pop3_store_expunge:
  * @store: the store
- * @ex: a CamelException
+ * @error: return location for a #GError, or %NULL
  *
  * Expunge messages from the store. This will result in the connection
  * being closed, which may cause later commands to fail if they can't
  * reconnect.
  **/
 void
-camel_pop3_store_expunge (CamelPOP3Store *store, CamelException *ex)
+camel_pop3_store_expunge (CamelPOP3Store *store, GError **error)
 {
 	CamelPOP3Command *pc;
 
@@ -412,13 +409,13 @@ camel_pop3_store_expunge (CamelPOP3Store *store, CamelException *ex)
 		;
 	camel_pop3_engine_command_free(store->engine, pc);
 
-	camel_service_disconnect (CAMEL_SERVICE (store), FALSE, ex);
+	camel_service_disconnect (CAMEL_SERVICE (store), FALSE, error);
 }
 
 static gint
 try_sasl (CamelPOP3Store *store,
           const gchar *mech,
-          CamelException *ex)
+          GError **error)
 {
 	CamelPOP3Stream *stream = store->engine->stream;
 	guchar *line, *resp;
@@ -428,8 +425,9 @@ try_sasl (CamelPOP3Store *store,
 
 	sasl = camel_sasl_new("pop", mech, (CamelService *)store);
 	if (sasl == NULL) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_URL_INVALID,
 			_("Unable to connect to POP server %s: "
 			  "No support for requested authentication mechanism."),
 			CAMEL_SERVICE (store)->url->host);
@@ -449,8 +447,9 @@ try_sasl (CamelPOP3Store *store,
 
 			tmp = get_valid_utf8_error (
 				(gchar *) store->engine->line);
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				/* Translators: Last %s is an optional explanation beginning with ": " separator */
 				_("SASL '%s' Login failed for POP server %s%s"),
 				mech, CAMEL_SERVICE (store)->url->host,
@@ -463,12 +462,14 @@ try_sasl (CamelPOP3Store *store,
 		   its a protocol error, so fail, and try reset the server */
 		if (strncmp((gchar *) line, "+ ", 2) != 0
 		    || camel_sasl_get_authenticated(sasl)
-		    || (resp = (guchar *) camel_sasl_challenge_base64(sasl, (const gchar *) line+2, ex)) == NULL) {
+		    || (resp = (guchar *) camel_sasl_challenge_base64(sasl, (const gchar *) line+2, error)) == NULL) {
 			camel_stream_printf((CamelStream *)stream, "*\r\n");
 			camel_pop3_stream_line(stream, &line, &len);
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
-				_("Cannot login to POP server %s: SASL Protocol error"),
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
+				_("Cannot login to POP server %s: "
+				  "SASL Protocol error"),
 				CAMEL_SERVICE (store)->url->host);
 			goto done;
 		}
@@ -483,15 +484,10 @@ try_sasl (CamelPOP3Store *store,
 	return 0;
 
  ioerror:
-	if (errno == EINTR) {
-		camel_exception_set (
-			ex, CAMEL_EXCEPTION_USER_CANCEL, _("Canceled"));
-	} else {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Failed to authenticate on POP server %s: %s"),
-			CAMEL_SERVICE (store)->url->host, g_strerror (errno));
-	}
+	g_prefix_error (
+		error, _("Failed to authenticate on POP server %s: "),
+		CAMEL_SERVICE (store)->url->host);
+
  done:
 	g_object_unref (sasl);
 	return -1;
@@ -501,7 +497,7 @@ static gint
 pop3_try_authenticate (CamelService *service,
                        gboolean reprompt,
                        const gchar *errmsg,
-                       CamelException *ex)
+                       GError **error)
 {
 	CamelPOP3Store *store = (CamelPOP3Store *)service;
 	CamelPOP3Command *pcu = NULL, *pcp = NULL;
@@ -529,7 +525,7 @@ pop3_try_authenticate (CamelService *service,
 
 		service->url->passwd = camel_session_get_password (
 			camel_service_get_session (service), service,
-			NULL, full_prompt, "password", flags, ex);
+			NULL, full_prompt, "password", flags, error);
 
 		g_free (base_prompt);
 		g_free (full_prompt);
@@ -550,8 +546,9 @@ pop3_try_authenticate (CamelService *service,
 			if (!isascii((gint)*d)) {
 
 				/* README for Translators: The string APOP should not be translated */
-				camel_exception_setv (
-					ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
+				g_set_error (
+					error, CAMEL_SERVICE_ERROR,
+					CAMEL_SERVICE_ERROR_URL_INVALID,
 					_("Unable to connect to POP server %s:	"
 					  "Invalid APOP ID received. Impersonation "
 					  "attack suspected. Please contact your admin."),
@@ -576,12 +573,13 @@ pop3_try_authenticate (CamelService *service,
 		while (l) {
 			auth = l->data;
 			if (strcmp(auth->authproto, service->url->authmech) == 0)
-				return try_sasl (store, service->url->authmech, ex);
+				return try_sasl (store, service->url->authmech, error);
 			l = l->next;
 		}
 
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_URL_INVALID,
 			_("Unable to connect to POP server %s: "
 			  "No support for requested authentication mechanism."),
 			CAMEL_SERVICE (store)->url->host);
@@ -593,21 +591,26 @@ pop3_try_authenticate (CamelService *service,
 
 	if (status == -1) {
 		if (errno == EINTR) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_USER_CANCEL, _("Canceled"));
+			g_set_error (
+				error, G_IO_ERROR,
+				G_IO_ERROR_CANCELLED,
+				_("Cancelled"));
 		} else {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, G_IO_ERROR,
+				g_io_error_from_errno (errno),
 				_("Unable to connect to POP server %s.\n"
 				  "Error sending password: %s"),
 				CAMEL_SERVICE (store)->url->host, errno ?
 				g_strerror (errno) : _("Unknown error"));
 		}
 	} else if (pcu && pcu->state != CAMEL_POP3_COMMAND_OK) {
-		gchar *tmp = get_valid_utf8_error ((gchar *) store->engine->line);
+		gchar *tmp;
 
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+		tmp = get_valid_utf8_error ((gchar *) store->engine->line);
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 			/* Translators: Last %s is an optional explanation beginning with ": " separator */
 			_("Unable to connect to POP server %s.\n"
 			  "Error sending username%s"),
@@ -618,8 +621,9 @@ pop3_try_authenticate (CamelService *service,
 		gchar *tmp;
 
 		tmp = get_valid_utf8_error ((gchar *) store->engine->line);
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 			/* Translators: Last %s is an optional explanation beginning with ": " separator */
 			_("Unable to connect to POP server %s.\n"
 			  "Error sending password%s"),
@@ -638,22 +642,23 @@ pop3_try_authenticate (CamelService *service,
 
 static gboolean
 pop3_connect (CamelService *service,
-              CamelException *ex)
+              GError **error)
 {
 	CamelPOP3Store *store = (CamelPOP3Store *)service;
 	gboolean reprompt = FALSE;
 	CamelSession *session;
 	gchar *errbuf = NULL;
 	gint status;
+	GError *local_error = NULL;
 
 	session = camel_service_get_session (service);
 
 	if (store->cache == NULL) {
 		gchar *root;
 
-		root = camel_session_get_storage_path (session, service, ex);
+		root = camel_session_get_storage_path (session, service, error);
 		if (root) {
-			store->cache = camel_data_cache_new (root, ex);
+			store->cache = camel_data_cache_new (root, error);
 			g_free(root);
 			if (store->cache) {
 				/* Default cache expiry - 1 week or not visited in a day */
@@ -663,20 +668,23 @@ pop3_connect (CamelService *service,
 		}
 	}
 
-	if (!connect_to_server_wrapper (service, ex))
+	if (!connect_to_server_wrapper (service, error))
 		return FALSE;
 
 	while (1) {
 		status = pop3_try_authenticate (
-			service, reprompt, errbuf, ex);
+			service, reprompt, errbuf, &local_error);
 		g_free (errbuf);
 		errbuf = NULL;
 
 		/* we only re-prompt if we failed to authenticate,
 		 * any other error and we just abort */
-		if (status == 0 && camel_exception_get_id (ex) == CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE) {
-			errbuf = g_markup_printf_escaped ("%s\n\n", camel_exception_get_description (ex));
-			camel_exception_clear (ex);
+		if (g_error_matches (local_error, CAMEL_SERVICE_ERROR, CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE)) {
+			gchar *tmp = camel_utf8_make_valid (local_error->message);
+			errbuf = g_markup_printf_escaped ("%s\n\n", tmp);
+			g_free (tmp);
+
+			g_clear_error (&local_error);
 
 			g_free (service->url->passwd);
 			service->url->passwd = NULL;
@@ -687,8 +695,9 @@ pop3_connect (CamelService *service,
 
 	g_free (errbuf);
 
-	if (status == -1 || camel_exception_is_set(ex)) {
-		camel_service_disconnect(service, TRUE, ex);
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		camel_service_disconnect(service, TRUE, NULL);
 		return FALSE;
 	}
 
@@ -703,7 +712,7 @@ pop3_connect (CamelService *service,
 static gboolean
 pop3_disconnect (CamelService *service,
                  gboolean clean,
-                 CamelException *ex)
+                 GError **error)
 {
 	CamelServiceClass *service_class;
 	CamelPOP3Store *store = CAMEL_POP3_STORE (service);
@@ -719,7 +728,7 @@ pop3_disconnect (CamelService *service,
 
 	/* Chain up to parent's disconnect() method. */
 	service_class = CAMEL_SERVICE_CLASS (camel_pop3_store_parent_class);
-	if (!service_class->disconnect (service, clean, ex))
+	if (!service_class->disconnect (service, clean, error))
 		return FALSE;
 
 	g_object_unref (store->engine);
@@ -732,27 +741,28 @@ static CamelFolder *
 get_folder (CamelStore *store,
             const gchar *folder_name,
             guint32 flags,
-            CamelException *ex)
+            GError **error)
 {
 	if (g_ascii_strcasecmp (folder_name, "inbox") != 0) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_FOLDER_INVALID,
+		g_set_error (
+			error, CAMEL_FOLDER_ERROR,
+			CAMEL_FOLDER_ERROR_INVALID,
 			_("No such folder '%s'."), folder_name);
 		return NULL;
 	}
 
-	return camel_pop3_folder_new (store, ex);
+	return camel_pop3_folder_new (store, error);
 }
 
 static CamelFolder *
-get_trash (CamelStore *store, CamelException *ex)
+get_trash (CamelStore *store, GError **error)
 {
 	/* no-op */
 	return NULL;
 }
 
 static gboolean
-pop3_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, CamelException *ex)
+pop3_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, GError **error)
 {
 	/* any pop3 folder can be refreshed */
 	return TRUE;
diff --git a/camel/providers/pop3/camel-pop3-store.h b/camel/providers/pop3/camel-pop3-store.h
index 31440d3..3b27aef 100644
--- a/camel/providers/pop3/camel-pop3-store.h
+++ b/camel/providers/pop3/camel-pop3-store.h
@@ -71,12 +71,12 @@ struct _CamelPOP3StoreClass {
 GType camel_pop3_store_get_type (void);
 
 /* public methods */
-void camel_pop3_store_expunge (CamelPOP3Store *store, CamelException *ex);
+void camel_pop3_store_expunge (CamelPOP3Store *store, GError **error);
 
 /* support functions */
 enum { CAMEL_POP3_OK, CAMEL_POP3_ERR, CAMEL_POP3_FAIL };
-gint camel_pop3_command (CamelPOP3Store *store, gchar **ret, CamelException *ex, gchar *fmt, ...);
-gchar *camel_pop3_command_get_additional_data (CamelPOP3Store *store, gint total, CamelException *ex);
+gint camel_pop3_command (CamelPOP3Store *store, gchar **ret, GError **error, gchar *fmt, ...);
+gchar *camel_pop3_command_get_additional_data (CamelPOP3Store *store, gint total, GError **error);
 
 G_END_DECLS
 
diff --git a/camel/providers/pop3/camel-pop3-stream.c b/camel/providers/pop3/camel-pop3-stream.c
index 01faeee..39ed3c5 100644
--- a/camel/providers/pop3/camel-pop3-stream.c
+++ b/camel/providers/pop3/camel-pop3-stream.c
@@ -68,7 +68,8 @@ pop3_stream_finalize (GObject *object)
 }
 
 static gint
-stream_fill (CamelPOP3Stream *is)
+stream_fill (CamelPOP3Stream *is,
+             GError **error)
 {
 	gint left = 0;
 
@@ -79,22 +80,23 @@ stream_fill (CamelPOP3Stream *is)
 		is->ptr = is->buf;
 		left = camel_stream_read (
 			is->source, (gchar *) is->end,
-			CAMEL_POP3_STREAM_SIZE - (is->end - is->buf));
+			CAMEL_POP3_STREAM_SIZE - (is->end - is->buf), error);
 		if (left > 0) {
 			is->end += left;
 			is->end[0] = '\n';
 			return is->end - is->ptr;
-		} else {
-			dd (printf ("POP3_STREAM_FILL (ERROR): '%s'\n", g_strerror (errno)));
+		} else
 			return -1;
-		}
 	}
 
 	return 0;
 }
 
 static gssize
-stream_read (CamelStream *stream, gchar *buffer, gsize n)
+stream_read (CamelStream *stream,
+             gchar *buffer,
+             gsize n,
+             GError **error)
 {
 	CamelPOP3Stream *is = (CamelPOP3Stream *)stream;
 	gchar *o, *oe;
@@ -117,7 +119,7 @@ stream_read (CamelStream *stream, gchar *buffer, gsize n)
 	case 0:		/* start of line, always read at least 3 chars */
 		while (e - p < 3) {
 			is->ptr = p;
-			if (stream_fill (is) == -1)
+			if (stream_fill (is, error) == -1)
 				return -1;
 			p = is->ptr;
 			e = is->end;
@@ -141,7 +143,7 @@ stream_read (CamelStream *stream, gchar *buffer, gsize n)
 				/* end of input sentinal check */
 				if (p > e) {
 					is->ptr = e;
-					if (stream_fill (is) == -1)
+					if (stream_fill (is, error) == -1)
 						return -1;
 					p = is->ptr;
 					e = is->end;
@@ -168,7 +170,8 @@ stream_read (CamelStream *stream, gchar *buffer, gsize n)
 static gssize
 stream_write (CamelStream *stream,
               const gchar *buffer,
-              gsize n)
+              gsize n,
+              GError **error)
 {
 	CamelPOP3Stream *is = (CamelPOP3Stream *)stream;
 
@@ -177,18 +180,20 @@ stream_write (CamelStream *stream,
 	else
 		dd (printf ("POP3_STREAM_WRITE (%d):\nPASS xxxxxxxx\n", (gint)n));
 
-	return camel_stream_write (is->source, buffer, n);
+	return camel_stream_write (is->source, buffer, n, error);
 }
 
 static gint
-stream_close (CamelStream *stream)
+stream_close (CamelStream *stream,
+              GError **error)
 {
 	/* nop? */
 	return 0;
 }
 
 static gint
-stream_flush (CamelStream *stream)
+stream_flush (CamelStream *stream,
+              GError **error)
 {
 	/* nop? */
 	return 0;
@@ -203,7 +208,8 @@ stream_eos (CamelStream *stream)
 }
 
 static gint
-stream_reset (CamelStream *stream)
+stream_reset (CamelStream *stream,
+              GError **error)
 {
 	/* nop?  reset literal mode? */
 	return 0;
@@ -286,7 +292,7 @@ camel_pop3_stream_line (CamelPOP3Stream *is, guchar **data, guint *len)
 		/* need at least 3 chars in buffer */
 		while (e-p < 3) {
 			is->ptr = p;
-			if (stream_fill (is) == -1)
+			if (stream_fill (is, NULL) == -1)
 				return -1;
 			p = is->ptr;
 			e = is->end;
@@ -316,7 +322,7 @@ camel_pop3_stream_line (CamelPOP3Stream *is, guchar **data, guint *len)
 				/* sentinal? */
 				if (p> e) {
 					is->ptr = e;
-					if (stream_fill (is) == -1)
+					if (stream_fill (is, NULL) == -1)
 						return -1;
 					p = is->ptr;
 					e = is->end;
@@ -357,7 +363,7 @@ gint camel_pop3_stream_gets (CamelPOP3Stream *is, guchar **start, guint *len)
 
 	max = is->end - is->ptr;
 	if (max == 0) {
-		max = stream_fill (is);
+		max = stream_fill (is, NULL);
 		if (max <= 0)
 			return max;
 	}
@@ -402,7 +408,7 @@ gint camel_pop3_stream_getd (CamelPOP3Stream *is, guchar **start, guint *len)
 
 	while (e - p < 3) {
 		is->ptr = p;
-		if (stream_fill (is) == -1)
+		if (stream_fill (is, NULL) == -1)
 			return -1;
 		p = is->ptr;
 		e = is->end;
diff --git a/camel/providers/sendmail/camel-sendmail-transport.c b/camel/providers/sendmail/camel-sendmail-transport.c
index 28dc6c8..d857dad 100644
--- a/camel/providers/sendmail/camel-sendmail-transport.c
+++ b/camel/providers/sendmail/camel-sendmail-transport.c
@@ -42,7 +42,7 @@ static gchar *get_name (CamelService *service, gboolean brief);
 static gboolean sendmail_send_to (CamelTransport *transport,
 				  CamelMimeMessage *message,
 				  CamelAddress *from, CamelAddress *recipients,
-				  CamelException *ex);
+				  GError **error);
 
 G_DEFINE_TYPE (CamelSendmailTransport, camel_sendmail_transport, CAMEL_TYPE_TRANSPORT)
 
@@ -69,7 +69,7 @@ sendmail_send_to (CamelTransport *transport,
                   CamelMimeMessage *message,
                   CamelAddress *from,
                   CamelAddress *recipients,
-                  CamelException *ex)
+                  GError **error)
 {
 	struct _camel_header_raw *header, *savedbcc, *n, *tail;
 	const gchar *from_addr, *addr, **argv;
@@ -93,8 +93,8 @@ sendmail_send_to (CamelTransport *transport,
 
 	for (i = 0; i < len; i++) {
 		if (!camel_internet_address_get (CAMEL_INTERNET_ADDRESS (recipients), i, NULL, &addr)) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Could not parse recipient list"));
 			g_free (argv);
 			return FALSE;
@@ -125,8 +125,9 @@ sendmail_send_to (CamelTransport *transport,
 	}
 
 	if (pipe (fd) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not create pipe to sendmail: %s: "
 			  "mail not sent"), g_strerror (errno));
 
@@ -146,8 +147,9 @@ sendmail_send_to (CamelTransport *transport,
 	pid = fork ();
 	switch (pid) {
 	case -1:
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Could not fork sendmail: %s: "
 			  "mail not sent"), g_strerror (errno));
 		close (fd[0]);
@@ -185,13 +187,11 @@ sendmail_send_to (CamelTransport *transport,
 	g_object_unref (out);
 
 	out = (CamelStream *) filter;
-	if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), out) == -1
-	    || camel_stream_close (out) == -1) {
+	if (camel_data_wrapper_write_to_stream (
+		CAMEL_DATA_WRAPPER (message), out, error) == -1
+	    || camel_stream_close (out, error) == -1) {
 		g_object_unref (CAMEL_OBJECT (out));
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
-			_("Could not send message: %s"),
-			g_strerror (errno));
+		g_prefix_error (error, _("Could not send message: "));
 
 		/* Wait for sendmail to exit. */
 		while (waitpid (pid, &wstat, 0) == -1 && errno == EINTR)
@@ -217,20 +217,20 @@ sendmail_send_to (CamelTransport *transport,
 	header->next = savedbcc;
 
 	if (!WIFEXITED (wstat)) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("sendmail exited with signal %s: mail not sent."),
 			g_strsignal (WTERMSIG (wstat)));
 		return FALSE;
 	} else if (WEXITSTATUS (wstat) != 0) {
 		if (WEXITSTATUS (wstat) == 255) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Could not execute %s: mail not sent."),
 				SENDMAIL_PATH);
 		} else {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("sendmail exited with status %d: "
 				  "mail not sent."),
 				WEXITSTATUS (wstat));
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index f60d012..5ffdf63 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -56,26 +56,25 @@ extern gint camel_verbose_debug;
 
 /* camel smtp transport class prototypes */
 static gboolean smtp_send_to (CamelTransport *transport, CamelMimeMessage *message,
-			      CamelAddress *from, CamelAddress *recipients, CamelException *ex);
+			      CamelAddress *from, CamelAddress *recipients, GError **error);
 
 /* support prototypes */
-static gboolean smtp_connect (CamelService *service, CamelException *ex);
-static gboolean smtp_disconnect (CamelService *service, gboolean clean, CamelException *ex);
+static gboolean smtp_connect (CamelService *service, GError **error);
+static gboolean smtp_disconnect (CamelService *service, gboolean clean, GError **error);
 static GHashTable *esmtp_get_authtypes (const guchar *buffer);
-static GList *query_auth_types (CamelService *service, CamelException *ex);
+static GList *query_auth_types (CamelService *service, GError **error);
 static gchar *get_name (CamelService *service, gboolean brief);
 
-static gboolean smtp_helo (CamelSmtpTransport *transport, CamelException *ex);
-static gboolean smtp_auth (CamelSmtpTransport *transport, const gchar *mech, CamelException *ex);
+static gboolean smtp_helo (CamelSmtpTransport *transport, GError **error);
+static gboolean smtp_auth (CamelSmtpTransport *transport, const gchar *mech, GError **error);
 static gboolean smtp_mail (CamelSmtpTransport *transport, const gchar *sender,
-			   gboolean has_8bit_parts, CamelException *ex);
-static gboolean smtp_rcpt (CamelSmtpTransport *transport, const gchar *recipient, CamelException *ex);
-static gboolean smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, CamelException *ex);
-static gboolean smtp_rset (CamelSmtpTransport *transport, CamelException *ex);
-static gboolean smtp_quit (CamelSmtpTransport *transport, CamelException *ex);
+			   gboolean has_8bit_parts, GError **error);
+static gboolean smtp_rcpt (CamelSmtpTransport *transport, const gchar *recipient, GError **error);
+static gboolean smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, GError **error);
+static gboolean smtp_rset (CamelSmtpTransport *transport, GError **error);
+static gboolean smtp_quit (CamelSmtpTransport *transport, GError **error);
 
-static void smtp_set_exception (CamelSmtpTransport *transport, gboolean disconnect, const gchar *respbuf,
-				const gchar *message, CamelException *ex);
+static void smtp_set_error (CamelSmtpTransport *transport, const gchar *respbuf, GError **error);
 
 G_DEFINE_TYPE (CamelSmtpTransport, camel_smtp_transport, CAMEL_TYPE_TRANSPORT)
 
@@ -186,7 +185,7 @@ static gboolean
 connect_to_server (CamelService *service,
                    struct addrinfo *ai,
                    gint ssl_mode,
-                   CamelException *ex)
+                   GError **error)
 {
 	CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service);
 	CamelSession *session;
@@ -194,9 +193,8 @@ connect_to_server (CamelService *service,
 	gint socks_port;
 	CamelStream *tcp_stream;
 	gchar *respbuf = NULL;
-	gint ret;
 
-	if (!CAMEL_SERVICE_CLASS (camel_smtp_transport_parent_class)->connect (service, ex))
+	if (!CAMEL_SERVICE_CLASS (camel_smtp_transport_parent_class)->connect (service, error))
 		return FALSE;
 
 	/* set some smtp transport defaults */
@@ -211,9 +209,11 @@ connect_to_server (CamelService *service,
 			tcp_stream = camel_tcp_stream_ssl_new (service->session, service->url->host, SSL_PORT_FLAGS);
 		}
 #else
-		camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-				      _("Could not connect to %s: %s"),
-				      service->url->host, _("SSL unavailable"));
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
+			_("Could not connect to %s: %s"),
+			service->url->host, _("SSL unavailable"));
 
 		return FALSE;
 #endif /* HAVE_SSL */
@@ -229,17 +229,8 @@ connect_to_server (CamelService *service,
 		g_free (socks_host);
 	}
 
-	if ((ret = camel_tcp_stream_connect ((CamelTcpStream *) tcp_stream, ai)) == -1) {
-		if (errno == EINTR)
-			camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
-					     _("Connection canceled"));
-		else
-			camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-					      _("Could not connect to %s: %s"),
-					      service->url->host, g_strerror (errno));
-
+	if (camel_tcp_stream_connect ((CamelTcpStream *) tcp_stream, ai, error) == -1) {
 		g_object_unref (tcp_stream);
-
 		return FALSE;
 	}
 
@@ -255,9 +246,16 @@ connect_to_server (CamelService *service,
 	do {
 		/* Check for "220" */
 		g_free (respbuf);
-		respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream));
-		if (!respbuf || strncmp (respbuf, "220", 3)) {
-			smtp_set_exception (transport, FALSE, respbuf, _("Welcome response error"), ex);
+		respbuf = camel_stream_buffer_read_line (
+			CAMEL_STREAM_BUFFER (transport->istream), error);
+		if (respbuf == NULL) {
+			g_prefix_error (error, _("Welcome response error: "));
+			transport->connected = FALSE;
+			return FALSE;
+		}
+		if (strncmp (respbuf, "220", 3)) {
+			smtp_set_error (transport, respbuf, error);
+			g_prefix_error (error, _("Welcome response error: "));
 			g_free (respbuf);
 			return FALSE;
 		}
@@ -266,15 +264,15 @@ connect_to_server (CamelService *service,
 
 	/* Try sending EHLO */
 	transport->flags |= CAMEL_SMTP_TRANSPORT_IS_ESMTP;
-	if (!smtp_helo (transport, ex)) {
+	if (!smtp_helo (transport, error)) {
 		if (!transport->connected)
 			return FALSE;
 
 		/* Fall back to HELO */
-		camel_exception_clear (ex);
+		g_clear_error (error);
 		transport->flags &= ~CAMEL_SMTP_TRANSPORT_IS_ESMTP;
 
-		if (!smtp_helo (transport, ex)) {
+		if (!smtp_helo (transport, error)) {
 			camel_service_disconnect ((CamelService *) transport, TRUE, NULL);
 
 			return FALSE;
@@ -282,7 +280,7 @@ connect_to_server (CamelService *service,
 	}
 
 	/* clear any EHLO/HELO exception and assume that any SMTP errors encountered were non-fatal */
-	camel_exception_clear (ex);
+	g_clear_error (error);
 
 	if (ssl_mode != MODE_TLS) {
 		/* we're done */
@@ -291,8 +289,8 @@ connect_to_server (CamelService *service,
 
 #ifdef HAVE_SSL
 	if (!(transport->flags & CAMEL_SMTP_TRANSPORT_STARTTLS)) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Failed to connect to SMTP server %s in secure mode: %s"),
 			service->url->host, _("STARTTLS not supported"));
 
@@ -300,11 +298,8 @@ connect_to_server (CamelService *service,
 	}
 
 	d(fprintf (stderr, "sending : STARTTLS\r\n"));
-	if (camel_stream_write (tcp_stream, "STARTTLS\r\n", 10) == -1) {
-		camel_exception_setv (
-			ex, errno == EINTR ? CAMEL_EXCEPTION_USER_CANCEL : CAMEL_EXCEPTION_SYSTEM,
-			 _("STARTTLS command failed: %s"),
-			g_strerror (errno));
+	if (camel_stream_write (tcp_stream, "STARTTLS\r\n", 10, error) == -1) {
+		g_prefix_error (error, _("STARTTLS command failed: "));
 		goto exception_cleanup;
 	}
 
@@ -313,11 +308,16 @@ connect_to_server (CamelService *service,
 	do {
 		/* Check for "220 Ready for TLS" */
 		g_free (respbuf);
-		respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream));
-		if (!respbuf || strncmp (respbuf, "220", 3) != 0) {
-			smtp_set_exception (
-				transport, FALSE, respbuf,
-				_("STARTTLS command failed"), ex);
+		respbuf = camel_stream_buffer_read_line (
+			CAMEL_STREAM_BUFFER (transport->istream), error);
+		if (respbuf == NULL) {
+			g_prefix_error (error, _("STARTTLS command failed: "));
+			transport->connected = FALSE;
+			goto exception_cleanup;
+		}
+		if (strncmp (respbuf, "220", 3) != 0) {
+			smtp_set_error (transport, respbuf, error);
+			g_prefix_error (error, _("STARTTLS command failed: "));
 			g_free (respbuf);
 			goto exception_cleanup;
 		}
@@ -325,15 +325,16 @@ connect_to_server (CamelService *service,
 
 	/* Okay, now toggle SSL/TLS mode */
 	if (camel_tcp_stream_ssl_enable_ssl (CAMEL_TCP_STREAM_SSL (tcp_stream)) == -1) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, G_IO_ERROR,
+			g_io_error_from_errno (errno),
 			_("Failed to connect to SMTP server %s in secure mode: %s"),
 			service->url->host, g_strerror (errno));
 		goto exception_cleanup;
 	}
 #else
-	camel_exception_setv (
-		ex, CAMEL_EXCEPTION_SYSTEM,
+	g_set_error (
+		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 		_("Failed to connect to SMTP server %s in secure mode: %s"),
 		service->url->host, _("SSL is not available in this build"));
 	goto exception_cleanup;
@@ -341,7 +342,7 @@ connect_to_server (CamelService *service,
 
 	/* We are supposed to re-EHLO after a successful STARTTLS to
            re-fetch any supported extensions. */
-	if (!smtp_helo (transport, ex)) {
+	if (!smtp_helo (transport, error)) {
 		camel_service_disconnect ((CamelService *) transport, TRUE, NULL);
 
 		return FALSE;
@@ -376,13 +377,14 @@ static struct {
 
 static gboolean
 connect_to_server_wrapper (CamelService *service,
-                           CamelException *ex)
+                           GError **error)
 {
 	struct addrinfo hints, *ai;
 	const gchar *ssl_mode;
 	gint mode, ret, i;
 	gchar *serv;
 	const gchar *port;
+	GError *local_error = NULL;
 
 	if ((ssl_mode = camel_url_get_param (service->url, "use_ssl"))) {
 		for (i = 0; ssl_options[i].value; i++)
@@ -406,16 +408,19 @@ connect_to_server_wrapper (CamelService *service,
 	memset (&hints, 0, sizeof (hints));
 	hints.ai_socktype = SOCK_STREAM;
 	hints.ai_family = PF_UNSPEC;
-	ai = camel_getaddrinfo(service->url->host, serv, &hints, ex);
-	if (ai == NULL && port != NULL && camel_exception_get_id(ex) != CAMEL_EXCEPTION_USER_CANCEL) {
-		camel_exception_clear (ex);
-		ai = camel_getaddrinfo(service->url->host, port, &hints, ex);
+	ai = camel_getaddrinfo(service->url->host, serv, &hints, error);
+	if (ai == NULL && port != NULL &&
+		!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+		g_clear_error (&local_error);
+		ai = camel_getaddrinfo(service->url->host, port, &hints, &local_error);
 	}
 
-	if (ai == NULL)
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
 		return FALSE;
+	}
 
-	ret = connect_to_server (service, ai, mode, ex);
+	ret = connect_to_server (service, ai, mode, error);
 
 	camel_freeaddrinfo (ai);
 
@@ -423,7 +428,7 @@ connect_to_server_wrapper (CamelService *service,
 }
 
 static gboolean
-smtp_connect (CamelService *service, CamelException *ex)
+smtp_connect (CamelService *service, GError **error)
 {
 	CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service);
 	gboolean has_authtypes;
@@ -435,7 +440,7 @@ smtp_connect (CamelService *service, CamelException *ex)
 		CamelSasl *sasl;
 
 		sasl = camel_sasl_new ("smtp", "POPB4SMTP", service);
-		chal = camel_sasl_challenge (sasl, NULL, ex);
+		chal = camel_sasl_challenge (sasl, NULL, error);
 		truth = camel_sasl_get_authenticated (sasl);
 		if (chal)
 			g_byte_array_free (chal, TRUE);
@@ -444,10 +449,10 @@ smtp_connect (CamelService *service, CamelException *ex)
 		if (!truth)
 			return FALSE;
 
-		return connect_to_server_wrapper (service, ex);
+		return connect_to_server_wrapper (service, error);
 	}
 
-	if (!connect_to_server_wrapper (service, ex))
+	if (!connect_to_server_wrapper (service, error))
 		return FALSE;
 
 	/* check to see if AUTH is required, if so...then AUTH ourselves */
@@ -460,8 +465,9 @@ smtp_connect (CamelService *service, CamelException *ex)
 		gchar *errbuf = NULL;
 
 		if (!g_hash_table_lookup (transport->authtypes, service->url->authmech)) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				_("SMTP server %s does not support "
 				  "requested authentication type %s."),
 				service->url->host, service->url->authmech);
@@ -471,8 +477,9 @@ smtp_connect (CamelService *service, CamelException *ex)
 
 		authtype = camel_sasl_authtype (service->url->authmech);
 		if (!authtype) {
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+			g_set_error (
+				error, CAMEL_SERVICE_ERROR,
+				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
 				_("No support for authentication type %s"),
 				service->url->authmech);
 			camel_service_disconnect (service, TRUE, NULL);
@@ -483,7 +490,7 @@ smtp_connect (CamelService *service, CamelException *ex)
 			/* authentication mechanism doesn't need a password,
 			   so if it fails there's nothing we can do */
 			authenticated = smtp_auth (
-				transport, authtype->authproto, ex);
+				transport, authtype->authproto, error);
 			if (!authenticated) {
 				camel_service_disconnect (service, TRUE, NULL);
 				return FALSE;
@@ -494,6 +501,8 @@ smtp_connect (CamelService *service, CamelException *ex)
 
 		/* keep trying to login until either we succeed or the user cancels */
 		while (!authenticated) {
+			GError *local_error = NULL;
+
 			if (errbuf) {
 				/* We need to un-cache the password before prompting again */
 				g_free (service->url->passwd);
@@ -514,7 +523,7 @@ smtp_connect (CamelService *service, CamelException *ex)
 
 				service->url->passwd = camel_session_get_password (
 					session, service, NULL, full_prompt,
-					"password", password_flags, ex);
+					"password", password_flags, error);
 
 				g_free (base_prompt);
 				g_free (full_prompt);
@@ -527,17 +536,18 @@ smtp_connect (CamelService *service, CamelException *ex)
 				}
 			}
 
-			authenticated = smtp_auth (transport, authtype->authproto, ex);
+			authenticated = smtp_auth (
+				transport, authtype->authproto, &local_error);
 			if (!authenticated) {
-				if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL ||
-				    camel_exception_get_id (ex) == CAMEL_EXCEPTION_SERVICE_UNAVAILABLE)
+				if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ||
+				    g_error_matches (local_error, CAMEL_SERVICE_ERROR, CAMEL_SERVICE_ERROR_UNAVAILABLE))
 					return FALSE;
 
 				errbuf = g_markup_printf_escaped (
 					_("Unable to authenticate "
 					  "to SMTP server.\n%s\n\n"),
-					camel_exception_get_description (ex));
-				camel_exception_clear (ex);
+					local_error->message);
+				g_clear_error (&local_error);
 
 				g_free (service->url->passwd);
 				service->url->passwd = NULL;
@@ -563,7 +573,7 @@ authtypes_free (gpointer key, gpointer value, gpointer data)
 static gboolean
 smtp_disconnect (CamelService *service,
                  gboolean clean,
-                 CamelException *ex)
+                 GError **error)
 {
 	CamelServiceClass *service_class;
 	CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service);
@@ -574,12 +584,12 @@ smtp_disconnect (CamelService *service,
 
 	if (transport->connected && clean) {
 		/* send the QUIT command to the SMTP server */
-		smtp_quit (transport, ex);
+		smtp_quit (transport, NULL);
 	}
 
 	/* Chain up to parent's disconnect() method. */
 	service_class = CAMEL_SERVICE_CLASS (camel_smtp_transport_parent_class);
-	if (!service_class->disconnect (service, clean, ex))
+	if (!service_class->disconnect (service, clean, error))
 		return FALSE;
 
 	if (transport->authtypes) {
@@ -643,13 +653,13 @@ esmtp_get_authtypes (const guchar *buffer)
 }
 
 static GList *
-query_auth_types (CamelService *service, CamelException *ex)
+query_auth_types (CamelService *service, GError **error)
 {
 	CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service);
 	CamelServiceAuthType *authtype;
 	GList *types, *t, *next;
 
-	if (!connect_to_server_wrapper (service, ex))
+	if (!connect_to_server_wrapper (service, error))
 		return NULL;
 
 	types = g_list_copy (service->provider->authtypes);
@@ -682,7 +692,7 @@ get_name (CamelService *service, gboolean brief)
 static gboolean
 smtp_send_to (CamelTransport *transport, CamelMimeMessage *message,
 	      CamelAddress *from, CamelAddress *recipients,
-	      CamelException *ex)
+	      GError **error)
 {
 	CamelSmtpTransport *smtp_transport = CAMEL_SMTP_TRANSPORT (transport);
 	CamelInternetAddress *cia;
@@ -691,15 +701,16 @@ smtp_send_to (CamelTransport *transport, CamelMimeMessage *message,
 	gint i, len;
 
 	if (!smtp_transport->connected) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SERVICE_NOT_CONNECTED,
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_NOT_CONNECTED,
 			_("Cannot send message: service not connected."));
 		return FALSE;
 	}
 
 	if (!camel_internet_address_get (CAMEL_INTERNET_ADDRESS (from), 0, NULL, &addr)) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot send message: sender address not valid."));
 		return FALSE;
 	}
@@ -711,15 +722,15 @@ smtp_send_to (CamelTransport *transport, CamelMimeMessage *message,
 
 	/* rfc1652 (8BITMIME) requires that you notify the ESMTP daemon that
 	   you'll be sending an 8bit mime message at "MAIL FROM:" time. */
-	if (!smtp_mail (smtp_transport, addr, has_8bit_parts, ex)) {
+	if (!smtp_mail (smtp_transport, addr, has_8bit_parts, error)) {
 		camel_operation_end (NULL);
 		return FALSE;
 	}
 
 	len = camel_address_length (recipients);
 	if (len == 0) {
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot send message: no recipients defined."));
 		camel_operation_end (NULL);
 		return FALSE;
@@ -730,8 +741,8 @@ smtp_send_to (CamelTransport *transport, CamelMimeMessage *message,
 		gchar *enc;
 
 		if (!camel_internet_address_get (cia, i, NULL, &addr)) {
-			camel_exception_set (
-				ex, CAMEL_EXCEPTION_SYSTEM,
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 				_("Cannot send message: "
 				  "one or more invalid recipients"));
 			camel_operation_end (NULL);
@@ -739,7 +750,7 @@ smtp_send_to (CamelTransport *transport, CamelMimeMessage *message,
 		}
 
 		enc = camel_internet_address_encode_address(NULL, NULL, addr);
-		if (!smtp_rcpt (smtp_transport, enc, ex)) {
+		if (!smtp_rcpt (smtp_transport, enc, error)) {
 			g_free(enc);
 			camel_operation_end (NULL);
 			return FALSE;
@@ -747,14 +758,13 @@ smtp_send_to (CamelTransport *transport, CamelMimeMessage *message,
 		g_free(enc);
 	}
 
-	if (!smtp_data (smtp_transport, message, ex)) {
+	if (!smtp_data (smtp_transport, message, error)) {
 		camel_operation_end (NULL);
 		return FALSE;
 	}
 
 	/* reset the service for our next transfer session */
-	if (!smtp_rset (smtp_transport, ex))
-		camel_exception_clear (ex);
+	smtp_rset (smtp_transport, NULL);
 
 	camel_operation_end (NULL);
 
@@ -867,22 +877,28 @@ convert_to_local (GString *str)
 }
 
 static void
-smtp_set_exception (CamelSmtpTransport *transport,
-                    gboolean disconnect,
-                    const gchar *respbuf,
-                    const gchar *message,
-                    CamelException *ex)
+smtp_set_error (CamelSmtpTransport *transport,
+                const gchar *respbuf,
+                GError **error)
 {
 	const gchar *token, *rbuf = respbuf;
 	gchar *buffer = NULL;
 	GString *string;
-	gint error;
+	gint errnum;
 
 	if (!respbuf) {
 	fake_status_code:
-		error = respbuf ? atoi (respbuf) : 0;
-		camel_exception_setv (ex, error == 0 && errno == EINTR ? CAMEL_EXCEPTION_USER_CANCEL : CAMEL_EXCEPTION_SYSTEM,
-				      "%s: %s", message, smtp_error_string (error));
+		errnum = respbuf ? atoi (respbuf) : 0;
+		if (errnum == 0 && errno == EINTR)
+			g_set_error (
+				error, G_IO_ERROR,
+				G_IO_ERROR_CANCELLED,
+				"%s", smtp_error_string (errnum));
+		else
+			g_set_error (
+				error, CAMEL_ERROR,
+				CAMEL_ERROR_GENERIC,
+				"%s", smtp_error_string (errnum));
 	} else {
 		string = g_string_new ("");
 		do {
@@ -901,7 +917,7 @@ smtp_set_exception (CamelSmtpTransport *transport,
 			if (*(rbuf + 3) == '-') {
 				g_free (buffer);
 				buffer = camel_stream_buffer_read_line (
-					CAMEL_STREAM_BUFFER (transport->istream));
+					CAMEL_STREAM_BUFFER (transport->istream), NULL);
 				g_string_append_c (string, '\n');
 			} else {
 				g_free (buffer);
@@ -921,9 +937,10 @@ smtp_set_exception (CamelSmtpTransport *transport,
 				goto fake_status_code;
 			}
 
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
-				"%s: %s", message, string->str);
+			g_set_error (
+				error, CAMEL_ERROR,
+				CAMEL_ERROR_GENERIC,
+				"%s", string->str);
 
 			g_string_free (string, TRUE);
 		} else {
@@ -932,25 +949,18 @@ smtp_set_exception (CamelSmtpTransport *transport,
 			if (!buffer)
 				goto fake_status_code;
 
-			camel_exception_setv (
-				ex, CAMEL_EXCEPTION_SYSTEM,
-				"%s: %s", message, buffer);
+			g_set_error (
+				error, CAMEL_ERROR,
+				CAMEL_ERROR_GENERIC,
+				"%s", buffer);
 
 			g_free (buffer);
 		}
 	}
-
-	if (!respbuf) {
-		/* we got disconnected */
-		if (disconnect)
-			camel_service_disconnect ((CamelService *) transport, FALSE, NULL);
-		else
-			transport->connected = FALSE;
-	}
 }
 
 static gboolean
-smtp_helo (CamelSmtpTransport *transport, CamelException *ex)
+smtp_helo (CamelSmtpTransport *transport, GError **error)
 {
 	gchar *name = NULL, *cmdbuf = NULL, *respbuf = NULL;
 	const gchar *token, *numeric = NULL;
@@ -991,10 +1001,9 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex)
 	g_free (name);
 
 	d(fprintf (stderr, "sending : %s", cmdbuf));
-	if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) {
+	if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf), error) == -1) {
 		g_free (cmdbuf);
-		camel_exception_setv (ex, errno == EINTR ? CAMEL_EXCEPTION_USER_CANCEL : CAMEL_EXCEPTION_SYSTEM,
-				      _("HELO command failed: %s"), g_strerror (errno));
+		g_prefix_error (error, _("HELO command failed: "));
 		camel_operation_end (NULL);
 
 		camel_service_disconnect ((CamelService *) transport, FALSE, NULL);
@@ -1007,11 +1016,16 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex)
 		/* Check for "250" */
 		g_free (respbuf);
 		respbuf = camel_stream_buffer_read_line (
-			CAMEL_STREAM_BUFFER (transport->istream));
-		if (!respbuf || strncmp (respbuf, "250", 3)) {
-			smtp_set_exception (
-				transport, FALSE, respbuf,
-				_("HELO command failed"), ex);
+			CAMEL_STREAM_BUFFER (transport->istream), error);
+		if (respbuf == NULL) {
+			g_prefix_error (error, _("HELO command failed: "));
+			transport->connected = FALSE;
+			camel_operation_end (NULL);
+			return FALSE;
+		}
+		if (strncmp (respbuf, "250", 3)) {
+			smtp_set_error (transport, respbuf, error);
+			g_prefix_error (error, _("HELO command failed: "));
 			camel_operation_end (NULL);
 			g_free (respbuf);
 			return FALSE;
@@ -1069,7 +1083,7 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex)
 static gboolean
 smtp_auth (CamelSmtpTransport *transport,
            const gchar *mech,
-           CamelException *ex)
+           GError **error)
 {
 	CamelService *service;
 	gchar *cmdbuf, *respbuf = NULL, *challenge;
@@ -1083,13 +1097,13 @@ smtp_auth (CamelSmtpTransport *transport,
 	sasl = camel_sasl_new ("smtp", mech, service);
 	if (!sasl) {
 		camel_operation_end (NULL);
-		camel_exception_setv (
-			ex, CAMEL_EXCEPTION_SYSTEM,
+		g_set_error (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Error creating SASL authentication object."));
 		return FALSE;
 	}
 
-	challenge = camel_sasl_challenge_base64 (sasl, NULL, ex);
+	challenge = camel_sasl_challenge_base64 (sasl, NULL, error);
 	if (challenge) {
 		auth_challenge = TRUE;
 		cmdbuf = g_strdup_printf ("AUTH %s %s\r\n", mech, challenge);
@@ -1099,29 +1113,27 @@ smtp_auth (CamelSmtpTransport *transport,
 	}
 
 	d(fprintf (stderr, "sending : %s", cmdbuf));
-	if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) {
+	if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf), error) == -1) {
 		g_free (cmdbuf);
-		camel_exception_setv (ex, errno == EINTR ? CAMEL_EXCEPTION_USER_CANCEL : CAMEL_EXCEPTION_SYSTEM,
-				      _("AUTH command failed: %s"), g_strerror (errno));
+		g_prefix_error (error, _("AUTH command failed: "));
 		goto lose;
 	}
 	g_free (cmdbuf);
 
 	respbuf = camel_stream_buffer_read_line (
-		CAMEL_STREAM_BUFFER (transport->istream));
+		CAMEL_STREAM_BUFFER (transport->istream), error);
 
 	while (!camel_sasl_get_authenticated (sasl)) {
 		if (!respbuf) {
-			camel_exception_setv (ex, errno == EINTR ? CAMEL_EXCEPTION_USER_CANCEL : CAMEL_EXCEPTION_SYSTEM,
-					      _("AUTH command failed: %s"), g_strerror (errno));
+			g_prefix_error (error, _("AUTH command failed: "));
+			transport->connected = FALSE;
 			goto lose;
 		}
 
 		/* the server challenge/response should follow a 334 code */
 		if (strncmp (respbuf, "334", 3) != 0) {
-			smtp_set_exception (
-				transport, FALSE, respbuf,
-				_("AUTH command failed"), ex);
+			smtp_set_error (transport, respbuf, error);
+			g_prefix_error (error, _("AUTH command failed: "));
 			goto lose;
 		}
 
@@ -1137,7 +1149,7 @@ smtp_auth (CamelSmtpTransport *transport,
 		/* eat whtspc */
 		for (challenge = respbuf + 4; isspace (*challenge); challenge++);
 
-		challenge = camel_sasl_challenge_base64 (sasl, challenge, ex);
+		challenge = camel_sasl_challenge_base64 (sasl, challenge, error);
 		if (challenge == NULL)
 			goto break_and_lose;
 
@@ -1147,7 +1159,7 @@ smtp_auth (CamelSmtpTransport *transport,
 		cmdbuf = g_strdup_printf ("%s\r\n", challenge);
 		g_free (challenge);
 		d(fprintf (stderr, "sending : %s", cmdbuf));
-		if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) {
+		if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf), error) == -1) {
 			g_free (cmdbuf);
 			goto lose;
 		}
@@ -1155,7 +1167,7 @@ smtp_auth (CamelSmtpTransport *transport,
 
 		/* get the server's response */
 		respbuf = camel_stream_buffer_read_line (
-			CAMEL_STREAM_BUFFER (transport->istream));
+			CAMEL_STREAM_BUFFER (transport->istream), error);
 	}
 
 	if (respbuf == NULL)
@@ -1173,8 +1185,13 @@ smtp_auth (CamelSmtpTransport *transport,
 	}
 
 	/* Catch any other errors. */
-	if (strncmp (respbuf, "235", 3) != 0)
+	if (strncmp (respbuf, "235", 3) != 0) {
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
+			_("Bad authentication response from server."));
 		goto lose;
+	}
 
 	g_object_unref (sasl);
 	camel_operation_end (NULL);
@@ -1184,17 +1201,12 @@ smtp_auth (CamelSmtpTransport *transport,
  break_and_lose:
 	/* Get the server out of "waiting for continuation data" mode. */
 	d(fprintf (stderr, "sending : *\n"));
-	camel_stream_write (transport->ostream, "*\r\n", 3);
+	camel_stream_write (transport->ostream, "*\r\n", 3, NULL);
 	respbuf = camel_stream_buffer_read_line (
-		CAMEL_STREAM_BUFFER (transport->istream));
+		CAMEL_STREAM_BUFFER (transport->istream), NULL);
 	d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
 
  lose:
-	if (!camel_exception_is_set (ex)) {
-		camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
-				     _("Bad authentication response from server.\n"));
-	}
-
 	g_object_unref (sasl);
 	camel_operation_end (NULL);
 
@@ -1204,7 +1216,7 @@ smtp_auth (CamelSmtpTransport *transport,
 }
 
 static gboolean
-smtp_mail (CamelSmtpTransport *transport, const gchar *sender, gboolean has_8bit_parts, CamelException *ex)
+smtp_mail (CamelSmtpTransport *transport, const gchar *sender, gboolean has_8bit_parts, GError **error)
 {
 	/* we gotta tell the smtp server who we are. (our email addy) */
 	gchar *cmdbuf, *respbuf = NULL;
@@ -1216,11 +1228,9 @@ smtp_mail (CamelSmtpTransport *transport, const gchar *sender, gboolean has_8bit
 
 	d(fprintf (stderr, "sending : %s", cmdbuf));
 
-	if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) {
+	if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf), error) == -1) {
 		g_free (cmdbuf);
-		camel_exception_setv (ex, errno == EINTR ? CAMEL_EXCEPTION_USER_CANCEL : CAMEL_EXCEPTION_SYSTEM,
-				      _("MAIL FROM command failed: %s: mail not sent"),
-				      g_strerror (errno));
+		g_prefix_error (error, _("MAIL FROM command failed: "));
 		camel_service_disconnect ((CamelService *) transport, FALSE, NULL);
 		return FALSE;
 	}
@@ -1230,11 +1240,16 @@ smtp_mail (CamelSmtpTransport *transport, const gchar *sender, gboolean has_8bit
 		/* Check for "250 Sender OK..." */
 		g_free (respbuf);
 		respbuf = camel_stream_buffer_read_line (
-			CAMEL_STREAM_BUFFER (transport->istream));
-		if (!respbuf || strncmp (respbuf, "250", 3)) {
-			smtp_set_exception (
-				transport, TRUE, respbuf,
-				_("MAIL FROM command failed"), ex);
+			CAMEL_STREAM_BUFFER (transport->istream), error);
+		if (respbuf == NULL) {
+			g_prefix_error (error, _("MAIL FROM command failed: "));
+			camel_service_disconnect (
+				CAMEL_SERVICE (transport), FALSE, NULL);
+			return FALSE;
+		}
+		if (strncmp (respbuf, "250", 3)) {
+			smtp_set_error (transport, respbuf, error);
+			g_prefix_error (error, _("MAIL FROM command failed: "));
 			g_free (respbuf);
 			return FALSE;
 		}
@@ -1245,7 +1260,7 @@ smtp_mail (CamelSmtpTransport *transport, const gchar *sender, gboolean has_8bit
 }
 
 static gboolean
-smtp_rcpt (CamelSmtpTransport *transport, const gchar *recipient, CamelException *ex)
+smtp_rcpt (CamelSmtpTransport *transport, const gchar *recipient, GError **error)
 {
 	/* we gotta tell the smtp server who we are going to be sending
 	 * our email to */
@@ -1255,12 +1270,9 @@ smtp_rcpt (CamelSmtpTransport *transport, const gchar *recipient, CamelException
 
 	d(fprintf (stderr, "sending : %s", cmdbuf));
 
-	if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) {
+	if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf), error) == -1) {
 		g_free (cmdbuf);
-		camel_exception_setv (ex, errno == EINTR ? CAMEL_EXCEPTION_USER_CANCEL : CAMEL_EXCEPTION_SYSTEM,
-				      _("RCPT TO command failed: %s: mail not sent"),
-				      g_strerror (errno));
-
+		g_prefix_error (error, _("RCPT TO command failed: "));
 		camel_service_disconnect ((CamelService *) transport, FALSE, NULL);
 
 		return FALSE;
@@ -1270,17 +1282,21 @@ smtp_rcpt (CamelSmtpTransport *transport, const gchar *recipient, CamelException
 	do {
 		/* Check for "250 Recipient OK..." */
 		g_free (respbuf);
-		respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream));
-
-		d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
-
-		if (!respbuf || strncmp (respbuf, "250", 3)) {
-			gchar *message;
-
-			message = g_strdup_printf (_("RCPT TO <%s> failed"), recipient);
-			smtp_set_exception (transport, TRUE, respbuf, message, ex);
-			g_free (message);
+		respbuf = camel_stream_buffer_read_line (
+			CAMEL_STREAM_BUFFER (transport->istream), error);
+		if (respbuf == NULL) {
+			g_prefix_error (
+				error, _("RCPT TO <%s> failed: "), recipient);
+			camel_service_disconnect (
+				CAMEL_SERVICE (transport), FALSE, NULL);
+			return FALSE;
+		}
+		if (strncmp (respbuf, "250", 3)) {
+			smtp_set_error (transport, respbuf, error);
+			g_prefix_error (
+				error, _("RCPT TO <%s> failed: "), recipient);
 			g_free (respbuf);
+
 			return FALSE;
 		}
 	} while (*(respbuf+3) == '-'); /* if we got "250-" then loop again */
@@ -1290,7 +1306,7 @@ smtp_rcpt (CamelSmtpTransport *transport, const gchar *recipient, CamelException
 }
 
 static gboolean
-smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, CamelException *ex)
+smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, GError **error)
 {
 	struct _camel_header_raw *header, *savedbcc, *n, *tail;
 	CamelBestencEncoding enctype = CAMEL_BESTENC_8BIT;
@@ -1314,27 +1330,28 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, CamelExcept
 
 	d(fprintf (stderr, "sending : %s", cmdbuf));
 
-	if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) {
+	if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf), error) == -1) {
 		g_free (cmdbuf);
-		camel_exception_setv (ex, errno == EINTR ? CAMEL_EXCEPTION_USER_CANCEL : CAMEL_EXCEPTION_SYSTEM,
-				      _("DATA command failed: %s: mail not sent"),
-				      g_strerror (errno));
-
+		g_prefix_error (error, _("DATA command failed: "));
 		camel_service_disconnect ((CamelService *) transport, FALSE, NULL);
 		return FALSE;
 	}
 	g_free (cmdbuf);
 
 	respbuf = camel_stream_buffer_read_line (
-		CAMEL_STREAM_BUFFER (transport->istream));
-
-	if (!respbuf || strncmp (respbuf, "354", 3) != 0) {
-		/* we should have gotten instructions on how to use the DATA command:
-		 * 354 Enter mail, end with "." on a line by itself
+		CAMEL_STREAM_BUFFER (transport->istream), error);
+	if (respbuf == NULL) {
+		g_prefix_error (error, _("DATA command failed: "));
+		camel_service_disconnect (
+			CAMEL_SERVICE (transport), FALSE, NULL);
+		return FALSE;
+	}
+	if (strncmp (respbuf, "354", 3) != 0) {
+		/* We should have gotten instructions on how to use the DATA
+		 * command: 354 Enter mail, end with "." on a line by itself
 		 */
-		smtp_set_exception (
-			transport, TRUE, respbuf,
-			_("DATA command failed"), ex);
+		smtp_set_error (transport, respbuf, error);
+		g_prefix_error (error, _("DATA command failed: "));
 		g_free (respbuf);
 		return FALSE;
 	}
@@ -1364,7 +1381,7 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, CamelExcept
 	/* find out how large the message is... */
 	null = CAMEL_STREAM_NULL (camel_stream_null_new ());
 	camel_data_wrapper_write_to_stream (
-		CAMEL_DATA_WRAPPER (message), CAMEL_STREAM (null));
+		CAMEL_DATA_WRAPPER (message), CAMEL_STREAM (null), NULL);
 
 	filtered_stream = camel_stream_filter_new (transport->ostream);
 
@@ -1385,15 +1402,13 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, CamelExcept
 
 	/* write the message */
 	ret = camel_data_wrapper_write_to_stream (
-		CAMEL_DATA_WRAPPER (message), filtered_stream);
+		CAMEL_DATA_WRAPPER (message), filtered_stream, error);
 
 	/* restore the bcc headers */
 	header->next = savedbcc;
 
 	if (ret == -1) {
-		camel_exception_setv (ex, errno == EINTR ? CAMEL_EXCEPTION_USER_CANCEL : CAMEL_EXCEPTION_SYSTEM,
-				      _("DATA command failed: %s: mail not sent"),
-				      g_strerror (errno));
+		g_prefix_error (error, _("DATA command failed: "));
 
 		g_object_unref (filtered_stream);
 
@@ -1401,18 +1416,15 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, CamelExcept
 		return FALSE;
 	}
 
-	camel_stream_flush (filtered_stream);
+	camel_stream_flush (filtered_stream, NULL);
 	g_object_unref (filtered_stream);
 
 	/* terminate the message body */
 
 	d(fprintf (stderr, "sending : \\r\\n.\\r\\n\n"));
 
-	if (camel_stream_write (transport->ostream, "\r\n.\r\n", 5) == -1) {
-		camel_exception_setv (ex, errno == EINTR ? CAMEL_EXCEPTION_USER_CANCEL : CAMEL_EXCEPTION_SYSTEM,
-				      _("DATA command failed: %s: mail not sent"),
-				      g_strerror (errno));
-
+	if (camel_stream_write (transport->ostream, "\r\n.\r\n", 5, error) == -1) {
+		g_prefix_error (error, _("DATA command failed: "));
 		camel_service_disconnect ((CamelService *) transport, FALSE, NULL);
 		return FALSE;
 	}
@@ -1421,9 +1433,16 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, CamelExcept
 		/* Check for "250 Sender OK..." */
 		g_free (respbuf);
 		respbuf = camel_stream_buffer_read_line (
-			CAMEL_STREAM_BUFFER (transport->istream));
-		if (!respbuf || strncmp (respbuf, "250", 3) != 0) {
-			smtp_set_exception (transport, TRUE, respbuf, _("DATA command failed"), ex);
+			CAMEL_STREAM_BUFFER (transport->istream), error);
+		if (respbuf == NULL) {
+			g_prefix_error (error, _("DATA command failed: "));
+			camel_service_disconnect (
+				CAMEL_SERVICE (transport), FALSE, NULL);
+			return FALSE;
+		}
+		if (strncmp (respbuf, "250", 3) != 0) {
+			smtp_set_error (transport, respbuf, error);
+			g_prefix_error (error, _("DATA command failed: "));
 			g_free (respbuf);
 			return FALSE;
 		}
@@ -1434,7 +1453,7 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, CamelExcept
 }
 
 static gboolean
-smtp_rset (CamelSmtpTransport *transport, CamelException *ex)
+smtp_rset (CamelSmtpTransport *transport, GError **error)
 {
 	/* we are going to reset the smtp server (just to be nice) */
 	gchar *cmdbuf, *respbuf = NULL;
@@ -1443,11 +1462,9 @@ smtp_rset (CamelSmtpTransport *transport, CamelException *ex)
 
 	d(fprintf (stderr, "sending : %s", cmdbuf));
 
-	if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) {
+	if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf), error) == -1) {
 		g_free (cmdbuf);
-		camel_exception_setv (ex, errno == EINTR ? CAMEL_EXCEPTION_USER_CANCEL : CAMEL_EXCEPTION_SYSTEM,
-				      _("RSET command failed: %s"), g_strerror (errno));
-
+		g_prefix_error (error, _("RSET command failed: "));
 		camel_service_disconnect ((CamelService *) transport, FALSE, NULL);
 		return FALSE;
 	}
@@ -1457,11 +1474,16 @@ smtp_rset (CamelSmtpTransport *transport, CamelException *ex)
 		/* Check for "250" */
 		g_free (respbuf);
 		respbuf = camel_stream_buffer_read_line (
-			CAMEL_STREAM_BUFFER (transport->istream));
-		if (!respbuf || strncmp (respbuf, "250", 3) != 0) {
-			smtp_set_exception (
-				transport, TRUE, respbuf,
-				_("RSET command failed"), ex);
+			CAMEL_STREAM_BUFFER (transport->istream), error);
+		if (respbuf == NULL) {
+			g_prefix_error (error, _("RSET command failed: "));
+			camel_service_disconnect (
+				CAMEL_SERVICE (transport), FALSE, NULL);
+			return FALSE;
+		}
+		if (strncmp (respbuf, "250", 3) != 0) {
+			smtp_set_error (transport, respbuf, error);
+			g_prefix_error (error, _("RSET command failed: "));
 			g_free (respbuf);
 			return FALSE;
 		}
@@ -1472,7 +1494,7 @@ smtp_rset (CamelSmtpTransport *transport, CamelException *ex)
 }
 
 static gboolean
-smtp_quit (CamelSmtpTransport *transport, CamelException *ex)
+smtp_quit (CamelSmtpTransport *transport, GError **error)
 {
 	/* we are going to reset the smtp server (just to be nice) */
 	gchar *cmdbuf, *respbuf = NULL;
@@ -1481,11 +1503,9 @@ smtp_quit (CamelSmtpTransport *transport, CamelException *ex)
 
 	d(fprintf (stderr, "sending : %s", cmdbuf));
 
-	if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) {
+	if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf), error) == -1) {
 		g_free (cmdbuf);
-		camel_exception_setv (ex, errno == EINTR ? CAMEL_EXCEPTION_USER_CANCEL : CAMEL_EXCEPTION_SYSTEM,
-				      _("QUIT command failed: %s"), g_strerror (errno));
-
+		g_prefix_error (error, _("QUIT command failed: "));
 		return FALSE;
 	}
 	g_free (cmdbuf);
@@ -1493,14 +1513,18 @@ smtp_quit (CamelSmtpTransport *transport, CamelException *ex)
 	do {
 		/* Check for "221" */
 		g_free (respbuf);
-		respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream));
+		respbuf = camel_stream_buffer_read_line (
+			CAMEL_STREAM_BUFFER (transport->istream), error);
 
 		d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
-
-		if (!respbuf || strncmp (respbuf, "221", 3) != 0) {
-			smtp_set_exception (
-				transport, FALSE, respbuf,
-				_("QUIT command failed"), ex);
+		if (respbuf == NULL) {
+			g_prefix_error (error, _("QUIT command failed: "));
+			transport->connected = FALSE;
+			return FALSE;
+		}
+		if (strncmp (respbuf, "221", 3) != 0) {
+			smtp_set_error (transport, respbuf, error);
+			g_prefix_error (error, _("QUIT command failed: "));
 			g_free (respbuf);
 			return FALSE;
 		}
diff --git a/camel/tests/folder/test1.c b/camel/tests/folder/test1.c
index 649a30b..1fce10e 100644
--- a/camel/tests/folder/test1.c
+++ b/camel/tests/folder/test1.c
@@ -18,15 +18,12 @@ static const gchar *local_providers[] = {
 gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
-	CamelException *ex;
 	gint i;
 	gchar *path;
 
 	camel_test_init(argc, argv);
 	camel_test_provider_init(1, local_drivers);
 
-	ex = camel_exception_new();
-
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
@@ -44,7 +41,6 @@ gint main(gint argc, gchar **argv)
 	}
 
 	g_object_unref (session);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test10.c b/camel/tests/folder/test10.c
index c362273..6c49db9 100644
--- a/camel/tests/folder/test10.c
+++ b/camel/tests/folder/test10.c
@@ -28,15 +28,12 @@ static gpointer
 worker(gpointer d)
 {
 	gint i;
-	CamelException *ex = camel_exception_new();
 	CamelStore *store;
 	CamelFolder *folder;
 
 	for (i=0;i<MAX_LOOP;i++) {
-		store = camel_session_get_store(session, path, ex);
-		camel_exception_clear(ex);
-		folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, ex);
-		camel_exception_clear(ex);
+		store = camel_session_get_store(session, path, NULL);
+		folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, NULL);
 		if (testid == 0) {
 			g_object_unref (folder);
 			g_object_unref (store);
@@ -46,23 +43,18 @@ worker(gpointer d)
 		}
 	}
 
-	camel_exception_free(ex);
-
 	return NULL;
 }
 
 gint
 main(gint argc, gchar **argv)
 {
-	CamelException *ex;
 	gint i, j;
 	GThread *threads[MAX_THREADS];
 
 	camel_test_init(argc, argv);
 	camel_test_provider_init(1, local_drivers);
 
-	ex = camel_exception_new();
-
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
@@ -103,7 +95,6 @@ main(gint argc, gchar **argv)
 	}
 
 	g_object_unref (session);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test11.c b/camel/tests/folder/test11.c
index 302609c..d8191a8 100644
--- a/camel/tests/folder/test11.c
+++ b/camel/tests/folder/test11.c
@@ -95,82 +95,90 @@ check_fi(CamelFolderInfo *fi, CamelFolderInfo *list, gint len)
 gint
 main(gint argc, gchar **argv)
 {
-	CamelException *ex;
 	CamelFolder *f1, *f2;
 	CamelStore *store;
 	CamelFolderInfo *fi;
+	GError *error = NULL;
 
 	camel_test_init(argc, argv);
 	camel_test_provider_init(1, local_drivers);
 
-	ex = camel_exception_new();
-
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
 	session = camel_test_session_new("/tmp/camel-test");
-	store = camel_session_get_store(session, "maildir:///tmp/camel-test/maildir", ex);
-	camel_exception_clear(ex);
+	store = camel_session_get_store(session, "maildir:///tmp/camel-test/maildir", NULL);
 
 	camel_test_start("Maildir backward compatability tests");
 
 	camel_test_push("./ prefix path, one level");
-	f1 = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
-	f2 = camel_store_get_folder(store, "./testbox", CAMEL_STORE_FOLDER_CREATE, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	f1 = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
+	f2 = camel_store_get_folder(store, "./testbox", CAMEL_STORE_FOLDER_CREATE, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 	check(f1 == f2);
 	check_unref(f2, 2);
 	check_unref(f1, 1);
 	camel_test_pull();
 
 	camel_test_push("./ prefix path, one level, no create");
-	f1 = camel_store_get_folder(store, "testbox2", CAMEL_STORE_FOLDER_CREATE, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
-	f2 = camel_store_get_folder(store, "./testbox2", 0, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	f1 = camel_store_get_folder(store, "testbox2", CAMEL_STORE_FOLDER_CREATE, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
+	f2 = camel_store_get_folder(store, "./testbox2", 0, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 	check(f1 == f2);
 	check_unref(f2, 2);
 	check_unref(f1, 1);
 	camel_test_pull();
 
 	camel_test_push("./ prefix path, two levels");
-	f1 = camel_store_get_folder(store, "testbox/foo", CAMEL_STORE_FOLDER_CREATE, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
-	f2 = camel_store_get_folder(store, "./testbox/foo", CAMEL_STORE_FOLDER_CREATE, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	f1 = camel_store_get_folder(store, "testbox/foo", CAMEL_STORE_FOLDER_CREATE, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
+	f2 = camel_store_get_folder(store, "./testbox/foo", CAMEL_STORE_FOLDER_CREATE, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 	check(f1 == f2);
 	check_unref(f2, 2);
 	check_unref(f1, 1);
 	camel_test_pull();
 
 	camel_test_push("'.' == Inbox");
-	f2 = camel_store_get_inbox(store, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
-	f1 = camel_store_get_folder(store, ".", 0, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	f2 = camel_store_get_inbox(store, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
+	f1 = camel_store_get_folder(store, ".", 0, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 	check(f1 == f2);
 	check_unref(f2, 2);
 	check_unref(f1, 1);
 	camel_test_pull();
 
 	camel_test_push("folder info, recursive");
-	fi = camel_store_get_folder_info(store, "", CAMEL_STORE_FOLDER_INFO_RECURSIVE, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	fi = camel_store_get_folder_info(store, "", CAMEL_STORE_FOLDER_INFO_RECURSIVE, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 	check(fi != NULL);
 	check_fi(fi, fi_list_1, G_N_ELEMENTS (fi_list_1));
 	camel_test_pull();
 
 	camel_test_push("folder info, flat");
-	fi = camel_store_get_folder_info(store, "", 0, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	fi = camel_store_get_folder_info(store, "", 0, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 	check(fi != NULL);
 	check_fi(fi, fi_list_2, G_N_ELEMENTS (fi_list_2));
 	camel_test_pull();
 
 	camel_test_push("folder info, recursive, non root");
-	fi = camel_store_get_folder_info(store, "testbox", CAMEL_STORE_FOLDER_INFO_RECURSIVE, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	fi = camel_store_get_folder_info(store, "testbox", CAMEL_STORE_FOLDER_INFO_RECURSIVE, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 	check(fi != NULL);
 	check_fi(fi, fi_list_3, G_N_ELEMENTS (fi_list_3));
 	camel_test_pull();
@@ -178,8 +186,6 @@ main(gint argc, gchar **argv)
 	check_unref(store, 1);
 	check_unref(session, 1);
 
-	camel_exception_free(ex);
-
 	camel_test_end();
 
 	return 0;
diff --git a/camel/tests/folder/test2.c b/camel/tests/folder/test2.c
index b57ec2d..2ca8465 100644
--- a/camel/tests/folder/test2.c
+++ b/camel/tests/folder/test2.c
@@ -21,7 +21,6 @@ static const gchar *stores[] = {
 gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
-	CamelException *ex;
 	gint i;
 
 	camel_test_init(argc, argv);
@@ -30,8 +29,6 @@ gint main(gint argc, gchar **argv)
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
-	ex = camel_exception_new();
-
 	session = camel_test_session_new ("/tmp/camel-test");
 
 	/* we iterate over all stores we want to test, with indexing or indexing turned on or off */
@@ -46,7 +43,6 @@ gint main(gint argc, gchar **argv)
 	test_folder_message_ops(session, "spool:///tmp/camel-test/testbox", TRUE, "INBOX");
 
 	check_unref(session, 1);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test3.c b/camel/tests/folder/test3.c
index d96890e..b6e7819 100644
--- a/camel/tests/folder/test3.c
+++ b/camel/tests/folder/test3.c
@@ -11,15 +11,16 @@
 static void
 test_folder_search_sub(CamelFolder *folder, const gchar *expr, gint expected)
 {
-	CamelException *ex = camel_exception_new();
 	GPtrArray *uids;
 	GHashTable *hash;
 	gint i;
+	GError *error = NULL;
 
-	uids = camel_folder_search_by_expression(folder, expr, ex);
+	uids = camel_folder_search_by_expression(folder, expr, &error);
 	check(uids != NULL);
 	check_msg(uids->len == expected, "search %s expected %d got %d", expr, expected, uids->len);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 
 	/* check the uid's are actually unique, too */
 	hash = g_hash_table_new(g_str_hash, g_str_equal);
@@ -30,8 +31,6 @@ test_folder_search_sub(CamelFolder *folder, const gchar *expr, gint expected)
 	g_hash_table_destroy(hash);
 
 	camel_folder_search_free(folder, uids);
-
-	camel_exception_free(ex);
 }
 
 static void
@@ -57,7 +56,7 @@ test_folder_search(CamelFolder *folder, const gchar *expr, gint expected)
 
 static struct {
 	gint counts[3];
-	gchar *expr;
+	const gchar *expr;
 } searches[] = {
 	{ { 1, 1, 0 }, "(header-matches \"subject\" \"Test1 message99 subject\")" },
 
@@ -140,18 +139,16 @@ gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
 	CamelStore *store;
-	CamelException *ex;
 	CamelFolder *folder;
 	CamelMimeMessage *msg;
 	gint i, j;
 	gint indexed;
 	GPtrArray *uids;
+	GError *error = NULL;
 
 	camel_test_init(argc, argv);
 	camel_test_provider_init(1, local_drivers);
 
-	ex = camel_exception_new();
-
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
@@ -171,9 +168,10 @@ gint main(gint argc, gchar **argv)
 			test_free(what);
 
 			push("getting store");
-			store = camel_session_get_store(session, stores[i], ex);
-			check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex));
+			store = camel_session_get_store(session, stores[i], &error);
+			check_msg(error == NULL, "getting store: %s", error->message);
 			check(store != NULL);
+			g_clear_error (&error);
 			pull();
 
 			push("creating %sindexed folder", indexed?"":"non-");
@@ -181,12 +179,13 @@ gint main(gint argc, gchar **argv)
 				flags = CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX;
 			else
 				flags = CAMEL_STORE_FOLDER_CREATE;
-			folder = camel_store_get_folder(store, "testbox", flags, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			folder = camel_store_get_folder(store, "testbox", flags, &error);
+			check_msg(error == NULL, "%s", error->message);
 			check(folder != NULL);
 
 			/* we need an empty folder for this to work */
 			test_folder_counts(folder, 0, 0);
+			g_clear_error (&error);
 			pull();
 
 			/* append a bunch of messages with specific content */
@@ -207,8 +206,9 @@ gint main(gint argc, gchar **argv)
 				pull();
 
 				push("appending simple message %d", j);
-				camel_folder_append_message(folder, msg, NULL, NULL, ex);
-				check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+				camel_folder_append_message(folder, msg, NULL, NULL, &error);
+				check_msg(error == NULL, "%s", error->message);
+				g_clear_error (&error);
 				pull();
 
 				test_free(subject);
@@ -248,12 +248,12 @@ gint main(gint argc, gchar **argv)
 			camel_test_fatal();
 
 			push("syncing folder, searching");
-			camel_folder_sync(folder, FALSE, ex);
+			camel_folder_sync(folder, FALSE, NULL);
 			run_search(folder, 100);
 			pull();
 
 			push("syncing wiht expunge, search");
-			camel_folder_sync(folder, TRUE, ex);
+			camel_folder_sync(folder, TRUE, NULL);
 			run_search(folder, 100);
 			pull();
 
@@ -267,24 +267,27 @@ gint main(gint argc, gchar **argv)
 			run_search(folder, 100);
 
 			push("syncing");
-			camel_folder_sync(folder, FALSE, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_folder_sync(folder, FALSE, &error);
+			check_msg(error == NULL, "%s", error->message);
 			run_search(folder, 100);
+			g_clear_error (&error);
 			pull();
 
 			push("expunging");
-			camel_folder_expunge(folder, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_folder_expunge(folder, &error);
+			check_msg(error == NULL, "%s", error->message);
 			run_search(folder, 50);
+			g_clear_error (&error);
 			pull();
 
 			pull();
 
 			push("closing and re-opening folder");
 			check_unref(folder, 1);
-			folder = camel_store_get_folder(store, "testbox", flags&~(CAMEL_STORE_FOLDER_CREATE), ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			folder = camel_store_get_folder(store, "testbox", flags&~(CAMEL_STORE_FOLDER_CREATE), &error);
+			check_msg(error == NULL, "%s", error->message);
 			check(folder != NULL);
+			g_clear_error (&error);
 
 			push("deleting remaining messages");
 			uids = camel_folder_get_uids(folder);
@@ -296,15 +299,17 @@ gint main(gint argc, gchar **argv)
 			run_search(folder, 50);
 
 			push("syncing");
-			camel_folder_sync(folder, FALSE, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_folder_sync(folder, FALSE, &error);
+			check_msg(error == NULL, "%s", error->message);
 			run_search(folder, 50);
+			g_clear_error (&error);
 			pull();
 
 			push("expunging");
-			camel_folder_expunge(folder, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_folder_expunge(folder, &error);
+			check_msg(error == NULL, "%s", error->message);
 			run_search(folder, 0);
+			g_clear_error (&error);
 			pull();
 
 			pull();
@@ -313,8 +318,9 @@ gint main(gint argc, gchar **argv)
 			pull();
 
 			push("deleting test folder, with no messages in it");
-			camel_store_delete_folder(store, "testbox", ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_store_delete_folder(store, "testbox", &error);
+			check_msg(error == NULL, "%s", error->message);
+			g_clear_error (&error);
 			pull();
 
 			check_unref(store, 1);
@@ -323,7 +329,6 @@ gint main(gint argc, gchar **argv)
 	}
 
 	check_unref(session, 1);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test4.c b/camel/tests/folder/test4.c
index 8cdfe42..f975bae 100644
--- a/camel/tests/folder/test4.c
+++ b/camel/tests/folder/test4.c
@@ -14,15 +14,12 @@ static const gchar *remote_providers[] = {
 gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
-	CamelException *ex;
 	gint i;
 	gchar *path;
 
 	camel_test_init(argc, argv);
 	camel_test_provider_init(1, imap_drivers);
 
-	ex = camel_exception_new();
-
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
@@ -45,7 +42,6 @@ gint main(gint argc, gchar **argv)
 	}
 
 	g_object_unref (session);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test5.c b/camel/tests/folder/test5.c
index db99240..3da2aa7 100644
--- a/camel/tests/folder/test5.c
+++ b/camel/tests/folder/test5.c
@@ -14,15 +14,12 @@ static const gchar *remote_providers[] = {
 gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
-	CamelException *ex;
 	gint i;
 	gchar *path;
 
 	camel_test_init(argc, argv);
 	camel_test_provider_init(1, nntp_drivers);
 
-	ex = camel_exception_new();
-
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
@@ -45,7 +42,6 @@ gint main(gint argc, gchar **argv)
 	}
 
 	g_object_unref (session);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test6.c b/camel/tests/folder/test6.c
index 3f5541c..5e8f42c 100644
--- a/camel/tests/folder/test6.c
+++ b/camel/tests/folder/test6.c
@@ -13,7 +13,6 @@ static const gchar *remote_providers[] = {
 gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
-	CamelException *ex;
 	gint i;
 	gchar *path;
 
@@ -23,8 +22,6 @@ gint main(gint argc, gchar **argv)
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
-	ex = camel_exception_new();
-
 	session = camel_test_session_new ("/tmp/camel-test");
 
 	for (i = 0; i < G_N_ELEMENTS (remote_providers); i++) {
@@ -43,7 +40,6 @@ gint main(gint argc, gchar **argv)
 	}
 
 	check_unref(session, 1);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test7.c b/camel/tests/folder/test7.c
index a705096..d1180e6 100644
--- a/camel/tests/folder/test7.c
+++ b/camel/tests/folder/test7.c
@@ -14,7 +14,6 @@ static const gchar *remote_providers[] = {
 gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
-	CamelException *ex;
 	gint i;
 	gchar *path;
 
@@ -24,8 +23,6 @@ gint main(gint argc, gchar **argv)
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
-	ex = camel_exception_new();
-
 	session = camel_test_session_new ("/tmp/camel-test");
 
 	for (i = 0; i < G_N_ELEMENTS (remote_providers); i++) {
@@ -43,7 +40,6 @@ gint main(gint argc, gchar **argv)
 	}
 
 	check_unref(session, 1);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test8.c b/camel/tests/folder/test8.c
index 41befdc..99e734a 100644
--- a/camel/tests/folder/test8.c
+++ b/camel/tests/folder/test8.c
@@ -27,9 +27,7 @@ test_add_message(CamelFolder *folder, gint j)
 	CamelMimeMessage *msg;
 	gchar *content;
 	gchar *subject;
-	CamelException ex;
-
-	camel_exception_init(&ex);
+	GError *error = NULL;
 
 	push("creating message %d\n", j);
 	msg = test_message_create_simple();
@@ -42,8 +40,9 @@ test_add_message(CamelFolder *folder, gint j)
 	pull();
 
 	push("appending simple message %d", j);
-	camel_folder_append_message(folder, msg, NULL, NULL, &ex);
-	check_msg(!camel_exception_is_set(&ex), "%s", camel_exception_get_description(&ex));
+	camel_folder_append_message(folder, msg, NULL, NULL, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 	pull();
 
 	check_unref(msg, 1);
@@ -61,8 +60,8 @@ worker(gpointer d)
 	gint i, j, id = info->id;
 	gchar *sub, *content;
 	GPtrArray *res;
-	CamelException *ex = camel_exception_new();
 	CamelMimeMessage *msg;
+	GError *error = NULL;
 
 	/* we add a message, search for it, twiddle some flags, delete it */
 	/* and flat out */
@@ -73,14 +72,16 @@ worker(gpointer d)
 		sub = g_strdup_printf("(match-all (header-contains \"subject\" \"message %08x subject\"))", id+i);
 
 		push("searching for message %d\n\tusing: %s", id+i, sub);
-		res = camel_folder_search_by_expression(info->folder, sub, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		res = camel_folder_search_by_expression(info->folder, sub, &error);
+		check_msg(error == NULL, "%s", error->message);
 		check_msg(res->len == 1, "res->len = %d", res->len);
+		g_clear_error (&error);
 		pull();
 
 		push("getting message '%s'", res->pdata[0]);
-		msg = camel_folder_get_message(info->folder, (gchar *)res->pdata[0], ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		msg = camel_folder_get_message(info->folder, (gchar *)res->pdata[0], &error);
+		check_msg(error == NULL, "%s", error->message);
+		g_clear_error (&error);
 		pull();
 
 		content = g_strdup_printf("Test message %08x contents\n\n", id+i);
@@ -107,21 +108,18 @@ worker(gpointer d)
 		if (j<=2) {
 			d(printf("Forcing an expuge\n"));
 			push("expunging folder");
-			camel_folder_expunge(info->folder, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_folder_expunge(info->folder, &error);
+			check_msg(error == NULL, "%s", error->message);
 			pull();
 		}
 	}
 
-	camel_exception_free(ex);
-
 	return info;
 }
 
 gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
-	CamelException *ex;
 	gint i, j, index;
 	gchar *path;
 	CamelStore *store;
@@ -129,12 +127,11 @@ gint main(gint argc, gchar **argv)
 	struct _threadinfo *info;
 	CamelFolder *folder;
 	GPtrArray *uids;
+	GError *error = NULL;
 
 	camel_test_init(argc, argv);
 	camel_test_provider_init(1, local_drivers);
 
-	ex = camel_exception_new();
-
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
@@ -148,16 +145,18 @@ gint main(gint argc, gchar **argv)
 
 			push("trying %s index %d", local_providers[j], index);
 			path = g_strdup_printf("%s:///tmp/camel-test/%s", local_providers[j], local_providers[j]);
-			store = camel_session_get_store(session, path, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			store = camel_session_get_store(session, path, &error);
+			check_msg(error == NULL, "%s", error->message);
+			g_clear_error (&error);
 			test_free(path);
 
 			if (index == 0)
-				folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, ex);
+				folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, &error);
 			else
 				folder = camel_store_get_folder(store, "testbox",
-								CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+								CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX, &error);
+			check_msg(error == NULL, "%s", error->message);
+			g_clear_error (&error);
 
 			for (i = 0; i < MAX_THREADS; i++) {
 				GError *error = NULL;
@@ -188,13 +187,14 @@ gint main(gint argc, gchar **argv)
 			}
 			camel_folder_free_uids(folder, uids);
 
-			camel_folder_expunge(folder, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_folder_expunge(folder, &error);
+			check_msg(error == NULL, "%s", error->message);
 
 			check_unref(folder, 1);
 
-			camel_store_delete_folder(store, "testbox", ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_store_delete_folder(store, "testbox", &error);
+			check_msg(error == NULL, "%s", error->message);
+			g_clear_error (&error);
 
 			check_unref(store, 1);
 
@@ -205,7 +205,6 @@ gint main(gint argc, gchar **argv)
 	}
 
 	g_object_unref (session);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test9.c b/camel/tests/folder/test9.c
index b274482..1d1ac59 100644
--- a/camel/tests/folder/test9.c
+++ b/camel/tests/folder/test9.c
@@ -69,7 +69,7 @@ static CamelFolder *
 get_folder (CamelFilterDriver *d,
             const gchar *uri,
             gpointer data,
-            CamelException *ex)
+            GError **error)
 {
 	gint i;
 
@@ -84,18 +84,16 @@ gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
 	CamelStore *store;
-	CamelException *ex;
 	CamelFolder *folder;
 	CamelMimeMessage *msg;
 	gint i, j;
 	CamelStream *mbox;
 	CamelFilterDriver *driver;
+	GError *error = NULL;
 
 	camel_test_init(argc, argv);
 	camel_test_provider_init(1, local_drivers);
 
-	ex = camel_exception_new();
-
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
@@ -107,27 +105,29 @@ gint main(gint argc, gchar **argv)
 	/* todo: work out how to do imap/pop/nntp tests */
 
 	push("getting store");
-	store = camel_session_get_store(session, "mbox:///tmp/camel-test/mbox", ex);
-	check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex));
+	store = camel_session_get_store(session, "mbox:///tmp/camel-test/mbox", &error);
+	check_msg(error == NULL, "getting store: %s", error->message);
 	check(store != NULL);
+	g_clear_error (&error);
 	pull();
 
 	push("Creating output folders");
 	for (i = 0; i < G_N_ELEMENTS (mailboxes); i++) {
 		push("creating %s", mailboxes[i].name);
-		mailboxes[i].folder = folder = camel_store_get_folder(store, mailboxes[i].name, CAMEL_STORE_FOLDER_CREATE, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		mailboxes[i].folder = folder = camel_store_get_folder(store, mailboxes[i].name, CAMEL_STORE_FOLDER_CREATE, &error);
+		check_msg(error == NULL, "%s", error->message);
 		check(folder != NULL);
 
 		/* we need an empty folder for this to work */
 		test_folder_counts(folder, 0, 0);
+		g_clear_error (&error);
 		pull();
 	}
 	pull();
 
 	/* append a bunch of messages with specific content */
 	push("creating 100 test message mbox");
-	mbox = camel_stream_fs_new_with_name("/tmp/camel-test/inbox", O_WRONLY|O_CREAT|O_EXCL, 0600);
+	mbox = camel_stream_fs_new_with_name("/tmp/camel-test/inbox", O_WRONLY|O_CREAT|O_EXCL, 0600, NULL);
 	for (j=0;j<100;j++) {
 		gchar *content, *subject;
 
@@ -144,18 +144,19 @@ gint main(gint argc, gchar **argv)
 		pull();
 
 		camel_stream_printf(mbox, "From \n");
-		check(camel_data_wrapper_write_to_stream((CamelDataWrapper *)msg, mbox) != -1);
+		check(camel_data_wrapper_write_to_stream((CamelDataWrapper *)msg, mbox, NULL) != -1);
 #if 0
 		push("appending simple message %d", j);
 		camel_folder_append_message(folder, msg, NULL, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		check_msg(error == NULL, "%s", error->message);
+		g_clear_error (&error);
 		pull();
 #endif
 		test_free(subject);
 
 		check_unref(msg, 1);
 	}
-	check(camel_stream_close(mbox) != -1);
+	check(camel_stream_close(mbox, NULL) != -1);
 	check_unref(mbox, 1);
 	pull();
 
@@ -169,12 +170,13 @@ gint main(gint argc, gchar **argv)
 
 	push("Executing filters");
 	camel_filter_driver_set_default_folder(driver, mailboxes[0].folder);
-	camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, &error);
+	check_msg(error == NULL, "%s", error->message);
 
 	/* now need to check the folder counts/etc */
 
 	check_unref(driver, 1);
+	g_clear_error (&error);
 	pull();
 
 	/* this tests that invalid rules are caught */
@@ -184,10 +186,10 @@ gint main(gint argc, gchar **argv)
 		driver = camel_filter_driver_new(session);
 		camel_filter_driver_set_folder_func(driver, get_folder, NULL);
 		camel_filter_driver_add_rule(driver, brokens[i].name, brokens[i].match, brokens[i].action);
-		camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, ex);
-		check(camel_exception_is_set(ex));
-		camel_exception_clear(ex);
+		camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, &error);
+		check(error != NULL);
 		check_unref(driver, 1);
+		g_clear_error (&error);
 		pull();
 	}
 	pull();
@@ -198,10 +200,10 @@ gint main(gint argc, gchar **argv)
 		driver = camel_filter_driver_new(session);
 		camel_filter_driver_set_folder_func(driver, get_folder, NULL);
 		camel_filter_driver_add_rule(driver, brokena[i].name, brokena[i].match, brokena[i].action);
-		camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, ex);
-		check(camel_exception_is_set(ex));
-		camel_exception_clear(ex);
+		camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, &error);
+		check(error != NULL);
 		check_unref(driver, 1);
+		g_clear_error (&error);
 		pull();
 	}
 	pull();
@@ -213,7 +215,6 @@ gint main(gint argc, gchar **argv)
 	check_unref(store, 1);
 
 	check_unref(session, 1);
-	camel_exception_free(ex);
 
 	camel_test_end();
 
diff --git a/camel/tests/lib/camel-test-provider.c b/camel/tests/lib/camel-test-provider.c
index 75bdac0..9a15fef 100644
--- a/camel/tests/lib/camel-test-provider.c
+++ b/camel/tests/lib/camel-test-provider.c
@@ -6,14 +6,14 @@ camel_test_provider_init (gint argc, const gchar **argv)
 {
 	gchar *name, *path;
 	gint i;
-	CamelException ex = { 0 };
+	GError *error = NULL;
 
 	for (i=0;i<argc;i++) {
 		name = g_strdup_printf("libcamel%s."G_MODULE_SUFFIX, argv[i]);
 		path = g_build_filename(CAMEL_BUILD_DIR, "providers", argv[i], ".libs", name, NULL);
 		g_free(name);
-		camel_provider_load(path, &ex);
-		check_msg(!ex.id, "Cannot load provider for '%s', test aborted", argv[i]);
+		camel_provider_load(path, &error);
+		check_msg(error == NULL, "Cannot load provider for '%s', test aborted", argv[i]);
 		g_free(path);
 	}
 }
diff --git a/camel/tests/lib/camel-test.c b/camel/tests/lib/camel-test.c
index 9a23140..f09fb85 100644
--- a/camel/tests/lib/camel-test.c
+++ b/camel/tests/lib/camel-test.c
@@ -89,7 +89,8 @@ current_state(void)
 	return info;
 }
 
-void camel_test_init(gint argc, gchar **argv)
+void
+camel_test_init(gint argc, gchar **argv)
 {
 	struct stat st;
 	gchar *path;
@@ -104,7 +105,7 @@ void camel_test_init(gint argc, gchar **argv)
 	if (mkdir (path, 0700) == -1 && errno != EEXIST)
 		abort ();
 
-	if (stat (path, &st) == -1)
+	if (g_stat (path, &st) == -1)
 		abort ();
 
 	if (!S_ISDIR (st.st_mode) || access (path, R_OK | W_OK | X_OK) == -1)
diff --git a/camel/tests/lib/camel-test.h b/camel/tests/lib/camel-test.h
index b569142..f97c06a 100644
--- a/camel/tests/lib/camel-test.h
+++ b/camel/tests/lib/camel-test.h
@@ -4,6 +4,7 @@
 #include "config.h"
 
 #include <stdlib.h>
+#include <glib/gstdio.h>
 #include <camel/camel.h>
 
 void camel_test_failv(const gchar *why, va_list ap);
diff --git a/camel/tests/lib/folders.c b/camel/tests/lib/folders.c
index 1fc15e7..a85670c 100644
--- a/camel/tests/lib/folders.c
+++ b/camel/tests/lib/folders.c
@@ -81,8 +81,8 @@ test_folder_message(CamelFolder *folder, const gchar *uid)
 	CamelMessageInfo *info;
 	GPtrArray *s;
 	gint i;
-	CamelException *ex = camel_exception_new();
 	gint found;
+	GError *error = NULL;
 
 	push("uid %s is in folder", uid);
 
@@ -93,8 +93,8 @@ test_folder_message(CamelFolder *folder, const gchar *uid)
 	camel_folder_free_message_info(folder, info);
 
 	/* then, getting message */
-	msg = camel_folder_get_message(folder, uid, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	msg = camel_folder_get_message(folder, uid, &error);
+	check_msg(error == NULL, "%s", error->message);
 	check(msg != NULL);
 
 	/* cross check with info */
@@ -125,7 +125,7 @@ test_folder_message(CamelFolder *folder, const gchar *uid)
 	check(found == 1);
 	camel_folder_free_uids(folder, s);
 
-	camel_exception_free(ex);
+	g_clear_error (&error);
 
 	pull();
 }
@@ -138,8 +138,8 @@ test_folder_not_message(CamelFolder *folder, const gchar *uid)
 	CamelMessageInfo *info;
 	GPtrArray *s;
 	gint i;
-	CamelException *ex = camel_exception_new();
 	gint found;
+	GError *error = NULL;
 
 	push("uid '%s' is not in folder", uid);
 
@@ -151,10 +151,10 @@ test_folder_not_message(CamelFolder *folder, const gchar *uid)
 
 	/* then, getting message */
 	push("no message");
-	msg = camel_folder_get_message(folder, uid, ex);
-	check(camel_exception_is_set(ex));
+	msg = camel_folder_get_message(folder, uid, &error);
+	check(error != NULL);
 	check(msg == NULL);
-	camel_exception_clear(ex);
+	g_clear_error (&error);
 	pull();
 
 	/* see if it is not in the summary (only once) */
@@ -184,7 +184,7 @@ test_folder_not_message(CamelFolder *folder, const gchar *uid)
 	camel_folder_free_uids(folder, s);
 	pull();
 
-	camel_exception_free(ex);
+	g_clear_error (&error);
 
 	pull();
 }
@@ -195,87 +195,91 @@ void
 test_folder_basic(CamelSession *session, const gchar *storename, gint local, gint spool)
 {
 	CamelStore *store;
-	CamelException *ex = camel_exception_new();
 	CamelFolder *folder;
 	gchar *what = g_strdup_printf("testing store: %s", storename);
+	GError *error = NULL;
 
 	camel_test_start(what);
 	test_free(what);
 
 	push("getting store");
-	store = camel_session_get_store(session, storename, ex);
-	check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex));
+	store = camel_session_get_store(session, storename, &error);
+	check_msg(error == NULL, "getting store: %s", error->message);
 	check(store != NULL);
+	g_clear_error (&error);
 	pull();
 
 	/* local providers == no inbox */
 	push("getting inbox folder");
-	folder = camel_store_get_inbox(store, ex);
+	folder = camel_store_get_inbox(store, &error);
 	if (local) {
 		/* Well, maildir can have an inbox */
 		if (folder) {
-			check(!camel_exception_is_set(ex));
+			check(error == NULL);
 			check_unref(folder, 1);
 		} else {
-			check(camel_exception_is_set(ex));
-			camel_exception_clear(ex);
+			check(error != NULL);
 		}
 	} else {
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		check_msg(error == NULL, "%s", error->message);
 		check(folder != NULL);
 		check_unref(folder, 2);
 	}
+	g_clear_error (&error);
 	pull();
 
 	push("getting a non-existant folder, no create");
-	folder = camel_store_get_folder(store, "unknown", 0, ex);
-	check(camel_exception_is_set(ex));
+	folder = camel_store_get_folder(store, "unknown", 0, &error);
+	check(error != NULL);
 	check(folder == NULL);
-	camel_exception_clear(ex);
+	g_clear_error (&error);
 	pull();
 
 	if (!spool) {
 		push("getting a non-existant folder, with create");
-		folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, &error);
+		check_msg(error == NULL, "%s", error->message);
 		check(folder != NULL);
 		if (local)
 			check_unref(folder, 1);
 		else
 			check_unref(folder, 2);
+		g_clear_error (&error);
 		pull();
 
 		push("getting an existing folder");
-		folder = camel_store_get_folder(store, "testbox", 0, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		folder = camel_store_get_folder(store, "testbox", 0, &error);
+		check_msg(error == NULL, "%s", error->message);
 		check(folder != NULL);
 		if (local)
 			check_unref(folder, 1);
 		else
 			check_unref(folder, 2);
+		g_clear_error (&error);
 		pull();
 
 		push("renaming a non-existant folder");
-		camel_store_rename_folder(store, "unknown1", "unknown2", ex);
-		check(camel_exception_is_set(ex));
-		camel_exception_clear(ex);
+		camel_store_rename_folder(store, "unknown1", "unknown2", &error);
+		check(error != NULL);
+		g_clear_error (&error);
 		pull();
 
 		push("renaming an existing folder");
-		camel_store_rename_folder(store, "testbox", "testbox2", ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		camel_store_rename_folder(store, "testbox", "testbox2", &error);
+		check_msg(error == NULL, "%s", error->message);
+		g_clear_error (&error);
 		pull();
 
 		push("opening the old name of a renamed folder");
-		folder = camel_store_get_folder(store, "testbox", 0, ex);
-		check(camel_exception_is_set(ex));
+		folder = camel_store_get_folder(store, "testbox", 0, &error);
+		check(error != NULL);
 		check(folder == NULL);
-		camel_exception_clear(ex);
+		g_clear_error (&error);
 		pull();
 
 		push("opening the new name of a renamed folder");
-		folder = camel_store_get_folder(store, "testbox2", 0, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		folder = camel_store_get_folder(store, "testbox2", 0, &error);
+		check_msg(error == NULL, "%s", error->message);
 		check(folder != NULL);
 		if (local)
 			check_unref(folder, 1);
@@ -285,30 +289,29 @@ test_folder_basic(CamelSession *session, const gchar *storename, gint local, gin
 	}
 
 	push("deleting a non-existant folder");
-	camel_store_delete_folder(store, "unknown", ex);
-	check(camel_exception_is_set(ex));
-	camel_exception_clear(ex);
+	camel_store_delete_folder(store, "unknown", &error);
+	check(error != NULL);
+	g_clear_error (&error);
 	pull();
 
 	if (!spool) {
 		push("deleting an existing folder");
-		camel_store_delete_folder(store, "testbox2", ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		camel_store_delete_folder(store, "testbox2", &error);
+		check_msg(error == NULL, "%s", error->message);
+		g_clear_error (&error);
 		pull();
 	}
 
 	push("opening a folder that has been deleted");
-	folder = camel_store_get_folder(store, "testbox2", 0, ex);
-	check(camel_exception_is_set(ex));
+	folder = camel_store_get_folder(store, "testbox2", 0, &error);
+	check(error != NULL);
 	check(folder == NULL);
-	camel_exception_clear(ex);
+	g_clear_error (&error);
 	pull();
 
 	check_unref(store, 1);
 
 	camel_test_end();
-
-	camel_exception_free(ex);
 }
 
 /* todo: cross-check everything with folder_info checks as well */
@@ -317,13 +320,13 @@ void
 test_folder_message_ops(CamelSession *session, const gchar *name, gint local, const gchar *mailbox)
 {
 	CamelStore *store;
-	CamelException *ex = camel_exception_new();
 	CamelFolder *folder;
 	CamelMimeMessage *msg;
 	gint j;
 	gint indexed, max;
 	GPtrArray *uids;
 	CamelMessageInfo *info;
+	GError *error = NULL;
 
 	max=local?2:1;
 
@@ -335,9 +338,10 @@ test_folder_message_ops(CamelSession *session, const gchar *name, gint local, co
 		test_free(what);
 
 		push("getting store");
-		store = camel_session_get_store(session, name, ex);
-		check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex));
+		store = camel_session_get_store(session, name, &error);
+		check_msg(error == NULL, "getting store: %s", error->message);
 		check(store != NULL);
+		g_clear_error (&error);
 		pull();
 
 		push("creating %sindexed folder", indexed?"":"non-");
@@ -345,18 +349,18 @@ test_folder_message_ops(CamelSession *session, const gchar *name, gint local, co
 			flags = CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX;
 		else
 			flags = CAMEL_STORE_FOLDER_CREATE;
-		folder = camel_store_get_folder(store, mailbox, flags, ex);
+		folder = camel_store_get_folder(store, mailbox, flags, &error);
 
 		/* we can't create mailbox outside of namespace, since we have no api for it, try
 		   using inbox namespace, works for courier */
 		if (folder == NULL) {
 			gchar *mbox = g_strdup_printf("INBOX/%s", mailbox);
 			mailbox = mbox;
-			camel_exception_clear(ex);
-			folder = camel_store_get_folder(store, mailbox, flags, ex);
+			g_clear_error (&error);
+			folder = camel_store_get_folder(store, mailbox, flags, &error);
 		}
 
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		check_msg(error == NULL, "%s", error->message);
 		check(folder != NULL);
 
 		/* verify empty/can't get nonexistant stuff */
@@ -378,15 +382,15 @@ test_folder_message_ops(CamelSession *session, const gchar *name, gint local, co
 			pull();
 
 			push("appending simple message %d", j);
-			camel_folder_append_message(folder, msg, NULL, NULL, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_folder_append_message(folder, msg, NULL, NULL, &error);
+			check_msg(error == NULL, "%s", error->message);
 
 #if 0
 			/* sigh, this shouldn't be required, but the imap code is too dumb to do it itself */
 			if (!local) {
 				push("forcing a refresh of folder updates");
 				camel_folder_refresh_info(folder, ex);
-				check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+				check_msg(error == NULL, "%s", error->message);
 				pull();
 			}
 #endif
@@ -441,9 +445,10 @@ test_folder_message_ops(CamelSession *session, const gchar *name, gint local, co
 #endif
 
 		push("re-opening folder");
-		folder = camel_store_get_folder(store, mailbox, flags, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		folder = camel_store_get_folder(store, mailbox, flags, &error);
+		check_msg(error == NULL, "%s", error->message);
 		check(folder != NULL);
+		g_clear_error (&error);
 
 			/* verify counts */
 		test_folder_counts(folder, 10, 10);
@@ -469,8 +474,9 @@ test_folder_message_ops(CamelSession *session, const gchar *name, gint local, co
 		push("deleting first message & expunging");
 		camel_folder_delete_message(folder, uids->pdata[0]);
 		test_folder_counts(folder, 10, 9);
-		camel_folder_expunge(folder, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		camel_folder_expunge(folder, &error);
+		check_msg(error == NULL, "%s", error->message);
+		g_clear_error (&error);
 		test_folder_not_message(folder, uids->pdata[0]);
 		test_folder_counts(folder, 9, 9);
 
@@ -498,8 +504,9 @@ test_folder_message_ops(CamelSession *session, const gchar *name, gint local, co
 		camel_folder_delete_message(folder, uids->pdata[8]);
 		/* sync? */
 		test_folder_counts(folder, 9, 8);
-		camel_folder_expunge(folder, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		camel_folder_expunge(folder, &error);
+		check_msg(error == NULL, "%s", error->message);
+		g_clear_error (&error);
 		test_folder_not_message(folder, uids->pdata[8]);
 		test_folder_counts(folder, 8, 8);
 
@@ -529,8 +536,9 @@ test_folder_message_ops(CamelSession *session, const gchar *name, gint local, co
 		}
 		/* sync? */
 		test_folder_counts(folder, 8, 0);
-		camel_folder_expunge(folder, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		camel_folder_expunge(folder, &error);
+		check_msg(error == NULL, "%s", error->message);
+		g_clear_error (&error);
 		for (j=0;j<8;j++) {
 			test_folder_not_message(folder, uids->pdata[j]);
 		}
@@ -547,21 +555,21 @@ test_folder_message_ops(CamelSession *session, const gchar *name, gint local, co
 
 		if (g_ascii_strcasecmp(mailbox, "INBOX") != 0) {
 			push("deleting test folder, with no messages in it");
-			camel_store_delete_folder(store, mailbox, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_store_delete_folder(store, mailbox, &error);
+			check_msg(error == NULL, "%s", error->message);
+			g_clear_error (&error);
 			pull();
 		}
 
 		if (!local) {
 			push("disconneect service");
-			camel_service_disconnect((CamelService *)store, TRUE, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_service_disconnect((CamelService *)store, TRUE, &error);
+			check_msg(error == NULL, "%s", error->message);
+			g_clear_error (&error);
 			pull();
 		}
 
 		check_unref(store, 1);
 		camel_test_end();
 	}
-
-	camel_exception_free(ex);
 }
diff --git a/camel/tests/lib/messages.c b/camel/tests/lib/messages.c
index de6bf8c..d8fd8da 100644
--- a/camel/tests/lib/messages.c
+++ b/camel/tests/lib/messages.c
@@ -80,7 +80,7 @@ test_message_set_content_simple(CamelMimePart *part, gint how, const gchar *type
 		dw = camel_data_wrapper_new();
                 camel_data_wrapper_set_mime_type (dw, type);
 
-		camel_data_wrapper_construct_from_stream(dw, (CamelStream *)content);
+		camel_data_wrapper_construct_from_stream(dw, (CamelStream *)content, NULL);
 		camel_medium_set_content ((CamelMedium *)part, dw);
 
 		check_unref(content, 2);
@@ -94,9 +94,9 @@ test_message_write_file(CamelMimeMessage *msg, const gchar *name)
 	CamelStreamFs *file;
 	gint ret;
 
-	file = (CamelStreamFs *)camel_stream_fs_new_with_name(name, O_CREAT|O_WRONLY, 0600);
-	camel_data_wrapper_write_to_stream((CamelDataWrapper *)msg, (CamelStream *)file);
-	ret = camel_stream_close((CamelStream *)file);
+	file = (CamelStreamFs *)camel_stream_fs_new_with_name(name, O_CREAT|O_WRONLY, 0600, NULL);
+	camel_data_wrapper_write_to_stream((CamelDataWrapper *)msg, (CamelStream *)file, NULL);
+	ret = camel_stream_close((CamelStream *)file, NULL);
 
 	check(G_OBJECT (file)->ref_count == 1);
 	g_object_unref (file);
@@ -110,10 +110,10 @@ test_message_read_file(const gchar *name)
 	CamelStreamFs *file;
 	CamelMimeMessage *msg2;
 
-	file = (CamelStreamFs *)camel_stream_fs_new_with_name(name, O_RDONLY, 0);
+	file = (CamelStreamFs *)camel_stream_fs_new_with_name(name, O_RDONLY, 0, NULL);
 	msg2 = camel_mime_message_new();
 
-	camel_data_wrapper_construct_from_stream((CamelDataWrapper *)msg2, (CamelStream *)file);
+	camel_data_wrapper_construct_from_stream((CamelDataWrapper *)msg2, (CamelStream *)file, NULL);
 	/* file's refcount may be > 1 if the message is real big */
 	check(G_OBJECT(file)->ref_count >=1);
 	g_object_unref (file);
@@ -164,7 +164,7 @@ test_message_compare_content(CamelDataWrapper *dw, const gchar *text, gint len)
 
 	byte_array = g_byte_array_new ();
 	content = camel_stream_mem_new_with_byte_array (byte_array);
-	camel_data_wrapper_decode_to_stream (dw, content);
+	camel_data_wrapper_decode_to_stream (dw, content, NULL);
 
 	if (byte_array->len != len) {
 		printf ("original text:\n");
@@ -192,17 +192,17 @@ test_message_compare (CamelMimeMessage *msg)
 
 	byte_array1 = g_byte_array_new ();
 	stream1 = camel_stream_mem_new_with_byte_array (byte_array1);
-	check_msg(camel_data_wrapper_write_to_stream ((CamelDataWrapper *) msg, stream1) != -1, "write_to_stream 1 failed");
-	camel_stream_reset (stream1);
+	check_msg(camel_data_wrapper_write_to_stream ((CamelDataWrapper *) msg, stream1, NULL) != -1, "write_to_stream 1 failed", NULL);
+	camel_stream_reset (stream1, NULL);
 
 	msg2 = camel_mime_message_new ();
-	check_msg(camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) msg2, (CamelStream *) stream1) != -1, "construct_from_stream 1 failed");
-	camel_stream_reset ((CamelStream *) stream1);
+	check_msg(camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) msg2, (CamelStream *) stream1, NULL) != -1, "construct_from_stream 1 failed");
+	camel_stream_reset ((CamelStream *) stream1, NULL);
 
 	byte_array2 = g_byte_array_new ();
 	stream2 = camel_stream_mem_new_with_byte_array (byte_array2);
-	check_msg(camel_data_wrapper_write_to_stream ((CamelDataWrapper *) msg2, stream2) != -1, "write_to_stream 2 failed");
-	camel_stream_reset (stream2);
+	check_msg(camel_data_wrapper_write_to_stream ((CamelDataWrapper *) msg2, stream2, NULL) != -1, "write_to_stream 2 failed");
+	camel_stream_reset (stream2, NULL);
 
 	if (byte_array1->len != byte_array2->len) {
 		CamelDataWrapper *content;
diff --git a/camel/tests/lib/streams.c b/camel/tests/lib/streams.c
index 4229a35..c12876c 100644
--- a/camel/tests/lib/streams.c
+++ b/camel/tests/lib/streams.c
@@ -24,27 +24,27 @@ test_stream_seekable_writepart(CamelSeekableStream *s)
 	push("seekable stream test, writing ");
 
 	check(camel_seekable_stream_tell(s) == 0);
-	check(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_SET) == 0);
+	check(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_SET, NULL) == 0);
 	check(camel_seekable_stream_tell(s) == 0);
 
-	check(camel_stream_write(CAMEL_STREAM(s), "", 0) == 0);
+	check(camel_stream_write(CAMEL_STREAM(s), "", 0, NULL) == 0);
 	check(camel_seekable_stream_tell(s) == 0);
-	check(camel_stream_write(CAMEL_STREAM(s), "\n", 1) == 1);
+	check(camel_stream_write(CAMEL_STREAM(s), "\n", 1, NULL) == 1);
 	check(camel_seekable_stream_tell(s) == 1);
 
 	for (i=0;i<10240;i++) {
-		check(camel_stream_write(CAMEL_STREAM(s), teststring, sizeof(teststring)) == sizeof(teststring));
+		check(camel_stream_write(CAMEL_STREAM(s), teststring, sizeof(teststring), NULL) == sizeof(teststring));
 		check(camel_seekable_stream_tell(s) == 1 + (i+1)*sizeof(teststring));
 	}
 	end = 10240*sizeof(teststring)+1;
 
-	check_msg(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_END) == end, "seek =%d end = %d",
-		  camel_seekable_stream_seek(s, 0, CAMEL_STREAM_END), end);
+	check_msg(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_END, NULL) == end, "seek =%d end = %d",
+		  camel_seekable_stream_seek(s, 0, CAMEL_STREAM_END, NULL), end);
 
-	check(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_END) == end);
+	check(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_END, NULL) == end);
 	check(camel_seekable_stream_tell(s) == end);
 	/* need to read 0 first to set eos */
-	check(camel_stream_read(CAMEL_STREAM(s), testbuf, 10240) == 0);
+	check(camel_stream_read(CAMEL_STREAM(s), testbuf, 10240, NULL) == 0);
 	check(camel_stream_eos(CAMEL_STREAM(s)));
 
 	pull();
@@ -60,7 +60,7 @@ test_stream_seekable_readpart(CamelSeekableStream *s)
 
 	end = 10240*sizeof(teststring)+1;
 
-	check(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_SET) == 0);
+	check(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_SET, NULL) == 0);
 	check(camel_seekable_stream_tell(s) == 0);
 	check(!camel_stream_eos(CAMEL_STREAM(s)));
 
@@ -72,18 +72,18 @@ test_stream_seekable_readpart(CamelSeekableStream *s)
 		/* exercise all seek methods */
 		switch (i % 3) {
 		case 0:
-			check(camel_seekable_stream_seek(s, new, CAMEL_STREAM_SET) == new);
+			check(camel_seekable_stream_seek(s, new, CAMEL_STREAM_SET, NULL) == new);
 			break;
 		case 1:
-			check(camel_seekable_stream_seek(s, new-off, CAMEL_STREAM_CUR) == new);
+			check(camel_seekable_stream_seek(s, new-off, CAMEL_STREAM_CUR, NULL) == new);
 			break;
 		case 2:
-			check(camel_seekable_stream_seek(s, new-end, CAMEL_STREAM_END) == new);
+			check(camel_seekable_stream_seek(s, new-end, CAMEL_STREAM_END, NULL) == new);
 			break;
 		}
 		check(camel_seekable_stream_tell(s) == new);
 
-		check(camel_stream_read(CAMEL_STREAM(s), testbuf, i*3) == i*3);
+		check(camel_stream_read(CAMEL_STREAM(s), testbuf, i*3, NULL) == i*3);
 		for (j=0;j<i*3;j++) {
 			gint k = new + j;
 
@@ -97,14 +97,14 @@ test_stream_seekable_readpart(CamelSeekableStream *s)
 	}
 
 	/* verify end-of-file behaviour */
-	check(camel_seekable_stream_seek(s, -1, CAMEL_STREAM_END) == end-1);
+	check(camel_seekable_stream_seek(s, -1, CAMEL_STREAM_END, NULL) == end-1);
 	check(camel_seekable_stream_tell(s) == end-1);
 
-	check(camel_stream_read(CAMEL_STREAM(s), testbuf, 10240) == 1);
+	check(camel_stream_read(CAMEL_STREAM(s), testbuf, 10240, NULL) == 1);
 	check(testbuf[0] == teststring[sizeof(teststring)-1]);
 
-	check(camel_stream_read(CAMEL_STREAM(s), testbuf, 10240) == 0);
-	check(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_CUR) == end);
+	check(camel_stream_read(CAMEL_STREAM(s), testbuf, 10240, NULL) == 0);
+	check(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_CUR, NULL) == end);
 	check(camel_seekable_stream_tell(s) == end);
 	check(camel_stream_eos(CAMEL_STREAM(s)));
 
@@ -126,36 +126,36 @@ test_seekable_substream_writepart(CamelStream *s, gint type)
 	push("writing substream, type %d", type);
 
 	if (type == 1) {
-		check(camel_seekable_stream_seek(sp, ss->bound_start, CAMEL_STREAM_SET) == ss->bound_start);
+		check(camel_seekable_stream_seek(sp, ss->bound_start, CAMEL_STREAM_SET, NULL) == ss->bound_start);
 		s = (CamelStream *)sp;
 	} else {
 		check(camel_seekable_stream_tell(ss) == ss->bound_start);
-		check(camel_seekable_stream_seek(ss, 0, CAMEL_STREAM_SET) == ss->bound_start);
+		check(camel_seekable_stream_seek(ss, 0, CAMEL_STREAM_SET, NULL) == ss->bound_start);
 	}
 
 	check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_start);
 
-	check(camel_stream_write(s, "", 0) == 0);
+	check(camel_stream_write(s, "", 0, NULL) == 0);
 	check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_start);
 
 	/* fill up the bounds with writes */
 	if (ss->bound_end != CAMEL_STREAM_UNBOUND) {
 		for (i=0;i<(ss->bound_end-ss->bound_start)/sizeof(teststring);i++) {
-			check(camel_stream_write(s, teststring, sizeof(teststring)) == sizeof(teststring));
+			check(camel_stream_write(s, teststring, sizeof(teststring), NULL) == sizeof(teststring));
 			check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_start + (i+1)*sizeof(teststring));
 		}
 		len = (ss->bound_end-ss->bound_start) % sizeof(teststring);
-		check(camel_stream_write(s, teststring, len) == len);
+		check(camel_stream_write(s, teststring, len, NULL) == len);
 		check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_end);
 		if (G_UNLIKELY (type == G_TYPE_INVALID)) {
-			check(camel_stream_write(s, teststring, sizeof(teststring)) == 0);
+			check(camel_stream_write(s, teststring, sizeof(teststring), NULL) == 0);
 			check(camel_stream_eos(s));
 			check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_end);
 		}
 	} else {
 		/* just 10K */
 		for (i=0;i<10240;i++) {
-			check(camel_stream_write(CAMEL_STREAM(s), teststring, sizeof(teststring)) == sizeof(teststring));
+			check(camel_stream_write(CAMEL_STREAM(s), teststring, sizeof(teststring), NULL) == sizeof(teststring));
 			check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_start + (i+1)*sizeof(teststring));
 		}
 
@@ -175,49 +175,49 @@ test_seekable_substream_readpart(CamelStream *s)
 
 	push("reading substream");
 
-	check(camel_seekable_stream_seek(ss, 0, CAMEL_STREAM_SET) == ss->bound_start);
+	check(camel_seekable_stream_seek(ss, 0, CAMEL_STREAM_SET, NULL) == ss->bound_start);
 	check(camel_seekable_stream_tell(ss) == ss->bound_start);
 
-	check(camel_seekable_stream_seek(sp, ss->bound_start, CAMEL_STREAM_SET) == ss->bound_start);
+	check(camel_seekable_stream_seek(sp, ss->bound_start, CAMEL_STREAM_SET, NULL) == ss->bound_start);
 	check(camel_seekable_stream_tell(sp) == ss->bound_start);
 
 	/* check writes, cross check with parent stream */
 	if (ss->bound_end != CAMEL_STREAM_UNBOUND) {
 		for (i=0;i<(ss->bound_end-ss->bound_start)/sizeof(teststring);i++) {
-			check(camel_stream_read(s, testbuf, sizeof(teststring)) == sizeof(teststring));
+			check(camel_stream_read(s, testbuf, sizeof(teststring), NULL) == sizeof(teststring));
 			check(memcmp(testbuf, teststring, sizeof(teststring)) == 0);
 			check(camel_seekable_stream_tell(ss) == ss->bound_start + (i+1)*sizeof(teststring));
 
 			/* yeah great, the substreams affect the seek ... */
-			check(camel_seekable_stream_seek(sp, ss->bound_start + (i)*sizeof(teststring), CAMEL_STREAM_SET) == ss->bound_start + i*sizeof(teststring));
-			check(camel_stream_read(CAMEL_STREAM(sp), testbuf, sizeof(teststring)) == sizeof(teststring));
+			check(camel_seekable_stream_seek(sp, ss->bound_start + (i)*sizeof(teststring), CAMEL_STREAM_SET, NULL) == ss->bound_start + i*sizeof(teststring));
+			check(camel_stream_read(CAMEL_STREAM(sp), testbuf, sizeof(teststring), NULL) == sizeof(teststring));
 			check(memcmp(testbuf, teststring, sizeof(teststring)) == 0);
 			check(camel_seekable_stream_tell(sp) == ss->bound_start + (i+1)*sizeof(teststring));
 		}
 		len = (ss->bound_end-ss->bound_start) % sizeof(teststring);
-		check(camel_stream_read(s, testbuf, len) == len);
+		check(camel_stream_read(s, testbuf, len, NULL) == len);
 		check(memcmp(testbuf, teststring, len) == 0);
 
-		check(camel_seekable_stream_seek(sp, ss->bound_end - len, CAMEL_STREAM_SET) == ss->bound_end - len);
-		check(camel_stream_read(CAMEL_STREAM(sp), testbuf, len) == len);
+		check(camel_seekable_stream_seek(sp, ss->bound_end - len, CAMEL_STREAM_SET, NULL) == ss->bound_end - len);
+		check(camel_stream_read(CAMEL_STREAM(sp), testbuf, len, NULL) == len);
 		check(memcmp(testbuf, teststring, len) == 0);
 
 		check(camel_stream_eos(s));
 		check(camel_seekable_stream_tell(ss) == ss->bound_end);
 		check(camel_seekable_stream_tell(sp) == ss->bound_end);
-		check(camel_stream_read(s, testbuf, 1024) == 0);
+		check(camel_stream_read(s, testbuf, 1024, NULL) == 0);
 		check(camel_seekable_stream_tell(ss) == ss->bound_end);
 		check(camel_seekable_stream_tell(sp) == ss->bound_end);
 		check(camel_stream_eos(s));
 	} else {
 		/* just 10K */
 		for (i=0;i<10240;i++) {
-			check(camel_stream_read(s, testbuf, sizeof(teststring)) == sizeof(teststring));
+			check(camel_stream_read(s, testbuf, sizeof(teststring), NULL) == sizeof(teststring));
 			check(memcmp(testbuf, teststring, sizeof(teststring)) == 0);
 			check(camel_seekable_stream_tell(ss) == ss->bound_start + (i+1)*sizeof(teststring));
 
-			check(camel_seekable_stream_seek(sp, ss->bound_start + (i)*sizeof(teststring), CAMEL_STREAM_SET) == ss->bound_start + i*sizeof(teststring));
-			check(camel_stream_read(CAMEL_STREAM(sp), testbuf, sizeof(teststring)) == sizeof(teststring));
+			check(camel_seekable_stream_seek(sp, ss->bound_start + (i)*sizeof(teststring), CAMEL_STREAM_SET, NULL) == ss->bound_start + i*sizeof(teststring));
+			check(camel_stream_read(CAMEL_STREAM(sp), testbuf, sizeof(teststring), NULL) == sizeof(teststring));
 			check(memcmp(testbuf, teststring, sizeof(teststring)) == 0);
 			check(camel_seekable_stream_tell(sp) == ss->bound_start + (i+1)*sizeof(teststring));
 		}
diff --git a/camel/tests/message/test4.c b/camel/tests/message/test4.c
index 574fc18..b342c1a 100644
--- a/camel/tests/message/test4.c
+++ b/camel/tests/message/test4.c
@@ -87,7 +87,7 @@ gint main (gint argc, gchar **argv)
 			continue;
 
 		filename = g_strdup_printf ("../data/messages/%s", dent->d_name);
-		if (stat (filename, &st) == -1 || !S_ISREG (st.st_mode)) {
+		if (g_stat (filename, &st) == -1 || !S_ISREG (st.st_mode)) {
 			g_free (filename);
 			continue;
 		}
@@ -102,8 +102,8 @@ gint main (gint argc, gchar **argv)
 
 		stream = camel_stream_fs_new_with_fd (fd);
 		message = camel_mime_message_new ();
-		camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream);
-		camel_stream_reset (stream);
+		camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream, NULL);
+		camel_stream_reset (stream, NULL);
 
 		/*dump_mime_struct ((CamelMimePart *) message, 0);*/
 		test_message_compare (message);
diff --git a/camel/tests/mime-filter/test-charset.c b/camel/tests/mime-filter/test-charset.c
index 17e60c4..84d7045 100644
--- a/camel/tests/mime-filter/test-charset.c
+++ b/camel/tests/mime-filter/test-charset.c
@@ -47,7 +47,7 @@ main (gint argc, gchar **argv)
 		g_free (work);
 
 		infile = g_strdup_printf ("%s/%s", SOURCEDIR, dent->d_name);
-		if (!(source = camel_stream_fs_new_with_name (infile, 0, O_RDONLY))) {
+		if (!(source = camel_stream_fs_new_with_name (infile, 0, O_RDONLY, NULL))) {
 			camel_test_fail ("Failed to open input case in \"%s\"", infile);
 			g_free (outfile);
 			continue;
@@ -56,7 +56,7 @@ main (gint argc, gchar **argv)
 
 		outfile = g_strdup_printf ("%s/%.*s.out", SOURCEDIR, ext - dent->d_name, dent->d_name);
 
-		if (!(correct = camel_stream_fs_new_with_name (outfile, 0, O_RDONLY))) {
+		if (!(correct = camel_stream_fs_new_with_name (outfile, 0, O_RDONLY, NULL))) {
 			camel_test_fail ("Failed to open correct output in \"%s\"", outfile);
 			g_free (outfile);
 			continue;
@@ -87,7 +87,7 @@ main (gint argc, gchar **argv)
 		comp_progress = 0;
 
 		while (1) {
-			comp_correct_chunk = camel_stream_read (correct, comp_correct, CHUNK_SIZE);
+			comp_correct_chunk = camel_stream_read (correct, comp_correct, CHUNK_SIZE, NULL);
 			comp_filter_chunk = 0;
 
 			if (comp_correct_chunk == 0)
@@ -98,7 +98,7 @@ main (gint argc, gchar **argv)
 
 				delta = camel_stream_read (CAMEL_STREAM (filter),
 							   comp_filter + comp_filter_chunk,
-							   CHUNK_SIZE - comp_filter_chunk);
+							   CHUNK_SIZE - comp_filter_chunk, NULL);
 
 				if (delta == 0) {
 					camel_test_fail ("Chunks are different sizes: correct is %d, "
diff --git a/camel/tests/mime-filter/test-crlf.c b/camel/tests/mime-filter/test-crlf.c
index 68582d5..1f2be6b 100644
--- a/camel/tests/mime-filter/test-crlf.c
+++ b/camel/tests/mime-filter/test-crlf.c
@@ -64,7 +64,7 @@ main (gint argc, gchar **argv)
 			}
 
 			camel_test_push ("Initializing objects");
-			source = camel_stream_fs_new_with_name (infile, 0, O_RDONLY);
+			source = camel_stream_fs_new_with_name (infile, 0, O_RDONLY, NULL);
 			if (!source) {
 				camel_test_fail ("Failed to open input case in \"%s\"", infile);
 				g_free (infile);
@@ -72,7 +72,7 @@ main (gint argc, gchar **argv)
 			}
 			g_free (infile);
 
-			correct = camel_stream_fs_new_with_name (outfile, 0, O_RDONLY);
+			correct = camel_stream_fs_new_with_name (outfile, 0, O_RDONLY, NULL);
 			if (!correct) {
 				camel_test_fail ("Failed to open correct output in \"%s\"", outfile);
 				g_free (outfile);
@@ -100,7 +100,7 @@ main (gint argc, gchar **argv)
 			comp_progress = 0;
 
 			while (1) {
-				comp_correct_chunk = camel_stream_read (correct, comp_correct, CHUNK_SIZE);
+				comp_correct_chunk = camel_stream_read (correct, comp_correct, CHUNK_SIZE, NULL);
 				comp_filter_chunk = 0;
 
 				if (comp_correct_chunk == 0)
@@ -111,7 +111,7 @@ main (gint argc, gchar **argv)
 
 					delta = camel_stream_read (CAMEL_STREAM (filter),
 								   comp_filter + comp_filter_chunk,
-								   CHUNK_SIZE - comp_filter_chunk);
+								   CHUNK_SIZE - comp_filter_chunk, NULL);
 
 					if (delta == 0) {
 						camel_test_fail ("Chunks are different sizes: correct is %d, "
diff --git a/camel/tests/mime-filter/test-tohtml.c b/camel/tests/mime-filter/test-tohtml.c
index 731ae63..4fd9d7c 100644
--- a/camel/tests/mime-filter/test-tohtml.c
+++ b/camel/tests/mime-filter/test-tohtml.c
@@ -31,14 +31,14 @@ test_filter(CamelMimeFilter *f, const gchar *inname, const gchar *outname)
 
 	camel_test_push("setup");
 
-	indisk = camel_stream_fs_new_with_name(inname, O_RDONLY, 0);
+	indisk = camel_stream_fs_new_with_name(inname, O_RDONLY, 0, NULL);
 	check(indisk);
-	outdisk = camel_stream_fs_new_with_name(outname, O_RDONLY, 0);
+	outdisk = camel_stream_fs_new_with_name(outname, O_RDONLY, 0, NULL);
 	check(outdisk);
 
 	byte_array_out = g_byte_array_new ();
 	out = camel_stream_mem_new_with_byte_array (byte_array_out);
-	check(camel_stream_write_to_stream(outdisk, out) > 0);
+	check(camel_stream_write_to_stream(outdisk, out, NULL) > 0);
 
 	camel_test_pull();
 
@@ -52,7 +52,7 @@ test_filter(CamelMimeFilter *f, const gchar *inname, const gchar *outname)
 	id = camel_stream_filter_add((CamelStreamFilter *)filter, f);
 	check_count(f, 2);
 
-	check(camel_stream_write_to_stream(filter, in) > 0);
+	check(camel_stream_write_to_stream(filter, in, NULL) > 0);
 	check_msg(byte_array_in->len == byte_array_out->len
 		  && memcmp(byte_array_in->data, byte_array_out->data, byte_array_in->len) == 0,
 		  "Buffer content mismatch, %d != %d, in = '%.*s' != out = '%.*s'", byte_array_in->len, byte_array_out->len,
@@ -69,7 +69,7 @@ test_filter(CamelMimeFilter *f, const gchar *inname, const gchar *outname)
 	check_count(f, 1);
 	check_unref(in, 1);
 
-	check(camel_stream_reset(indisk) == 0);
+	check(camel_stream_reset(indisk, NULL) == 0);
 
 	camel_test_push("writing through filter stream");
 
@@ -80,8 +80,8 @@ test_filter(CamelMimeFilter *f, const gchar *inname, const gchar *outname)
 	id = camel_stream_filter_add((CamelStreamFilter *)filter, f);
 	check_count(f, 2);
 
-	check(camel_stream_write_to_stream(indisk, filter) > 0);
-	check(camel_stream_flush(filter) == 0);
+	check(camel_stream_write_to_stream(indisk, filter, NULL) > 0);
+	check(camel_stream_flush(filter, NULL) == 0);
 	check_msg(byte_array_in->len == byte_array_out->len
 		  && memcmp(byte_array_in->data, byte_array_out->data, byte_array_in->len) == 0,
 		  "Buffer content mismatch, %d != %d, in = '%.*s' != out = '%.*s'", byte_array_in->len, byte_array_out->len,
@@ -116,7 +116,7 @@ main (gint argc, gchar **argv)
 		sprintf(inname, "data/html.%d.in", i);
 		sprintf(outname, "data/html.%d.out", i);
 
-		if (stat(inname, &st) == -1)
+		if (g_stat(inname, &st) == -1)
 			break;
 
 		f = camel_mime_filter_tohtml_new(CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
diff --git a/camel/tests/mime-filter/test1.c b/camel/tests/mime-filter/test1.c
index 1cf3212..80e0ac8 100644
--- a/camel/tests/mime-filter/test1.c
+++ b/camel/tests/mime-filter/test1.c
@@ -83,10 +83,10 @@ main (gint argc, gchar **argv)
 			while (*p) {
 				gint w = MIN(strlen(p), step);
 
-				check(camel_stream_write((CamelStream *)filter, p, w) == w);
+				check(camel_stream_write((CamelStream *)filter, p, w, NULL) == w);
 				p += w;
 			}
-			camel_stream_flush((CamelStream *)filter);
+			camel_stream_flush((CamelStream *)filter, NULL);
 
 			check_msg(byte_array->len == strlen(tests[i].out), "Buffer length mismatch: expected %d got %d\n or '%s' got '%.*s'", strlen(tests[i].out), byte_array->len, tests[i].out, byte_array->len, byte_array->data);
 			check_msg(0 == memcmp(byte_array->data, tests[i].out, byte_array->len), "Buffer mismatch: expected '%s' got '%.*s'", tests[i].out, byte_array->len, byte_array->data);
diff --git a/camel/tests/misc/url.c b/camel/tests/misc/url.c
index b7b6951..37762b9 100644
--- a/camel/tests/misc/url.c
+++ b/camel/tests/misc/url.c
@@ -72,20 +72,20 @@ gint
 main (gint argc, gchar **argv)
 {
 	CamelURL *base_url, *url;
-	CamelException ex;
 	gchar *url_string;
 	gint i;
+	GError *error = NULL;
 
 	camel_test_init (argc, argv);
 
 	camel_test_start ("URL parsing");
 
 	camel_test_push ("base URL parsing");
-	camel_exception_init (&ex);
-	base_url = camel_url_new (base, &ex);
+	base_url = camel_url_new (base, &error);
 	if (!base_url) {
-		camel_test_fail ("Could not parse %s: %s\n", base,
-				 camel_exception_get_description (&ex));
+		camel_test_fail (
+			"Could not parse %s: %s\n",
+			base, error->message);
 	}
 	camel_test_pull ();
 
diff --git a/camel/tests/smime/pgp-mime.c b/camel/tests/smime/pgp-mime.c
index d4cfcd9..f618f99 100644
--- a/camel/tests/smime/pgp-mime.c
+++ b/camel/tests/smime/pgp-mime.c
@@ -54,7 +54,7 @@ typedef struct _CamelPgpSessionClass {
 static gchar *get_password (CamelSession *session, const gchar *prompt,
 			   guint32 flags,
 			   CamelService *service, const gchar *item,
-			   CamelException *ex);
+			   GError **error);
 
 static void
 init (CamelPgpSession *session)
@@ -92,7 +92,7 @@ camel_pgp_session_get_type (void)
 
 static gchar *
 get_password (CamelSession *session, const gchar *prompt, guint32 flags,
-	      CamelService *service, const gchar *item, CamelException *ex)
+	      CamelService *service, const gchar *item, GError **error)
 {
 	return g_strdup ("no.secret");
 }
@@ -112,7 +112,7 @@ gint main (gint argc, gchar **argv)
 {
 	CamelSession *session;
 	CamelCipherContext *ctx;
-	CamelException *ex;
+	GError **error;
 	CamelCipherValidity *valid;
 	CamelMimePart *mime_part;
 	CamelMultipartSigned *mps;
diff --git a/camel/tests/smime/pgp.c b/camel/tests/smime/pgp.c
index 280fceb..6b7d8c2 100644
--- a/camel/tests/smime/pgp.c
+++ b/camel/tests/smime/pgp.c
@@ -58,7 +58,7 @@ pgp_session_get_password (CamelSession *session,
                           const gchar *prompt,
                           const gchar *item,
                           guint32 flags,
-                          CamelException *ex)
+                          GError **error)
 {
 	return g_strdup ("no.secret");
 }
@@ -92,7 +92,6 @@ gint main (gint argc, gchar **argv)
 {
 	CamelSession *session;
 	CamelCipherContext *ctx;
-	CamelException *ex;
 	CamelCipherValidity *valid;
 	CamelStream *stream1, *stream2;
 	GByteArray *buffer1, *buffer2;
@@ -101,6 +100,7 @@ gint main (gint argc, gchar **argv)
 	GPtrArray *recipients;
 	gchar *before, *after;
 	gint ret;
+	GError *error = NULL;
 
 	if (getenv("CAMEL_TEST_GPG") == NULL)
 		return 77;
@@ -125,20 +125,18 @@ gint main (gint argc, gchar **argv)
 
 	session = camel_pgp_session_new ("/tmp/camel-test");
 
-	ex = camel_exception_new ();
-
 	ctx = camel_gpg_context_new (session);
 	camel_gpg_context_set_always_trust (CAMEL_GPG_CONTEXT (ctx), TRUE);
 
 	camel_test_start ("Test of PGP functions");
 
 	stream1 = camel_stream_mem_new ();
-	camel_stream_write (stream1, "Hello, I am a test stream.\n", 27);
-	camel_stream_reset (stream1);
+	camel_stream_write (stream1, "Hello, I am a test stream.\n", 27, NULL);
+	camel_stream_reset (stream1, NULL);
 
 	conpart = camel_mime_part_new();
 	dw = camel_data_wrapper_new();
-	camel_data_wrapper_construct_from_stream(dw, stream1);
+	camel_data_wrapper_construct_from_stream(dw, stream1, NULL);
 	camel_medium_set_content ((CamelMedium *)conpart, dw);
 	g_object_unref (stream1);
 	g_object_unref (dw);
@@ -146,19 +144,19 @@ gint main (gint argc, gchar **argv)
 	sigpart = camel_mime_part_new();
 
 	camel_test_push ("PGP signing");
-	camel_cipher_sign (ctx, "no user no domain", CAMEL_CIPHER_HASH_SHA1, conpart, sigpart, ex);
-	if (camel_exception_is_set(ex)) {
-		printf("PGP signing failed assuming non-functional environment\n%s", camel_exception_get_description (ex));
+	camel_cipher_sign (ctx, "no user no domain", CAMEL_CIPHER_HASH_SHA1, conpart, sigpart, &error);
+	if (error != NULL) {
+		printf("PGP signing failed assuming non-functional environment\n%s", error->message);
 		camel_test_pull();
 		return 77;
 	}
 	camel_test_pull ();
 
-	camel_exception_clear (ex);
+	g_clear_error (&error);
 
 	camel_test_push ("PGP verify");
-	valid = camel_cipher_verify (ctx, sigpart, ex);
-	check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex));
+	valid = camel_cipher_verify (ctx, sigpart, &error);
+	check_msg (error == NULL, "%s", error->message);
 	check_msg (camel_cipher_validity_get_valid (valid), "%s", camel_cipher_validity_get_description (valid));
 	camel_cipher_validity_free (valid);
 	camel_test_pull ();
@@ -167,35 +165,35 @@ gint main (gint argc, gchar **argv)
 	g_object_unref (sigpart);
 
 	stream1 = camel_stream_mem_new ();
-	camel_stream_write (stream1, "Hello, I am a test of encryption/decryption.", 44);
-	camel_stream_reset (stream1);
+	camel_stream_write (stream1, "Hello, I am a test of encryption/decryption.", 44, NULL);
+	camel_stream_reset (stream1, NULL);
 
 	conpart = camel_mime_part_new();
 	dw = camel_data_wrapper_new();
-	camel_stream_reset(stream1);
-	camel_data_wrapper_construct_from_stream(dw, stream1);
+	camel_stream_reset(stream1, NULL);
+	camel_data_wrapper_construct_from_stream(dw, stream1, NULL);
 	camel_medium_set_content ((CamelMedium *)conpart, dw);
 	g_object_unref (stream1);
 	g_object_unref (dw);
 
 	encpart = camel_mime_part_new();
 
-	camel_exception_clear (ex);
+	g_clear_error (&error);
 
 	camel_test_push ("PGP encrypt");
 	recipients = g_ptr_array_new ();
 	g_ptr_array_add (recipients, (guint8 *) "no user no domain");
-	camel_cipher_encrypt (ctx, "no user no domain", recipients, conpart, encpart, ex);
-	check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex));
+	camel_cipher_encrypt (ctx, "no user no domain", recipients, conpart, encpart, &error);
+	check_msg (error == NULL, "%s", error->message);
 	g_ptr_array_free (recipients, TRUE);
 	camel_test_pull ();
 
-	camel_exception_clear (ex);
+	g_clear_error (&error);
 
 	camel_test_push ("PGP decrypt");
 	outpart = camel_mime_part_new();
-	valid = camel_cipher_decrypt (ctx, encpart, outpart, ex);
-	check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex));
+	valid = camel_cipher_decrypt (ctx, encpart, outpart, &error);
+	check_msg (error == NULL, "%s", error->message);
 	check_msg (valid->encrypt.status == CAMEL_CIPHER_VALIDITY_ENCRYPT_ENCRYPTED, "%s", valid->encrypt.description);
 
 	buffer1 = g_byte_array_new ();
@@ -203,8 +201,8 @@ gint main (gint argc, gchar **argv)
 	buffer2 = g_byte_array_new ();
 	stream2 = camel_stream_mem_new_with_byte_array (buffer2);
 
-	camel_data_wrapper_write_to_stream((CamelDataWrapper *)conpart, stream1);
-	camel_data_wrapper_write_to_stream((CamelDataWrapper *)outpart, stream2);
+	camel_data_wrapper_write_to_stream((CamelDataWrapper *)conpart, stream1, NULL);
+	camel_data_wrapper_write_to_stream((CamelDataWrapper *)outpart, stream2, NULL);
 
 	before = g_strndup ((gchar *) buffer1->data, buffer1->len);
 	after = g_strndup ((gchar *) buffer2->data, buffer2->len);
diff --git a/camel/tests/smime/pkcs7.c b/camel/tests/smime/pkcs7.c
index c6c7d66..29c1bfe 100644
--- a/camel/tests/smime/pkcs7.c
+++ b/camel/tests/smime/pkcs7.c
@@ -23,7 +23,7 @@ typedef struct _CamelTestSessionClass {
 
 static gchar *get_password (CamelSession *session, const gchar *prompt,
 			   guint32 flags, CamelService *service,
-			   const gchar *item, CamelException *ex);
+			   const gchar *item, GError **error);
 
 static void
 init (CamelTestSession *session)
@@ -61,7 +61,7 @@ camel_test_session_get_type (void)
 
 static gchar *
 get_password (CamelSession *session, const gchar *prompt, guint32 flags,
-	      CamelService *service, const gchar *item, CamelException *ex)
+	      CamelService *service, const gchar *item, GError **error)
 {
 	return g_strdup ("S/MIME v3 is rfc263x, now go and read them.");
 }
@@ -81,7 +81,7 @@ gint main (gint argc, gchar **argv)
 {
 	CamelSession *session;
 	CamelSMimeContext *ctx;
-	CamelException *ex;
+	GError **error;
 	CamelCipherValidity *valid;
 	CamelStream *stream1, *stream2, *stream3;
 	GPtrArray *recipients;
diff --git a/camel/tests/stream/test1.c b/camel/tests/stream/test1.c
index e6e12c9..bd40049 100644
--- a/camel/tests/stream/test1.c
+++ b/camel/tests/stream/test1.c
@@ -28,7 +28,7 @@ main(gint argc, gchar **argv)
 		push("trying to open a nonexistant stream, method %d", i);
 		switch (i) {
 		case 0:
-			ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR, 0);
+			ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR, 0, NULL);
 			break;
 		case 1:
 			fd = open("stream.txt", O_RDWR, 0);
@@ -36,13 +36,13 @@ main(gint argc, gchar **argv)
 			break;
 		}
 		check(ss == NULL && errno == ENOENT);
-		check(stat("stream.txt", &st) == -1 && errno == ENOENT);
+		check(g_stat("stream.txt", &st) == -1 && errno == ENOENT);
 		pull();
 
 		push("Creating stream using method %d", i);
 		switch (i) {
 		case 0:
-			ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_CREAT|O_RDWR|O_TRUNC, 0600);
+			ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_CREAT|O_RDWR|O_TRUNC, 0600, NULL);
 			fd = camel_stream_fs_get_fd ((CamelStreamFs *)ss);
 			break;
 		case 1:
@@ -51,14 +51,14 @@ main(gint argc, gchar **argv)
 			break;
 		}
 		check(ss != NULL);
-		check(stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode) && st.st_size == 0);
+		check(g_stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode) && st.st_size == 0);
 		pull();
 
 		test_stream_seekable_writepart(ss);
 		test_stream_seekable_readpart(ss);
 
 		push("getting filesize");
-		check(stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode));
+		check(g_stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode));
 		size = st.st_size;
 		pull();
 
@@ -70,7 +70,7 @@ main(gint argc, gchar **argv)
 		push("re-opening stream");
 		switch (i) {
 		case 0:
-			ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR, 0);
+			ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR, 0, NULL);
 			fd = camel_stream_fs_get_fd ((CamelStreamFs *)ss);
 			break;
 		case 1:
@@ -79,7 +79,7 @@ main(gint argc, gchar **argv)
 			break;
 		}
 		check(ss != NULL);
-		check(stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode) && st.st_size == size);
+		check(g_stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode) && st.st_size == size);
 
 		test_stream_seekable_readpart(ss);
 
@@ -90,7 +90,7 @@ main(gint argc, gchar **argv)
 		push("re-opening stream with truncate");
 		switch (i) {
 		case 0:
-			ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR|O_TRUNC, 0);
+			ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR|O_TRUNC, 0, NULL);
 			fd = camel_stream_fs_get_fd ((CamelStreamFs *)ss);
 			break;
 		case 1:
@@ -99,10 +99,10 @@ main(gint argc, gchar **argv)
 			break;
 		}
 		check(ss != NULL);
-		check(stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode) && st.st_size == 0);
+		check(g_stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode) && st.st_size == 0);
 
 		/* read has to return 0 before eos is set */
-		check(camel_stream_read(CAMEL_STREAM(ss), buffer, 1) == 0);
+		check(camel_stream_read(CAMEL_STREAM(ss), buffer, 1, NULL) == 0);
 		check(camel_stream_eos(CAMEL_STREAM(ss)));
 
 		check_unref(ss, 1);
diff --git a/camel/tests/stream/test3.c b/camel/tests/stream/test3.c
index 6f52e42..3196315 100644
--- a/camel/tests/stream/test3.c
+++ b/camel/tests/stream/test3.c
@@ -70,7 +70,7 @@ main(gint argc, gchar **argv)
 	camel_test_start("CamelSeekableSubstream, file backing");
 	for (j=0;j<SEEKABLE_SUBSTREAM_WAYS;j++) {
 		push("testing writing method %d", j);
-		ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR|O_CREAT|O_TRUNC, 0600);
+		ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR|O_CREAT|O_TRUNC, 0600, NULL);
 		check(ss != NULL);
 		for (i = 0; i < G_N_ELEMENTS (ranges); i++) {
 			push("stream subrange %d-%d", ranges[i].lower, ranges[i].upper);
diff --git a/configure.ac b/configure.ac
index 5eec694..ba808dc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,7 +114,7 @@ LIBEGROUPWISE_CURRENT=13
 LIBEGROUPWISE_REVISION=1
 LIBEGROUPWISE_AGE=0
 
-LIBCAMEL_CURRENT=17
+LIBCAMEL_CURRENT=18
 LIBCAMEL_REVISION=0
 LIBCAMEL_AGE=0
 
diff --git a/docs/reference/calendar/libecal/tmpl/e-cal-check-timezones.sgml b/docs/reference/calendar/libecal/tmpl/e-cal-check-timezones.sgml
index 27cf156..9819733 100644
--- a/docs/reference/calendar/libecal/tmpl/e-cal-check-timezones.sgml
+++ b/docs/reference/calendar/libecal/tmpl/e-cal-check-timezones.sgml
@@ -37,6 +37,19 @@ e-cal-check-timezones
 @const gchar *tzid, gconstpointer custom, GError **error:
 @const gchar *tzid, gconstpointer custom, GError **error:
 @const gchar *tzid, gconstpointer custom, GError **error:
+ const gchar *tzid, gconstpointer custom, GError **error:
+ const gchar *tzid, gconstpointer custom, GError **error:
+ const gchar *tzid, gconstpointer custom, GError **error:
+ const gchar *tzid, gconstpointer custom, GError **error:
+ const gchar *tzid, gconstpointer custom, GError **error:
+ const gchar *tzid, gconstpointer custom, GError **error:
+ const gchar *tzid, gconstpointer custom, GError **error:
+ const gchar *tzid, gconstpointer custom, GError **error:
+ const gchar *tzid, gconstpointer custom, GError **error:
+ const gchar *tzid, gconstpointer custom, GError **error:
+ const gchar *tzid, gconstpointer custom, GError **error:
+ const gchar *tzid, gconstpointer custom, GError **error:
+ const gchar *tzid, gconstpointer custom, GError **error:
 @const gchar *tzid, gconstpointer custom, GError **error: 
 @custom: 
 @error: 
diff --git a/docs/reference/camel/camel-docs.sgml b/docs/reference/camel/camel-docs.sgml
index 706ef6c..59eb933 100644
--- a/docs/reference/camel/camel-docs.sgml
+++ b/docs/reference/camel/camel-docs.sgml
@@ -42,7 +42,6 @@
       <title>Fundamentals</title>
       <xi:include href="xml/camel.xml"/>
       <xi:include href="xml/camel-debug.xml"/>
-      <xi:include href="xml/camel-exception.xml"/>
       <xi:include href="xml/camel-object.xml"/>
       <xi:include href="xml/camel-operation.xml"/>
       <xi:include href="xml/camel-url.xml"/>
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index fd49a3b..5dd7b29 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -2560,23 +2560,6 @@ camel_debug_end
 </SECTION>
 
 <SECTION>
-<FILE>camel-exception</FILE>
-ExceptionId
-CamelException
-CAMEL_EXCEPTION_INITIALISER
-camel_exception_new
-camel_exception_free
-camel_exception_init
-camel_exception_clear
-camel_exception_set
-camel_exception_setv
-camel_exception_xfer
-camel_exception_get_id
-camel_exception_get_description
-camel_exception_is_set
-</SECTION>
-
-<SECTION>
 <FILE>camel-file-utils</FILE>
 O_BINARY
 camel_file_util_encode_fixed_int32
diff --git a/docs/reference/camel/tmpl/camel-cipher-context.sgml b/docs/reference/camel/tmpl/camel-cipher-context.sgml
index 7bb7dc5..b2f7687 100644
--- a/docs/reference/camel/tmpl/camel-cipher-context.sgml
+++ b/docs/reference/camel/tmpl/camel-cipher-context.sgml
@@ -146,7 +146,7 @@ CamelCipherContext
 @hash: 
 @ipart: 
 @opart: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -157,7 +157,7 @@ CamelCipherContext
 
 @context: 
 @ipart: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -171,7 +171,7 @@ CamelCipherContext
 @recipients: 
 @ipart: 
 @opart: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -183,7 +183,7 @@ CamelCipherContext
 @context: 
 @ipart: 
 @opart: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -194,7 +194,7 @@ CamelCipherContext
 
 @context: 
 @istream: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -206,7 +206,7 @@ CamelCipherContext
 @context: 
 @keys: 
 @ostream: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -394,6 +394,62 @@ CamelCipherContext
 @gpointer cert_data: 
 @gpointer cert_data:
 @gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
+ gpointer cert_data:
+ gpointer cert_data: 
 @gpointer cert_data: 
 
 
@@ -422,6 +478,7 @@ CamelCipherContext
 @part: 
 @flags: 
 @ostream: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-data-cache.sgml b/docs/reference/camel/tmpl/camel-data-cache.sgml
index 0c2c3de..3319ad6 100644
--- a/docs/reference/camel/tmpl/camel-data-cache.sgml
+++ b/docs/reference/camel/tmpl/camel-data-cache.sgml
@@ -37,7 +37,7 @@ CamelDataCache
 </para>
 
 @path: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -85,7 +85,7 @@ CamelDataCache
 @cdc: 
 @path: 
 @key: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -97,7 +97,7 @@ CamelDataCache
 @cdc: 
 @path: 
 @key: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -109,7 +109,7 @@ CamelDataCache
 @cdc: 
 @path: 
 @key: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -121,7 +121,7 @@ CamelDataCache
 @cdc: 
 @path: 
 @key: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-data-wrapper.sgml b/docs/reference/camel/tmpl/camel-data-wrapper.sgml
index 8ba63c2..b75b0a4 100644
--- a/docs/reference/camel/tmpl/camel-data-wrapper.sgml
+++ b/docs/reference/camel/tmpl/camel-data-wrapper.sgml
@@ -42,6 +42,7 @@ CamelDataWrapper
 
 @data_wrapper: 
 @stream: 
+ error: 
 @Returns: 
 
 
@@ -52,6 +53,7 @@ CamelDataWrapper
 
 @data_wrapper: 
 @stream: 
+ error: 
 @Returns: 
 
 
@@ -98,6 +100,7 @@ CamelDataWrapper
 
 @data_wrapper: 
 @stream: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-db.sgml b/docs/reference/camel/tmpl/camel-db.sgml
index 259288c..08e58fa 100644
--- a/docs/reference/camel/tmpl/camel-db.sgml
+++ b/docs/reference/camel/tmpl/camel-db.sgml
@@ -167,7 +167,7 @@ CamelDB
 </para>
 
 @path: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -177,7 +177,7 @@ CamelDB
 </para>
 
 @cdb: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -196,7 +196,7 @@ CamelDB
 
 @cdb: 
 @stmt: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -207,7 +207,7 @@ CamelDB
 
 @cdb: 
 @qry_list: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -217,7 +217,7 @@ CamelDB
 </para>
 
 @cdb: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -228,7 +228,7 @@ CamelDB
 
 @cdb: 
 @query: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -238,7 +238,7 @@ CamelDB
 </para>
 
 @cdb: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -248,7 +248,7 @@ CamelDB
 </para>
 
 @cdb: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -259,7 +259,7 @@ CamelDB
 
 @cdb: 
 @folder: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -271,7 +271,7 @@ CamelDB
 @cdb: 
 @old_folder: 
 @new_folder: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -282,7 +282,7 @@ CamelDB
 
 @cdb: 
 @folder: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -294,7 +294,7 @@ CamelDB
 @cdb: 
 @folder: 
 @uid: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -306,7 +306,7 @@ CamelDB
 @cdb: 
 @folder_name: 
 @uids: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -319,7 +319,7 @@ CamelDB
 @folder_name: 
 @shash: 
 @uids: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -329,7 +329,7 @@ CamelDB
 </para>
 
 @cdb: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -342,7 +342,7 @@ CamelDB
 @stmt: 
 @callback: 
 @data: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -353,7 +353,7 @@ CamelDB
 
 @cdb: 
 @record: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -365,7 +365,7 @@ CamelDB
 @cdb: 
 @folder_name: 
 @record: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -376,7 +376,7 @@ CamelDB
 
 @cdb: 
 @folder_name: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -388,7 +388,7 @@ CamelDB
 @cdb: 
 @folder_name: 
 @record: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -400,7 +400,7 @@ CamelDB
 @cdb: 
 @folder_name: 
 @record: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -413,7 +413,7 @@ CamelDB
 @folder_name: 
 @p: 
 @read_mir_callback: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -427,7 +427,7 @@ CamelDB
 @uid: 
 @p: 
 @read_mir_callback: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -439,7 +439,7 @@ CamelDB
 @cdb: 
 @table_name: 
 @count: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -451,7 +451,7 @@ CamelDB
 @cdb: 
 @table_name: 
 @count: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -463,7 +463,7 @@ CamelDB
 @cdb: 
 @table_name: 
 @count: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -475,7 +475,7 @@ CamelDB
 @cdb: 
 @table_name: 
 @count: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -487,7 +487,7 @@ CamelDB
 @cdb: 
 @table_name: 
 @count: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -499,7 +499,7 @@ CamelDB
 @cdb: 
 @table_name: 
 @count: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -511,7 +511,7 @@ CamelDB
 @cdb: 
 @table_name: 
 @count: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -523,7 +523,7 @@ CamelDB
 @cdb: 
 @query: 
 @count: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -542,7 +542,7 @@ CamelDB
 
 @db: 
 @folder_name: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -553,7 +553,7 @@ CamelDB
 
 @db: 
 @folder_name: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -565,7 +565,7 @@ CamelDB
 @db: 
 @folder_name: 
 @vuid: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -577,7 +577,7 @@ CamelDB
 @db: 
 @folder_name: 
 @vuid: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -589,7 +589,7 @@ CamelDB
 @db: 
 @folder_name: 
 @filter: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -601,7 +601,7 @@ CamelDB
 @db: 
 @folder_name: 
 @vuid: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -613,7 +613,7 @@ CamelDB
 @db: 
 @folder_name: 
 @vuid: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -627,7 +627,7 @@ CamelDB
 @sort_by: 
 @collate: 
 @array: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -642,7 +642,7 @@ CamelDB
 @collate: 
 @summary: 
 @table: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -653,7 +653,7 @@ CamelDB
 
 @db: 
 @folder_name: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -664,7 +664,7 @@ CamelDB
 
 @db: 
 @folder_name: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -713,7 +713,7 @@ CamelDB
 
 @cdb: 
 @folder: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -723,7 +723,7 @@ CamelDB
 </para>
 
 @cdb: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -734,7 +734,7 @@ CamelDB
 
 @cdb: 
 @folder_name: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -745,7 +745,7 @@ CamelDB
 
 @db: 
 @folder_name: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -758,7 +758,7 @@ CamelDB
 @folder_name: 
 @uid: 
 @msg: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -770,7 +770,7 @@ CamelDB
 @cdb: 
 @folder_name: 
 @reset_version: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-disco-diary.sgml b/docs/reference/camel/tmpl/camel-disco-diary.sgml
index d098b55..f9bd316 100644
--- a/docs/reference/camel/tmpl/camel-disco-diary.sgml
+++ b/docs/reference/camel/tmpl/camel-disco-diary.sgml
@@ -43,7 +43,7 @@ CamelDiscoDiary
 
 @store: 
 @filename: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -72,7 +72,7 @@ CamelDiscoDiary
 </para>
 
 @diary: 
- ex: 
+ error: 
 
 
 <!-- ##### FUNCTION camel_disco_diary_uidmap_add ##### -->
diff --git a/docs/reference/camel/tmpl/camel-disco-folder.sgml b/docs/reference/camel/tmpl/camel-disco-folder.sgml
index 468a4b0..db6605d 100644
--- a/docs/reference/camel/tmpl/camel-disco-folder.sgml
+++ b/docs/reference/camel/tmpl/camel-disco-folder.sgml
@@ -56,7 +56,7 @@ CamelDiscoFolder
 
 @folder: 
 @uids: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -67,7 +67,7 @@ CamelDiscoFolder
 
 @disco_folder: 
 @uid: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -78,7 +78,7 @@ CamelDiscoFolder
 
 @disco_folder: 
 @expression: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-disco-store.sgml b/docs/reference/camel/tmpl/camel-disco-store.sgml
index 5a5787a..d33bc16 100644
--- a/docs/reference/camel/tmpl/camel-disco-store.sgml
+++ b/docs/reference/camel/tmpl/camel-disco-store.sgml
@@ -51,7 +51,8 @@ CamelDiscoStore
 
 @store: 
 @status: 
- ex: 
+ error: 
+ Returns: 
 
 
 <!-- ##### FUNCTION camel_disco_store_can_work_offline ##### -->
@@ -69,7 +70,7 @@ CamelDiscoStore
 </para>
 
 @store: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -79,6 +80,6 @@ CamelDiscoStore
 </para>
 
 @store: 
- ex: 
+ error: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-exception.sgml b/docs/reference/camel/tmpl/camel-exception.sgml
index f57a116..4f3c77f 100644
--- a/docs/reference/camel/tmpl/camel-exception.sgml
+++ b/docs/reference/camel/tmpl/camel-exception.sgml
@@ -20,113 +20,3 @@ camel-exception
 <!-- ##### SECTION Image ##### -->
 
 
-<!-- ##### ENUM ExceptionId ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### STRUCT CamelException ##### -->
-<para>
-
-</para>
-
- id: 
- desc: 
-
-<!-- ##### MACRO CAMEL_EXCEPTION_INITIALISER ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### FUNCTION camel_exception_new ##### -->
-<para>
-
-</para>
-
- void: 
- Returns: 
-
-
-<!-- ##### FUNCTION camel_exception_free ##### -->
-<para>
-
-</para>
-
- ex: 
-
-
-<!-- ##### FUNCTION camel_exception_init ##### -->
-<para>
-
-</para>
-
- ex: 
-
-
-<!-- ##### FUNCTION camel_exception_clear ##### -->
-<para>
-
-</para>
-
- ex: 
-
-
-<!-- ##### FUNCTION camel_exception_set ##### -->
-<para>
-
-</para>
-
- ex: 
- id: 
- desc: 
-
-
-<!-- ##### FUNCTION camel_exception_setv ##### -->
-<para>
-
-</para>
-
- ex: 
- id: 
- format: 
- Varargs: 
-
-
-<!-- ##### FUNCTION camel_exception_xfer ##### -->
-<para>
-
-</para>
-
- ex_dst: 
- ex_src: 
-
-
-<!-- ##### FUNCTION camel_exception_get_id ##### -->
-<para>
-
-</para>
-
- ex: 
- Returns: 
-
-
-<!-- ##### FUNCTION camel_exception_get_description ##### -->
-<para>
-
-</para>
-
- ex: 
- Returns: 
-
-
-<!-- ##### MACRO camel_exception_is_set ##### -->
-<para>
-
-</para>
-
- ex: 
-
-
diff --git a/docs/reference/camel/tmpl/camel-file-utils.sgml b/docs/reference/camel/tmpl/camel-file-utils.sgml
index 8348df8..a4780e6 100644
--- a/docs/reference/camel/tmpl/camel-file-utils.sgml
+++ b/docs/reference/camel/tmpl/camel-file-utils.sgml
@@ -186,6 +186,7 @@ camel-file-utils
 @fd: 
 @buf: 
 @n: 
+ error: 
 @Returns: 
 
 
@@ -197,6 +198,7 @@ camel-file-utils
 @fd: 
 @buf: 
 @n: 
+ error: 
 @Returns: 
 
 
@@ -208,6 +210,7 @@ camel-file-utils
 @fd: 
 @buf: 
 @n: 
+ error: 
 @Returns: 
 
 
@@ -219,6 +222,7 @@ camel-file-utils
 @fd: 
 @buf: 
 @n: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-filter-driver.sgml b/docs/reference/camel/tmpl/camel-filter-driver.sgml
index eb03a68..dd2cb2c 100644
--- a/docs/reference/camel/tmpl/camel-filter-driver.sgml
+++ b/docs/reference/camel/tmpl/camel-filter-driver.sgml
@@ -34,7 +34,7 @@ CamelFilterDriver
 @driver: 
 @uri: 
 @data: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -142,7 +142,7 @@ CamelFilterDriver
 </para>
 
 @driver: 
- ex: 
+ error: 
 
 
 <!-- ##### FUNCTION camel_filter_driver_filter_message ##### -->
@@ -157,7 +157,7 @@ CamelFilterDriver
 @source: 
 @source_url: 
 @original_source_url: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -169,7 +169,7 @@ CamelFilterDriver
 @driver: 
 @mbox: 
 @original_source_url: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -183,7 +183,7 @@ CamelFilterDriver
 @cache: 
 @uids: 
 @remove: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-filter-search.sgml b/docs/reference/camel/tmpl/camel-filter-search.sgml
index 0cf0410..a109492 100644
--- a/docs/reference/camel/tmpl/camel-filter-search.sgml
+++ b/docs/reference/camel/tmpl/camel-filter-search.sgml
@@ -26,7 +26,7 @@ camel-filter-search
 </para>
 
 @data: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -41,7 +41,7 @@ camel-filter-search
 @info: 
 @source: 
 @expression: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-folder-search.sgml b/docs/reference/camel/tmpl/camel-folder-search.sgml
index 2b1ce65..4e09440 100644
--- a/docs/reference/camel/tmpl/camel-folder-search.sgml
+++ b/docs/reference/camel/tmpl/camel-folder-search.sgml
@@ -77,7 +77,7 @@ CamelFolderSearch
 
 @search: 
 @expr: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -89,7 +89,7 @@ CamelFolderSearch
 @search: 
 @expr: 
 @uids: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -100,7 +100,7 @@ CamelFolderSearch
 
 @search: 
 @expr: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-folder-summary.sgml b/docs/reference/camel/tmpl/camel-folder-summary.sgml
index 5fa2dad..5cdadca 100644
--- a/docs/reference/camel/tmpl/camel-folder-summary.sgml
+++ b/docs/reference/camel/tmpl/camel-folder-summary.sgml
@@ -224,7 +224,7 @@ CamelFolderSummary
 </para>
 
 @s: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -234,7 +234,7 @@ CamelFolderSummary
 </para>
 
 @s: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -255,7 +255,7 @@ CamelFolderSummary
 @s: 
 @store: 
 @folder_name: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -265,7 +265,7 @@ CamelFolderSummary
 </para>
 
 @s: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -311,7 +311,7 @@ CamelFolderSummary
 </para>
 
 @s: 
- ex: 
+ error: 
 
 
 <!-- ##### FUNCTION camel_folder_summary_insert ##### -->
diff --git a/docs/reference/camel/tmpl/camel-folder.sgml b/docs/reference/camel/tmpl/camel-folder.sgml
index ab70624..2ae2c2e 100644
--- a/docs/reference/camel/tmpl/camel-folder.sgml
+++ b/docs/reference/camel/tmpl/camel-folder.sgml
@@ -145,7 +145,7 @@ CamelFolder
 </para>
 
 @folder: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -156,7 +156,7 @@ CamelFolder
 
 @folder: 
 @expunge: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -184,7 +184,7 @@ CamelFolder
 </para>
 
 @folder: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -326,7 +326,7 @@ CamelFolder
 @message: 
 @info: 
 @appended_uid: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -391,7 +391,7 @@ CamelFolder
 
 @folder: 
 @uid: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -402,7 +402,7 @@ CamelFolder
 
 @folder: 
 @uid: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -440,7 +440,7 @@ CamelFolder
 
 @folder: 
 @uids: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -480,7 +480,7 @@ CamelFolder
 
 @folder: 
 @expr: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -492,7 +492,7 @@ CamelFolder
 @folder: 
 @expr: 
 @uids: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -512,7 +512,7 @@ CamelFolder
 
 @folder: 
 @expression: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -554,7 +554,7 @@ CamelFolder
 @dest: 
 @transferred_uids: 
 @delete_originals: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -689,7 +689,7 @@ CamelFolder
 
 @folder: 
 @uid: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-lock-client.sgml b/docs/reference/camel/tmpl/camel-lock-client.sgml
index fa7498f..f1df947 100644
--- a/docs/reference/camel/tmpl/camel-lock-client.sgml
+++ b/docs/reference/camel/tmpl/camel-lock-client.sgml
@@ -26,7 +26,7 @@ camel-lock-client
 </para>
 
 @path: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-lock.sgml b/docs/reference/camel/tmpl/camel-lock.sgml
index f6b4943..f5bc484 100644
--- a/docs/reference/camel/tmpl/camel-lock.sgml
+++ b/docs/reference/camel/tmpl/camel-lock.sgml
@@ -69,7 +69,7 @@ camel-lock
 </para>
 
 @path: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -80,7 +80,7 @@ camel-lock
 
 @fd: 
 @type: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -91,7 +91,7 @@ camel-lock
 
 @fd: 
 @type: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -127,7 +127,7 @@ camel-lock
 @path: 
 @fd: 
 @type: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-mime-parser.sgml b/docs/reference/camel/tmpl/camel-mime-parser.sgml
index 0a829bb..d6cddf9 100644
--- a/docs/reference/camel/tmpl/camel-mime-parser.sgml
+++ b/docs/reference/camel/tmpl/camel-mime-parser.sgml
@@ -83,6 +83,7 @@ CamelMimeParser
 
 @m: 
 @stream: 
+ error: 
 @Returns: 
 
 
@@ -186,6 +187,7 @@ CamelMimeParser
 @parser: 
 @databuffer: 
 @len: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-mime-part.sgml b/docs/reference/camel/tmpl/camel-mime-part.sgml
index 4698723..26bb04a 100644
--- a/docs/reference/camel/tmpl/camel-mime-part.sgml
+++ b/docs/reference/camel/tmpl/camel-mime-part.sgml
@@ -233,6 +233,7 @@ CamelMimePart
 
 @mime_part: 
 @parser: 
+ error: 
 @Returns: 
 
 
@@ -263,6 +264,8 @@ CamelMimePart
 
 @mime_part: 
 @mp: 
+ error: 
+ Returns: 
 
 
 <!-- ##### FUNCTION camel_mime_message_build_preview ##### -->
diff --git a/docs/reference/camel/tmpl/camel-movemail.sgml b/docs/reference/camel/tmpl/camel-movemail.sgml
index 0860f98..d187d22 100644
--- a/docs/reference/camel/tmpl/camel-movemail.sgml
+++ b/docs/reference/camel/tmpl/camel-movemail.sgml
@@ -27,7 +27,7 @@ camel-movemail
 
 @source: 
 @dest: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-multipart-signed.sgml b/docs/reference/camel/tmpl/camel-multipart-signed.sgml
index 74c8069..a6c77b8 100644
--- a/docs/reference/camel/tmpl/camel-multipart-signed.sgml
+++ b/docs/reference/camel/tmpl/camel-multipart-signed.sgml
@@ -41,7 +41,7 @@ CamelMultipartSigned
 </para>
 
 @mps: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-net-utils.sgml b/docs/reference/camel/tmpl/camel-net-utils.sgml
index dd30648..1463976 100644
--- a/docs/reference/camel/tmpl/camel-net-utils.sgml
+++ b/docs/reference/camel/tmpl/camel-net-utils.sgml
@@ -161,7 +161,7 @@ camel-net-utils
 @name: 
 @service: 
 @hints: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -183,7 +183,7 @@ camel-net-utils
 @host: 
 @serv: 
 @flags: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-offline-folder.sgml b/docs/reference/camel/tmpl/camel-offline-folder.sgml
index 15bd22d..87b2b59 100644
--- a/docs/reference/camel/tmpl/camel-offline-folder.sgml
+++ b/docs/reference/camel/tmpl/camel-offline-folder.sgml
@@ -56,7 +56,7 @@ CamelOfflineFolder
 
 @offline: 
 @expression: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-offline-journal.sgml b/docs/reference/camel/tmpl/camel-offline-journal.sgml
index 025e6ce..1ed0a27 100644
--- a/docs/reference/camel/tmpl/camel-offline-journal.sgml
+++ b/docs/reference/camel/tmpl/camel-offline-journal.sgml
@@ -57,7 +57,7 @@ CamelOfflineJournal
 </para>
 
 @journal: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -67,7 +67,7 @@ CamelOfflineJournal
 </para>
 
 @journal: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-offline-store.sgml b/docs/reference/camel/tmpl/camel-offline-store.sgml
index 4782f5c..4a1f37b 100644
--- a/docs/reference/camel/tmpl/camel-offline-store.sgml
+++ b/docs/reference/camel/tmpl/camel-offline-store.sgml
@@ -33,7 +33,7 @@ CamelOfflineStore
 
 @store: 
 @state: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -43,7 +43,7 @@ CamelOfflineStore
 </para>
 
 @store: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -53,7 +53,7 @@ CamelOfflineStore
 </para>
 
 @store: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-provider.sgml b/docs/reference/camel/tmpl/camel-provider.sgml
index 7f39c8b..7c071c9 100644
--- a/docs/reference/camel/tmpl/camel-provider.sgml
+++ b/docs/reference/camel/tmpl/camel-provider.sgml
@@ -414,7 +414,7 @@ camel-provider
 
 @url: 
 @auto_detected: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -464,7 +464,7 @@ camel-provider
 </para>
 
 @path: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -491,7 +491,7 @@ camel-provider
 </para>
 
 @url_string: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -511,7 +511,7 @@ camel-provider
 @provider: 
 @url: 
 @auto_detected: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-sasl.sgml b/docs/reference/camel/tmpl/camel-sasl.sgml
index f44bc6b..2a7e348 100644
--- a/docs/reference/camel/tmpl/camel-sasl.sgml
+++ b/docs/reference/camel/tmpl/camel-sasl.sgml
@@ -53,7 +53,7 @@ CamelSasl
 
 @sasl: 
 @token: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -64,7 +64,7 @@ CamelSasl
 
 @sasl: 
 @token: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-seekable-stream.sgml b/docs/reference/camel/tmpl/camel-seekable-stream.sgml
index 275e599..ae831b7 100644
--- a/docs/reference/camel/tmpl/camel-seekable-stream.sgml
+++ b/docs/reference/camel/tmpl/camel-seekable-stream.sgml
@@ -50,6 +50,7 @@ CamelSeekableStream
 @stream: 
 @offset: 
 @policy: 
+ error: 
 @Returns: 
 
 
@@ -70,6 +71,7 @@ CamelSeekableStream
 @stream: 
 @start: 
 @end: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-service.sgml b/docs/reference/camel/tmpl/camel-service.sgml
index de3c534..0054fd4 100644
--- a/docs/reference/camel/tmpl/camel-service.sgml
+++ b/docs/reference/camel/tmpl/camel-service.sgml
@@ -55,7 +55,7 @@ CamelService
 @session: 
 @provider: 
 @url: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -65,7 +65,7 @@ CamelService
 </para>
 
 @service: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -76,7 +76,7 @@ CamelService
 
 @service: 
 @clean: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -140,7 +140,7 @@ CamelService
 </para>
 
 @service: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-session.sgml b/docs/reference/camel/tmpl/camel-session.sgml
index 047d249..f8ed9ee 100644
--- a/docs/reference/camel/tmpl/camel-session.sgml
+++ b/docs/reference/camel/tmpl/camel-session.sgml
@@ -74,7 +74,7 @@ CamelSession
 
 @msg: 
 @id: 
- ex: 
+ error: 
 @ops: 
 @op: 
 @session: 
@@ -117,7 +117,7 @@ CamelSession
 @session: 
 @url_string: 
 @type: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -129,7 +129,7 @@ CamelSession
 @session: 
 @url_string: 
 @type: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -140,7 +140,7 @@ CamelSession
 
 @session: 
 @url_string: 
- ex: 
+ error: 
 
 
 <!-- ##### MACRO camel_session_get_transport ##### -->
@@ -150,7 +150,7 @@ CamelSession
 
 @session: 
 @url_string: 
- ex: 
+ error: 
 
 
 <!-- ##### FUNCTION camel_session_get_storage_path ##### -->
@@ -160,7 +160,7 @@ CamelSession
 
 @session: 
 @service: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -175,7 +175,7 @@ CamelSession
 @prompt: 
 @item: 
 @flags: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -188,7 +188,7 @@ CamelSession
 @service: 
 @domain: 
 @item: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -240,7 +240,7 @@ CamelSession
 
 @session: 
 @type: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -359,7 +359,8 @@ CamelSession
 @folder: 
 @message: 
 @address: 
- ex: 
+ error: 
+ Returns: 
 
 
 <!-- ##### ENUM CamelSessionLock ##### -->
diff --git a/docs/reference/camel/tmpl/camel-store.sgml b/docs/reference/camel/tmpl/camel-store.sgml
index 99021d1..ab611ee 100644
--- a/docs/reference/camel/tmpl/camel-store.sgml
+++ b/docs/reference/camel/tmpl/camel-store.sgml
@@ -364,7 +364,7 @@ CamelStore
 @store: 
 @folder_name: 
 @flags: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -374,7 +374,7 @@ CamelStore
 </para>
 
 @store: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -384,7 +384,7 @@ CamelStore
 </para>
 
 @store: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -394,7 +394,7 @@ CamelStore
 </para>
 
 @store: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -406,7 +406,7 @@ CamelStore
 @store: 
 @parent_name: 
 @folder_name: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -417,7 +417,7 @@ CamelStore
 
 @store: 
 @folder_name: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -429,7 +429,7 @@ CamelStore
 @store: 
 @old_namein: 
 @new_name: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -486,7 +486,7 @@ CamelStore
 
 @store: 
 @expunge: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -498,7 +498,7 @@ CamelStore
 @store: 
 @top: 
 @flags: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -593,7 +593,7 @@ CamelStore
 
 @store: 
 @folder_name: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -604,7 +604,7 @@ CamelStore
 
 @store: 
 @folder_name: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -614,7 +614,7 @@ CamelStore
 </para>
 
 @store: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -636,7 +636,7 @@ CamelStore
 
 @store: 
 @info: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-stream-buffer.sgml b/docs/reference/camel/tmpl/camel-stream-buffer.sgml
index 7300e9f..12206f4 100644
--- a/docs/reference/camel/tmpl/camel-stream-buffer.sgml
+++ b/docs/reference/camel/tmpl/camel-stream-buffer.sgml
@@ -67,6 +67,7 @@ CamelStreamBuffer
 @sbf: 
 @buf: 
 @max: 
+ error: 
 @Returns: 
 
 
@@ -76,6 +77,7 @@ CamelStreamBuffer
 </para>
 
 @sbf: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-stream-fs.sgml b/docs/reference/camel/tmpl/camel-stream-fs.sgml
index 8d4a787..0f6ee7e 100644
--- a/docs/reference/camel/tmpl/camel-stream-fs.sgml
+++ b/docs/reference/camel/tmpl/camel-stream-fs.sgml
@@ -34,6 +34,7 @@ CamelStreamFs
 @name: 
 @flags: 
 @mode: 
+ error: 
 @Returns: 
 
 
@@ -47,6 +48,7 @@ CamelStreamFs
 @mode: 
 @start: 
 @end: 
+ error: 
 @Returns: 
 
 
@@ -67,6 +69,7 @@ CamelStreamFs
 @fd: 
 @start: 
 @end: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-stream.sgml b/docs/reference/camel/tmpl/camel-stream.sgml
index 84f5063..ca4f3c8 100644
--- a/docs/reference/camel/tmpl/camel-stream.sgml
+++ b/docs/reference/camel/tmpl/camel-stream.sgml
@@ -34,6 +34,7 @@ CamelStream
 @stream: 
 @buffer: 
 @n: 
+ error: 
 @Returns: 
 
 
@@ -45,6 +46,7 @@ CamelStream
 @stream: 
 @buffer: 
 @n: 
+ error: 
 @Returns: 
 
 
@@ -54,6 +56,7 @@ CamelStream
 </para>
 
 @stream: 
+ error: 
 @Returns: 
 
 
@@ -63,6 +66,7 @@ CamelStream
 </para>
 
 @stream: 
+ error: 
 @Returns: 
 
 
@@ -81,6 +85,7 @@ CamelStream
 </para>
 
 @stream: 
+ error: 
 @Returns: 
 
 
@@ -91,6 +96,7 @@ CamelStream
 
 @stream: 
 @string: 
+ error: 
 @Returns: 
 
 
@@ -123,6 +129,7 @@ CamelStream
 
 @stream: 
 @output_stream: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-tcp-stream.sgml b/docs/reference/camel/tmpl/camel-tcp-stream.sgml
index 71a05b9..ae97977 100644
--- a/docs/reference/camel/tmpl/camel-tcp-stream.sgml
+++ b/docs/reference/camel/tmpl/camel-tcp-stream.sgml
@@ -69,6 +69,7 @@ CamelTcpStream
 
 @stream: 
 @host: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-transport.sgml b/docs/reference/camel/tmpl/camel-transport.sgml
index 5e87fac..04e6225 100644
--- a/docs/reference/camel/tmpl/camel-transport.sgml
+++ b/docs/reference/camel/tmpl/camel-transport.sgml
@@ -35,7 +35,7 @@ CamelTransport
 @message: 
 @from: 
 @recipients: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-unused.sgml b/docs/reference/camel/tmpl/camel-unused.sgml
index 6d2927c..1771500 100644
--- a/docs/reference/camel/tmpl/camel-unused.sgml
+++ b/docs/reference/camel/tmpl/camel-unused.sgml
@@ -154,6 +154,34 @@ CamelDigestStore
 CamelDigestSummary
 
 
+<!-- ##### SECTION ./tmpl/camel-exception.sgml:Image ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/camel-exception.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/camel-exception.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/camel-exception.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/camel-exception.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/camel-exception.sgml:Title ##### -->
+camel-exception
+
+
 <!-- ##### SECTION ./tmpl/camel-groupwise-folder.sgml:Image ##### -->
 
 
@@ -2294,6 +2322,12 @@ streams
 @obj: 
 @ctype: 
 
+<!-- ##### MACRO CAMEL_EXCEPTION_INITIALISER ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### MACRO CAMEL_GROUPWISE_FOLDER_LOCK ##### -->
 <para>
 
@@ -2708,6 +2742,12 @@ streams
 @CAMEL_DISCO_DIARY_ARG_UID: 
 @CAMEL_DISCO_DIARY_ARG_UID_LIST: 
 
+<!-- ##### STRUCT CamelException ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### STRUCT CamelGroupwiseFolder ##### -->
 <para>
 
@@ -3884,6 +3924,12 @@ streams
 @user_data: 
 @Returns: 
 
+<!-- ##### ENUM ExceptionId ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### MACRO GW_PARAM_FILTER_INBOX ##### -->
 <para>
 
@@ -4499,6 +4545,85 @@ streams
 
 @Returns: 
 
+<!-- ##### FUNCTION camel_exception_clear ##### -->
+<para>
+
+</para>
+
+ ex: 
+
+<!-- ##### FUNCTION camel_exception_free ##### -->
+<para>
+
+</para>
+
+ ex: 
+
+<!-- ##### FUNCTION camel_exception_get_description ##### -->
+<para>
+
+</para>
+
+ ex: 
+ Returns: 
+
+<!-- ##### FUNCTION camel_exception_get_id ##### -->
+<para>
+
+</para>
+
+ ex: 
+ Returns: 
+
+<!-- ##### FUNCTION camel_exception_init ##### -->
+<para>
+
+</para>
+
+ ex: 
+
+<!-- ##### MACRO camel_exception_is_set ##### -->
+<para>
+
+</para>
+
+ ex: 
+
+<!-- ##### FUNCTION camel_exception_new ##### -->
+<para>
+
+</para>
+
+ void: 
+ Returns: 
+
+<!-- ##### FUNCTION camel_exception_set ##### -->
+<para>
+
+</para>
+
+ ex: 
+ id: 
+ desc: 
+
+<!-- ##### FUNCTION camel_exception_setv ##### -->
+<para>
+
+</para>
+
+ ex: 
+ id: 
+ format: 
+ Varargs: 
+
+<!-- ##### FUNCTION camel_exception_xfer ##### -->
+<para>
+
+</para>
+
+ ex_dst: 
+ ex_src: 
+
 <!-- ##### FUNCTION camel_file_util_decode_size_t ##### -->
 <para>
 
diff --git a/docs/reference/camel/tmpl/camel-url.sgml b/docs/reference/camel/tmpl/camel-url.sgml
index 4a367b6..f69c781 100644
--- a/docs/reference/camel/tmpl/camel-url.sgml
+++ b/docs/reference/camel/tmpl/camel-url.sgml
@@ -80,7 +80,7 @@ camel-url
 </para>
 
 @url_string: 
- ex: 
+ error: 
 @Returns: 
 
 
diff --git a/docs/reference/camel/tmpl/camel-vee-folder.sgml b/docs/reference/camel/tmpl/camel-vee-folder.sgml
index a1fa0ee..a43eb09 100644
--- a/docs/reference/camel/tmpl/camel-vee-folder.sgml
+++ b/docs/reference/camel/tmpl/camel-vee-folder.sgml
@@ -98,7 +98,7 @@ CamelVeeFolder
 
 @vf: 
 @sub: 
- ex: 
+ error: 
 @Returns: 
 
 
@@ -144,7 +144,7 @@ CamelVeeFolder
 </para>
 
 @vf: 
- ex: 
+ error: 
 
 
 <!-- ##### FUNCTION camel_vee_folder_get_unread_vfolder ##### -->
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ca7fbf5..2bbdbf8 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -38,7 +38,6 @@ camel/camel-debug.c
 camel/camel-disco-diary.c
 camel/camel-disco-folder.c
 camel/camel-disco-store.c
-camel/camel-exception.c
 camel/camel-file-utils.c
 camel/camel-filter-driver.c
 camel/camel-filter-search.c
@@ -153,6 +152,7 @@ camel/providers/imapx/camel-imapx-folder.c
 camel/providers/imapx/camel-imapx-provider.c
 camel/providers/imapx/camel-imapx-server.c
 camel/providers/imapx/camel-imapx-store.c
+camel/providers/imapx/camel-imapx-stream.c
 camel/providers/local/camel-local-folder.c
 camel/providers/local/camel-local-provider.c
 camel/providers/local/camel-local-store.c



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