Start categorizing GError types in GES
authorThibault Saunier <thibault.saunier@collabora.com>
Mon, 18 Mar 2013 15:41:06 +0000 (12:41 -0300)
committerThibault Saunier <thibault.saunier@collabora.com>
Tue, 19 Mar 2013 23:06:30 +0000 (20:06 -0300)
docs/libs/ges-docs.sgml
docs/libs/ges-sections.txt
ges/Makefile.am
ges/ges-asset.c
ges/ges-base-xml-formatter.c
ges/ges-gerror.h [new file with mode: 0644]
ges/ges.h

index 0673ffb..0b6525e 100644 (file)
@@ -30,6 +30,7 @@ platform as well as Windows. It is released under the GNU Library General Public
   <xi:include href="architecture.xml"/>
   <xi:include href="xml/ges-common.xml"/>
   <xi:include href="xml/ges-enums.xml"/>
+  <xi:include href="xml/ges-gerror.xml"/>
   </chapter>
 
   <chapter>
index 7f1e4fb..6bb60d4 100644 (file)
@@ -11,7 +11,6 @@ GES_VERSION_MINOR
 GES_VERSION_NANO
 <SUBSECTION Standard>
 GES_PADDING
-GES_ERROR_DOMAIN
 GES_PADDING_LARGE
 GESAssetLoadingReturn
 </SECTION>
@@ -23,6 +22,15 @@ GESAssetLoadingReturn
 </SECTION>
 
 <SECTION>
+<FILE>ges-gerror</FILE>
+<TITLE>GES GErrors</TITLE>
+GES_ASSET_ERROR
+GES_FORMATTER_ERROR
+GESAssetError
+GESFormatterError
+</SECTION>
+
+<SECTION>
 <FILE>ges-enums</FILE>
 <TITLE>GES Enums</TITLE>
 GESTrackType
index ba447e9..71ccb4c 100644 (file)
@@ -67,6 +67,7 @@ libges_@GST_API_VERSION@include_HEADERS =     \
        ges-types.h                             \
        ges.h                                   \
        ges-enums.h                             \
+       ges-gerror.h                            \
        ges-custom-source-clip.h                \
        ges-meta-container.h        \
        ges-simple-timeline-layer.h             \
index 3aefbbb..c66aec6 100644 (file)
@@ -171,7 +171,7 @@ _check_and_update_parameters (GType * extractable_type, const gchar * id,
         g_type_name (old_type));
 
     if (error && *error == NULL)
-      g_set_error (error, GES_ERROR_DOMAIN, 0,
+      g_set_error (error, GES_ASSET_ERROR, GES_ASSET_WRONG_ID,
           "Wrong ID, can not find any extractable_type");
     return NULL;
   }
@@ -182,7 +182,7 @@ _check_and_update_parameters (GType * extractable_type, const gchar * id,
 
     g_free (real_id);
     if (error && *error == NULL)
-      g_set_error (error, GES_ERROR_DOMAIN, 0, "Wrong ID");
+      g_set_error (error, GES_ASSET_ERROR, GES_ASSET_WRONG_ID, "Wrong ID");
 
     return NULL;
   }
@@ -224,7 +224,7 @@ async_initable_init_async (GAsyncInitable * initable, gint io_priority,
     case GES_ASSET_LOADING_ERROR:
     {
       if (error == NULL)
-        g_set_error (&error, GES_ERROR_DOMAIN, 1,
+        g_set_error (&error, GES_ASSET_ERROR, GES_ASSET_ERROR_LOADING,
             "Could not start loading asset");
 
       /* FIXME Define error code */
index c692b78..a821bd2 100644 (file)
@@ -688,7 +688,7 @@ ges_base_xml_formatter_add_clip (GESBaseXmlFormatter * self,
 
   entry = g_hash_table_lookup (priv->layers, GINT_TO_POINTER (layer_prio));
   if (entry == NULL) {
-    g_set_error (error, GES_ERROR_DOMAIN, 0,
+    g_set_error (error, GES_FORMATTER_ERROR, GES_FORMATTER_WRONG_INPUT_FILE,
         "We got a Clip in a layer"
         " that does not exist, something is wrong either in the project file or"
         " in %s", g_type_name (G_OBJECT_TYPE (self)));
diff --git a/ges/ges-gerror.h b/ges/ges-gerror.h
new file mode 100644 (file)
index 0000000..4052a53
--- /dev/null
@@ -0,0 +1,65 @@
+/* GStreamer Editing Services
+ * Copyright (C) 2013 Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/**
+ * SECTION: ges-gerror
+ * @short_description: GError — Categorized error messages
+ */
+
+#ifndef __GES_ERROR_H__
+#define __GES_ERROR_H__
+
+G_BEGIN_DECLS
+
+/**
+ * GES_ASSET_ERROR:
+ *
+ * An error happend using an asset
+ */
+#define GES_ASSET_ERROR g_quark_from_static_string("GES_ASSET_ERROR")
+
+/**
+ * GES_FORMATTER_ERROR:
+ *
+ * An error happend using a formatter
+ */
+#define GES_FORMATTER_ERROR g_quark_from_static_string("GES_FORMATTER_ERROR")
+
+/**
+ * GESAssetError:
+ * @GES_ASSET_WRONG_ID: The ID passed is malformed
+ * @GES_ASSET_ERROR_LOADING: An error happened while loading the asset
+ */
+typedef enum
+{
+  GES_ASSET_WRONG_ID,
+  GES_ASSET_ERROR_LOADING
+} GESAssetError;
+
+/**
+ * GESFormatterError:
+ * @GES_FORMATTER_WRONG_INPUT_FILE: The formatted files was malformed
+ */
+typedef enum
+{
+  GES_FORMATTER_WRONG_INPUT_FILE,
+} GESFormatterError;
+
+G_END_DECLS
+#endif /* __GES_ERROR_H__ */
index 0a6b1b4..88399a4 100644 (file)
--- a/ges/ges.h
+++ b/ges/ges.h
@@ -75,6 +75,7 @@
 #include <ges/ges-pitivi-formatter.h>
 #include <ges/ges-utils.h>
 #include <ges/ges-meta-container.h>
+#include <ges/ges-gerror.h>
 
 G_BEGIN_DECLS
 
@@ -88,8 +89,6 @@ gboolean ges_init    (void);
 void     ges_version (guint * major, guint * minor, guint * micro,
                       guint * nano);
 
-#define GES_ERROR_DOMAIN g_quark_from_static_string("GES")
-
 G_END_DECLS
 
 #endif /* __GES_H__ */