Skip to content

Commit 0f8cfcd

Browse files
committed
m
1 parent 35662f0 commit 0f8cfcd

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

DynamoDbEncryption/runtimes/rust/src/intercept.rs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,23 @@ macro_rules! modify_request {
2727
$cfg.interceptor_state().store_put(OriginalRequest(Input::erase($request.clone())));
2828

2929
// transform the request
30-
*$request = tokio::task::block_in_place(|| {
31-
tokio::runtime::Handle::current().block_on(async {
30+
// *$request = tokio::task::block_in_place(|| {
31+
let result = tokio::task::block_in_place(|| {
32+
tokio::runtime::Handle::current().block_on(async {
3233
$self.client
3334
.$transform()
3435
.sdk_input($request.clone())
3536
.send()
3637
.await
37-
.unwrap().transformed_input.unwrap()
3838
})
39-
})
39+
});
40+
match result {
41+
Ok(x) => *$request = x.transformed_input.unwrap(),
42+
Err(x) => {
43+
let s = format!("{:?}", x);
44+
return Err(s.into());
45+
}
46+
};
4047
}
4148
};
4249
}
@@ -58,17 +65,23 @@ macro_rules! modify_response {
5865
.expect("we know this type corresponds to the output type");
5966

6067
// transform the response
61-
*$response = tokio::task::block_in_place(|| {
68+
let result = tokio::task::block_in_place(|| {
6269
tokio::runtime::Handle::current().block_on(async {
6370
$self.client
6471
.$transform()
6572
.original_input(original.clone())
6673
.sdk_output($response.clone())
6774
.send()
6875
.await
69-
.unwrap().transformed_output.unwrap()
7076
})
71-
})
77+
});
78+
match result {
79+
Ok(x) => *$response = x.transformed_output.unwrap(),
80+
Err(x) => {
81+
let s = format!("{:?}", x);
82+
return Err(s.into());
83+
}
84+
};
7285
}
7386
};
7487
}

0 commit comments

Comments
 (0)