New error interface: migrated core, backends and frontends to it
[cascardo/atompub.git] / backend / files / giochannel.c
index e8a4bb7..dde0c56 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <glib.h>
 #include <atompub/atom.h>
+#include <atompub/atom-glib.h>
 
 static gchar *
 giochannel_iri_to_filename (AtomCtx *ctx, IRI *iri)
@@ -44,15 +45,19 @@ giochannel_atom_retrieve_resource (AtomCtx *ctx, IRI *iri)
   g_free (filename);
   if (channel == NULL)
     {
-      atom_error_set (ctx, error);
+      AtomError *aerr = atom_error_new_from_gerror (error);
+      atom_error_set (ctx, aerr);
+      g_error_free (error);
       return NULL;
     }
   error = NULL;
   if (g_io_channel_read_to_end (channel, &data, &len, &error) !=
       G_IO_STATUS_NORMAL)
     {
+      AtomError *aerr = atom_error_new_from_gerror (error);
       g_io_channel_unref (channel);
-      atom_error_set (ctx, error);
+      atom_error_set (ctx, aerr);
+      g_error_free (error);
       return NULL;
     }
   g_io_channel_unref (channel);