Skip to content
This repository has been archived by the owner on Nov 28, 2018. It is now read-only.

Commit

Permalink
Move emit out of try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuri Astrakhan committed Jun 18, 2016
1 parent 7ed6de3 commit 11cb1d5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,14 @@ function (func, continueOnError) {

es.mapSync = function (sync) {
return es.through(function write(data) {
var mappedData
try {
var mappedData = sync(data)
if (typeof mappedData !== 'undefined')
this.emit('data', mappedData)
}
catch (err) {
mappedData = sync(data)
} catch (err) {
this.emit('error', err)
}
if (mappedData !== undefined)
this.emit('data', mappedData)
})
}

Expand Down

0 comments on commit 11cb1d5

Please sign in to comment.