Skip to content

Commit

Permalink
feat(errors): log errors to console
Browse files Browse the repository at this point in the history
Catch errors coming from the application to let the
developer know when there are issues occuring they
may otherwise not be aware of.
Attempts to log the stack trace when possible.

closes #24
  • Loading branch information
TylorS committed Dec 8, 2015
1 parent 93d8513 commit 379d230
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ const callDrivers =
return sources
}

const noop = () => {}

const logErrorToConsole =
err => console.error(err.stack || err)

const replicateMany =
(sinks, sinkProxies) =>
setTimeout(
Expand All @@ -31,7 +36,10 @@ const replicateMany =
if (sinks.hasOwnProperty(name) &&
sinkProxies.hasOwnProperty(name))
{
sinks[name].forEach(sinkProxies[name].sink.add)
sinks[name]
.forEach(sinkProxies[name].sink.add)
.then(noop)
.catch(logErrorToConsole)
}
}
}
Expand Down

0 comments on commit 379d230

Please # to comment.