Exposed REST error code from C++ binding.

REST errors no longer use a literal, but instead an error
code from the error codes enumeration.

Change-Id: If5500353b142e39e59ee9b296ba23afe84b334f8
Reviewed-on: http://review.couchbase.org/30192
Reviewed-by: Mark Nunberg <mnunberg@haskalah.org>
Tested-by: Brett Lawson <brett19@gmail.com>
Refactored Javascript Code and Documentation.

Change-Id: I0fe52bb1e9442843baecf17c0316f2e0323c6960
Reviewed-on: http://review.couchbase.org/30195
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Brett Lawson <brett19@gmail.com>