lib/services.js
function toRpcError(rpcCode, cause) {
  var err = toError(rpcCode.toLowerCase().replace(/_/g, ' '), cause);
  err.rpcCode = (cause && cause.rpcCode) ? cause.rpcCode : rpcCode;
  return err;
}
function toRpcError(rpcCode, cause) {
  var err = toError(rpcCode.toLowerCase().replace(/_/g, ' '), cause);
  err.rpcCode = (cause && cause.rpcCode) ? cause.rpcCode : rpcCode;
  return err;
}
function toRpcError ( rpcCode , cause ) { var err = toError ( rpcCode . toLowerCase ( ) . replace ( / _ / g , ' ' ) , cause ) ; err . rpcCode = ( cause && cause . rpcCode ) ? cause . rpcCode : rpcCode ; return err ; }
Mark an error.

@param rpcCode {String} Code representing the failure.
@param cause {Error} The cause of the error. It is available as `cause`
field on the outer error.

This is used to keep the argument of channels' `'error'` event errors.
Mark an error .