You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "ShadowySpirits (via GitHub)" <gi...@apache.org> on 2023/05/05 06:10:08 UTC
[GitHub] [incubator-opendal] ShadowySpirits commented on a diff in pull request #2209: refactor(java): refactor rust code to remove mostly unwrap and expect
ShadowySpirits commented on code in PR #2209:
URL: https://github.com/apache/incubator-opendal/pull/2209#discussion_r1185729127
##########
bindings/java/src/macros.rs:
##########
Review Comment:
Otherwise, we need to write the following codes in all places where exceptions may occur:
```rust
let result = op.do_something();
if let Err(error) = result {
let exception = build_java_exception();
env.throw(exception).unwrap();
return;
}
let result = ressult.unwrap();
```
With the macro, we can simplify them into:
```rust
let result = handle_opendal_result!(env, op.do_something());
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org