From 8ff9c4f5b6c1e775e4f206745b14370c7ccd731d Mon Sep 17 00:00:00 2001 From: Phaedrus Leeds Date: Wed, 10 Nov 2021 11:47:35 -0800 Subject: [PATCH] metadata: Document file not found error code While working on the port of Flatpak to libappstream[1] I noticed that we currently don't have proper error checking when loading an appstream file with appstream-glib that turns out not to exist.[2] appstream-glib was patched to return G_IO_ERROR_NOT_FOUND in that case[3] and libappstream already does so in its corresponding API, but this patch documents that so that if the implementation here is changed it will hopefully still meet this requirement. [1] https://github.com/flatpak/flatpak/pull/4426 [2] https://github.com/flatpak/flatpak/blob/284edffe89ecb78a19d01da065030d9f3bf31c76/app/flatpak-builtins-utils.c#L1169 [3] https://github.com/hughsie/appstream-glib/pull/268 --- src/as-metadata.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/as-metadata.c b/src/as-metadata.c index 0bf79b69..a0fae850 100644 --- a/src/as-metadata.c +++ b/src/as-metadata.c @@ -639,6 +639,9 @@ as_metadata_parse_desktop_data (AsMetadata *metad, const gchar *data, const gcha * * Parses an AppStream upstream metadata file. * + * If @file does not exist, %G_IO_ERROR_NOT_FOUND will be returned. Other + * #GIOErrors and #AsMetadataErrors may be returned as appropriate. + * * Returns: %TRUE if the file was parsed without error. **/ gboolean