Start categorizing GError types in GES

This commit is contained in:
Thibault Saunier 2013-03-18 12:41:06 -03:00
parent 5b2183076a
commit 6a3331cc67
7 changed files with 81 additions and 7 deletions

View 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>

View file

@ -11,7 +11,6 @@ GES_VERSION_MINOR
GES_VERSION_NANO
<SUBSECTION Standard>
GES_PADDING
GES_ERROR_DOMAIN
GES_PADDING_LARGE
GESAssetLoadingReturn
</SECTION>
@ -22,6 +21,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>

View 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 \

View 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 */

View 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)));

65
ges/ges-gerror.h Normal file
View file

@ -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__ */

View file

@ -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__ */