From b08912eb5a1fc6b27de0b74c099e1027f6d3f51c Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Mon, 4 Jul 2011 13:56:09 +0100 Subject: [PATCH] Initial web provisioning parsing, error handling --- src/moonshot-webp-parser.vala | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/moonshot-webp-parser.vala b/src/moonshot-webp-parser.vala index 2865432..e7bda5b 100644 --- a/src/moonshot-webp-parser.vala +++ b/src/moonshot-webp-parser.vala @@ -33,11 +33,6 @@ namespace WebProvisioning }*/ } - public void parser_error (MarkupParseContext context, - Error error) - { - debug ("error"); - } public static int main (string[] args) { @@ -66,7 +61,18 @@ namespace WebProvisioning error ("Could not retreive file size"); } - MarkupParser parser = {start_element_func, end_element_func, text_element_func, null, parser_error}; + MarkupParser parser = {start_element_func, end_element_func, text_element_func, null, null}; + + var ctx = new MarkupParseContext(parser, 0, null, null); + + try + { + ctx.parse (text, text.length); + } + catch (Error e) + { + error ("Could not parse %s, invalid content", args[1]); + } return 0; -- 2.1.4