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
Refactored Javascript Code and Documentation.

Change-Id: I0fe52bb1e9442843baecf17c0316f2e0323c6960