Skip to content

Commit

Permalink
Throw erros to the console to not annoy the user
Browse files Browse the repository at this point in the history
  • Loading branch information
pleonex committed Dec 5, 2015
1 parent b069d50 commit b1291db
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
5 changes: 2 additions & 3 deletions lib/xsd.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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) == ':\\'
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions lib/xsdParser.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b1291db

Please sign in to comment.