anchor.diff:  -spec send_msg(msg(), #state{}) -> #state{}.
   send_msg(Msg, State) ->
       Pkt = riakc_pb:encode(Msg),
  -    ok = gen_tcp:send(State#state.sock, Pkt),
  +    gen_tcp:send(State#state.sock, Pkt),
       State.
       
   %% Send an error to the client
   -spec send_error(string(), list(), #state{}) -> #state{}.
   send_error(Msg, Fmt, State) ->
  -    ErrMsg = lists:flatten(io_lib:format(Msg, Fmt)),
  -    send_msg(#rpberrorresp{errmsg = ErrMsg}, State).
  +    send_error(Msg, Fmt, ?RIAKC_ERR_GENERAL, State).
  +
  +-spec send_error(string(), list(), non_neg_integer(), #state{}) -> #state{}.
  +send_error(Msg, Fmt, ErrCode, State) ->
  +    %% protocol buffers accepts nested lists for binaries so no need to flatten the list
  +    ErrMsg = io_lib:format(Msg, Fmt),
  +    send_msg(#rpberrorresp{errmsg=ErrMsg, errcode=ErrCode}, State).
   
   %% Update riak_object with the pbcontent provided
   update_rpbcontent(O0, RpbContent) -> 
  
positive.code:                 #state{client=C} = State) ->
      case C:list_buckets() of
          {ok, Buckets} ->
              send_msg(#rpblistbucketsresp{buckets = Buckets, done = 1}, State);
          {error, Reason} ->
              send_error("~p", [Reason], State)
      end;
  
  %% Start streaming in list keys - results will be processed in handle_info
  process_message(#rpblistkeysreq{bucket=B}=Req, 
                  #state{client=C} = State) ->
      case C:stream_list_keys(B) of
          {ok, ReqId} ->
              {pause, State#state{req = Req, req_ctx = ReqId}}
      end.
  
  %% @private
  %% @doc if return_body was requested, call the client to get it and return
  
negative.code:                 _ ->
                      send_msg(#rpbputresp{}, State)
              end;
          {error, Reason} ->
              send_error("~p", [Reason], State)
      end;
  