From b1291db3b489b437cbf23129a73125799b9f8012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benito=20Palacios=20S=C3=A1nchez?= Date: Sat, 5 Dec 2015 11:19:16 +0100 Subject: [PATCH] Throw erros to the console to not annoy the user --- CHANGELOG.md | 1 + lib/xsd.coffee | 5 ++--- lib/xsdParser.coffee | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b13d66..5ad4ede 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## 0.7.5 * Merge attributes from extension types. +* Throw errors to console to not annoy the user. ## 0.7.4 * Fix using a root type as children too. diff --git a/lib/xsd.coffee b/lib/xsd.coffee index fdedd2b..5f8adfe 100644 --- a/lib/xsd.coffee +++ b/lib/xsd.coffee @@ -33,7 +33,7 @@ module.exports = res.on 'end', => @parseFromString(body, complete) ).on 'error', (e) -> - throw new Error(e) + console.error e else # Get the base path. In absolute path nothing, in relative the file dir. if xsdUri[0] == '/' or xsdUri.substr(1, 2) == ':\\' @@ -43,8 +43,7 @@ module.exports = # Read the file from disk fs.readFile path.join(basePath, xsdUri), (err, data) => - throw new Error(err) if err - @parseFromString(data, complete) + if err then console.error err else @parseFromString(data, complete) ## Parse the the XML diff --git a/lib/xsdParser.coffee b/lib/xsdParser.coffee index b8ecd69..48ebb11 100644 --- a/lib/xsdParser.coffee +++ b/lib/xsdParser.coffee @@ -42,8 +42,7 @@ module.exports = preserveChildrenOrder: true explicitChildren: true }, (err, result) => - throw new Error(err) if err - @parse(result, complete) + if err then console.error err else @parse(result, complete) ## Parrse the XSD file. Prepare types and children.