Skip to content

Commit

Permalink
Don't throw on parsing error
Browse files Browse the repository at this point in the history
  • Loading branch information
GreLI committed Apr 2, 2015
1 parent ae2981c commit 5c82e7b
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/svgo/svg2js.js
Expand Up @@ -131,21 +131,17 @@ module.exports = function(data, callback) {

sax.onerror = function(e) {

throw e;
callback({ error: 'Error in parsing: ' + e.message });

};

sax.onend = function() {

callback(root);
if (!this.error) callback(root);

};

try {
sax.write(data).close();
} catch (e) {
callback({ error: 'Error in parsing: ' + e.message });
}
sax.write(data).close();

function trim(elem) {
if (!elem.content) return elem;
Expand Down

0 comments on commit 5c82e7b

Please sign in to comment.