Skip to content

Commit

Permalink
Fix error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
shinnn committed Nov 13, 2015
1 parent 462b970 commit 1f3d87d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ module.exports = function (opts) {

svgo.optimize(file.contents.toString('utf8'), function (res) {
if (!res.data || !res.data.length) {
cb(null, file);
return;
}

Expand All @@ -38,12 +37,13 @@ module.exports = function (opts) {
if (res.data.length < file.contents.length) {
file.contents = res.data;
}

cb(null, file);
});
} catch (err) {
err.fileName = file.path;
cb(err);
return;
}

cb(null, file);
});
};

0 comments on commit 1f3d87d

Please sign in to comment.