       | code == StatusOk -> onSuccess
       | otherwise -> onFail code msg
 
-abortIfStatus :: Rpc req resp ()
-abortIfStatus =
+throwIfErrorStatus :: Rpc req resp ()
+throwIfErrorStatus =
   branchOnStatus
     (return ())
     (return ())

  status <- readMVar statusFromServer
  return (RpcOk status)

clientClose :: ClientReaderWriter -> IO ()
clientClose (ClientReaderWriter{..}) = do
  withMVar callMVar_ $ \call ->
    grpcCallDestroy call

clientWrite :: ClientReaderWriter -> B.ByteString -> IO (RpcReply ())
clientWrite crw@(ClientReaderWriter{..}) arg = do
  sendMessageOp <- opSendMessage arg

    Nothing -> return ()
    Just eDesc ->
      CQ.releaseEvent (ccWorker context) eDesc
  modifyMVar_ callMVar_ $ \call -> do
    grpcCallDestroy call
    return (error "grpcCallDestroy called on this Call")

type Rpc req resp a = ReaderT (Client req resp) (ExceptT RpcError IO) a

