MB-9467 On JSON.stringify failure, avoid throwing exception with null value

While not a problem, the logged error reason ended up being a "null",
not very informative. Was easy to get via for example:

function(doc, meta) {
    while (true) {
        emit(doc, doc);
    }
}

Change-Id: Ic3757884398c6a87f7530d351447b94aac2aa7b3
Reviewed-on: http://review.couchbase.org/30052
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>