[gom] gom: Report error correctly when the repository isn't set
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gom] gom: Report error correctly when the repository isn't set
- Date: Tue, 6 May 2014 19:43:49 +0000 (UTC)
commit 94d26ecefa76177ecf110dbada7ef32f24b7d958
Author: Bastien Nocera <hadess hadess net>
Date: Tue May 6 20:46:58 2014 +0200
gom: Report error correctly when the repository isn't set
gom_resource_save_sync() would fail without returning an error, which
could cause problems.
gom/gom-error.h | 3 ++-
gom/gom-resource.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gom/gom-error.h b/gom/gom-error.h
index 8f8a404..d2569f5 100644
--- a/gom/gom-error.h
+++ b/gom/gom-error.h
@@ -33,7 +33,8 @@ enum _GomError
GOM_ERROR_COMMAND_NO_SQL,
GOM_ERROR_COMMAND_SQLITE,
GOM_ERROR_REPOSITORY_EMPTY_RESULT,
- GOM_ERROR_RESOURCE_CURSOR
+ GOM_ERROR_RESOURCE_CURSOR,
+ GOM_ERROR_COMMAND_NO_REPOSITORY
};
GQuark gom_error_quark (void) G_GNUC_CONST;
diff --git a/gom/gom-resource.c b/gom/gom-resource.c
index 2b3743b..225e8db 100644
--- a/gom/gom-resource.c
+++ b/gom/gom-resource.c
@@ -597,7 +597,8 @@ gom_resource_save_sync (GomResource *resource,
priv = resource->priv;
if (!priv->repository) {
- g_warning("Cannot save resource, no repository set!");
+ g_set_error(error, GOM_ERROR, GOM_ERROR_COMMAND_NO_REPOSITORY,
+ _("Cannot save resource, no repository set"));
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]