Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions rust/src/transaction/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl TransactionOp for DeleteOp {
match tx.delete(obj, self.key) {
Ok(_) => {}
Err(e) => {
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string()).unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string());
}
}
}
Expand Down Expand Up @@ -64,8 +64,7 @@ pub unsafe extern "C" fn deleteInList<'local>(
let idx = match usize::try_from(idx) {
Ok(idx) => idx,
Err(_) => {
env.throw_new(AUTOMERGE_EXCEPTION, "Index out of bounds")
.unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, "Index out of bounds");
return;
}
};
Expand Down
5 changes: 2 additions & 3 deletions rust/src/transaction/increment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl TransactionOp for IncrementOp {
match tx.increment(obj, self.key, self.value) {
Ok(_) => {}
Err(e) => {
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string()).unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string());
}
}
}
Expand Down Expand Up @@ -71,8 +71,7 @@ pub unsafe extern "C" fn incrementInList(
let idx = match usize::try_from(idx) {
Ok(i) => i,
Err(_) => {
env.throw_new(AUTOMERGE_EXCEPTION, "index cannot be negative")
.unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, "index cannot be negative");
return;
}
};
Expand Down
13 changes: 5 additions & 8 deletions rust/src/transaction/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@ impl TransactionOp for InsertOp<am::ScalarValue> {
let idx = match usize::try_from(self.index) {
Ok(i) => i,
Err(_) => {
env.throw_new(AUTOMERGE_EXCEPTION, "index cannot be negative")
.unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, "index cannot be negative");
return;
}
};
match tx.insert(obj, idx, self.value) {
Ok(_) => {}
Err(e) => {
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string()).unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string());
}
}
}
Expand All @@ -57,15 +56,14 @@ impl TransactionOp for InsertOp<ObjType> {
let idx = match usize::try_from(self.index) {
Ok(i) => i,
Err(_) => {
env.throw_new(AUTOMERGE_EXCEPTION, "index cannot be negative")
.unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, "index cannot be negative");
return JObject::null().into_raw();
}
};
let value = match tx.insert_object(obj, idx, self.value) {
Ok(v) => v,
Err(e) => {
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string()).unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string());
return JObject::null().into_raw();
}
};
Expand Down Expand Up @@ -151,8 +149,7 @@ pub unsafe extern "C" fn insertUintInList(
let int = match u64::try_from(value) {
Ok(i) => i,
Err(_) => {
env.throw_new(AUTOMERGE_EXCEPTION, "uint value must not be negative")
.unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, "uint value must not be negative");
return;
}
};
Expand Down
7 changes: 3 additions & 4 deletions rust/src/transaction/mark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl TransactionOp for MarkOp {
Ok(_) => {}
Err(e) => {
let msg = format!("Error marking: {e}");
env.throw_new(AUTOMERGE_EXCEPTION, msg).unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, msg);
}
}
}
Expand All @@ -59,8 +59,7 @@ pub unsafe extern "C" fn markUint(
let int = match u64::try_from(value) {
Ok(i) => am::ScalarValue::Uint(i),
Err(_) => {
env.throw_new(AUTOMERGE_EXCEPTION, "uint value must not be negative")
.unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, "uint value must not be negative");
return;
}
};
Expand Down Expand Up @@ -325,7 +324,7 @@ impl TransactionOp for Unmark {
Ok(_) => {}
Err(e) => {
let msg = format!("Error marking: {e}");
env.throw_new(AUTOMERGE_EXCEPTION, msg).unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, msg);
}
}
}
Expand Down
9 changes: 4 additions & 5 deletions rust/src/transaction/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl<'a, V: Into<automerge::ScalarValue>> TransactionOp for SetOp<'a, V> {
let key = match self.prop.try_into_prop(env) {
Ok(k) => k,
Err(e) => {
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string()).unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string());
return;
}
};
Expand All @@ -37,7 +37,7 @@ impl<'a, V: Into<automerge::ScalarValue>> TransactionOp for SetOp<'a, V> {
match tx.put(obj, key, self.value) {
Ok(_) => {}
Err(e) => {
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string()).unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string());
}
}
}
Expand Down Expand Up @@ -453,7 +453,7 @@ impl TransactionOp for SetObjOp {
let oid = match tx.put_object(obj, self.key, self.value) {
Ok(oid) => oid,
Err(e) => {
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string()).unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string());
return JObject::null().into_raw();
}
};
Expand Down Expand Up @@ -501,8 +501,7 @@ pub unsafe extern "C" fn setObjectInList(
let idx = match usize::try_from(idx) {
Ok(idx) => idx,
Err(_) => {
env.throw_new(AUTOMERGE_EXCEPTION, "index must be non-negative")
.unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, "index must be non-negative");
return JObject::null().into_raw();
}
};
Expand Down
2 changes: 1 addition & 1 deletion rust/src/transaction/splice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl TransactionOp for SpliceOp {
match tx.splice(obj, self.index, self.delete, iter) {
Ok(_) => {}
Err(e) => {
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string()).unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion rust/src/transaction/splice_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<'a> TransactionOp for SpliceTextOp<'a> {
match tx.splice_text(obj, self.idx as usize, self.delete as isize, &value) {
Ok(_) => {}
Err(e) => {
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string()).unwrap();
env.throw_new(AUTOMERGE_EXCEPTION, e.to_string());
}
}
}
Expand Down
Loading