Get context error support.
authorThadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
Sat, 26 Jan 2008 23:53:32 +0000 (21:53 -0200)
committerThadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
Sat, 26 Jan 2008 23:53:32 +0000 (21:53 -0200)
include/atompub/error.h
src/ctx.c

index 79614b7..48bb429 100644 (file)
@@ -23,6 +23,7 @@
 #include <atompub/ctx.h>
 #include <glib.h>
 
+GError *atom_error_get (AtomCtx *);
 void atom_error_set (AtomCtx *, GError *);
 
 #endif
index 9b81a3b..7289ab3 100644 (file)
--- a/src/ctx.c
+++ b/src/ctx.c
@@ -40,9 +40,17 @@ atom_ctx_new ()
 void
 atom_error_set (AtomCtx *ctx, GError *error)
 {
+  if (ctx->error)
+    g_error_free (ctx->error);
   ctx->error = error;
 }
 
+GError *
+atom_error_get (AtomCtx *ctx)
+{
+  return ctx->error;
+}
+
 void *
 atom_config_data (AtomCtx *ctx)
 {