aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-exception.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-exception.c')
-rw-r--r--camel/camel-exception.c69
1 files changed, 59 insertions, 10 deletions
diff --git a/camel/camel-exception.c b/camel/camel-exception.c
index e16c152ff2..254b3046e9 100644
--- a/camel/camel-exception.c
+++ b/camel/camel-exception.c
@@ -27,18 +27,16 @@
#include <config.h>
#include "camel-exception.h"
-void
-camel_exception_free (CamelException *exception)
-{
- if (!exception) return;
-
- if (exception->desc)
- g_free (exception->desc);
-
- g_free (exception);
-}
+/**
+ * camel_exception_new: allocate a new exception object.
+ *
+ * Create and returns a new exception object.
+ *
+ *
+ * Return value: The newly allocated exception object.
+ **/
CamelException *
camel_exception_new ()
{
@@ -48,18 +46,69 @@ camel_exception_new ()
return ex;
}
+/**
+ * camel_exception_free: Free an exception
+ * @exception: The exception object to free
+ *
+ * Free an exception object. If the exception
+ * is NULL, nothing is done, the routine simply
+ * returns.
+ **/
+void
+camel_exception_free (CamelException *exception)
+{
+ if (!exception) return;
+
+ /* free the description text */
+ if (exception->desc)
+ g_free (exception->desc);
+ /* free the exeption itself */
+ g_free (exception);
+}
+/**
+ * camel_exception_set: set an exception
+ * @ex: exception object
+ * @id: exception id
+ * @desc: textual description of the exception
+ *
+ * Set the value of an exception. The exception id is
+ * a unique number representing the exception. The
+ * textual description is a small text explaining
+ * what happened and provoked the exception.
+ *
+ * When @ex is NULL, nothing is done, this routine
+ * simply returns.
+ *
+ **/
void
camel_exception_set (CamelException *ex,
ExceptionId id,
const char *desc)
{
+ /* if no exception is given, do nothing */
+ if (!ex) return;
+
ex->id = id;
+
+ /* remove the previous exception description */
if (ex->desc)
g_free (ex->desc);
ex->desc = g_strdup (desc);
}
+
+
+/**
+ * camel_exception_xfer: transfer an exception
+ * @ex_dst: Destination exception object
+ * @ex_src: Source exception object
+ *
+ * Transfer the content of an exception from
+ * an exception object to another.
+ * The destination exception receives the id and
+ * the description text of the source exception.
+ **/
void
camel_exception_xfer (CamelException *ex_dst,
CamelException *ex_src)