mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 15:24:48 +01:00
fix: map errors
This commit is contained in:
parent
3827ab066d
commit
dd0acdad2f
1 changed files with 8 additions and 8 deletions
|
@ -99,26 +99,26 @@ impl AsyncFactory {
|
||||||
|
|
||||||
pub async fn insert(&self, txt: String, pos: u64) -> Result<OperationSeq, OTError> {
|
pub async fn insert(&self, txt: String, pos: u64) -> Result<OperationSeq, OTError> {
|
||||||
let (tx, rx) = oneshot::channel();
|
let (tx, rx) = oneshot::channel();
|
||||||
self.ops.send(OpMsg::Exec(OpWrapper::Insert(txt, pos), tx)).await.unwrap();
|
self.ops.send(OpMsg::Exec(OpWrapper::Insert(txt, pos), tx)).await.map_err(|_| OTError)?;
|
||||||
rx.await.unwrap()
|
rx.await.map_err(|_| OTError)?
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn delete(&self, pos: u64, count: u64) -> Result<OperationSeq, OTError> {
|
pub async fn delete(&self, pos: u64, count: u64) -> Result<OperationSeq, OTError> {
|
||||||
let (tx, rx) = oneshot::channel();
|
let (tx, rx) = oneshot::channel();
|
||||||
self.ops.send(OpMsg::Exec(OpWrapper::Delete(pos, count), tx)).await.unwrap();
|
self.ops.send(OpMsg::Exec(OpWrapper::Delete(pos, count), tx)).await.map_err(|_| OTError)?;
|
||||||
rx.await.unwrap()
|
rx.await.map_err(|_| OTError)?
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn cancel(&self, pos: u64, count: u64) -> Result<OperationSeq, OTError> {
|
pub async fn cancel(&self, pos: u64, count: u64) -> Result<OperationSeq, OTError> {
|
||||||
let (tx, rx) = oneshot::channel();
|
let (tx, rx) = oneshot::channel();
|
||||||
self.ops.send(OpMsg::Exec(OpWrapper::Cancel(pos, count), tx)).await.unwrap();
|
self.ops.send(OpMsg::Exec(OpWrapper::Cancel(pos, count), tx)).await.map_err(|_| OTError)?;
|
||||||
rx.await.unwrap()
|
rx.await.map_err(|_| OTError)?
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn process(&self, opseq: OperationSeq) -> Result<String, OTError> {
|
pub async fn process(&self, opseq: OperationSeq) -> Result<String, OTError> {
|
||||||
let (tx, rx) = oneshot::channel();
|
let (tx, rx) = oneshot::channel();
|
||||||
self.ops.send(OpMsg::Process(opseq, tx)).await.unwrap();
|
self.ops.send(OpMsg::Process(opseq, tx)).await.map_err(|_| OTError)?;
|
||||||
rx.await.unwrap()
|
rx.await.map_err(|_| OTError)?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue