OK, so try catch calls deoptimize code around them so there should be a
function yo run them so we don't have to worry, maybe:

```js
function trycode(fun, db){
  try {
    return fun();
  } catch (e) {
    db.emit('error', e);
  }
}
```
On Mar 20, 2014 8:49 PM, "Nolan Lawson" <notifications@github.com> wrote:

> In index.js:
>
> >          current = {doc: doc.doc};
> > -        fun.map.call(null, doc.doc);
> > +        try {
> > +          fun.map.call(null, doc.doc);
> > +        } catch (err) {
> > +          logError('unexpected error in map function');
>
> This particular one isn't. There are four places in the codewe need to
> try/catch : map.call for persisted + temp, and reduce.call for persisted +
> temp.
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/pouchdb/mapreduce/pull/68/files#r10823956>
> .
>