aboutsummaryrefslogtreecommitdiffstats
path: root/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Nathan Samson <nathansamson@gmail.com>2011-09-05 22:14:53 +0200
committerGravatar Nathan Samson <nathansamson@gmail.com>2011-09-05 22:15:30 +0200
commit11becb87505b8cdf6fbf2f10941f87d394e49f80 (patch)
tree01e92af5557cddce2f69c5bb758692d52146bcd3 /parse-xml.c
parent65ef1bae20e9c908745115d0d82b7232dc5d1b26 (diff)
downloadsubsurface-11becb87505b8cdf6fbf2f10941f87d394e49f80.tar.gz
Report errors when opening files
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
Diffstat (limited to 'parse-xml.c')
-rw-r--r--parse-xml.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/parse-xml.c b/parse-xml.c
index 700f0d80f..26e322f80 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -1119,13 +1119,20 @@ static void reset_all(void)
uemis = 0;
}
-void parse_xml_file(const char *filename)
+void parse_xml_file(const char *filename, GError **error)
{
xmlDoc *doc;
doc = xmlReadFile(filename, NULL, 0);
if (!doc) {
fprintf(stderr, "Failed to parse '%s'.\n", filename);
+ if (error != NULL)
+ {
+ *error = g_error_new(g_quark_from_string("divelog"),
+ DIVE_ERROR_PARSE,
+ "Failed to parse '%s'",
+ filename);
+ }
return;
}