File tree 2 files changed +16
-0
lines changed 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -581,6 +581,14 @@ impl ClientSession {
581
581
/// [`Error::custom`](crate::error::Error::custom) method can accept an arbitrary payload that
582
582
/// can be retrieved via [`Error::get_custom`](crate::error::Error::get_custom).
583
583
///
584
+ /// If a command inside the callback fails, it may cause the transaction on the server to be
585
+ /// aborted. This situation is normally handled transparently by the driver. However, if the
586
+ /// application does not return that error from the callback, the driver will not be able to
587
+ /// determine whether the transaction was aborted or not. The driver will then retry the
588
+ /// callback indefinitely. To avoid this situation, the application MUST NOT silently handle
589
+ /// errors within the callback. If the application needs to handle errors within the
590
+ /// callback, it MUST return them after doing so.
591
+ ///
584
592
/// Because the callback can be repeatedly executed and because it returns a future, the rust
585
593
/// closure borrowing rules for captured values can be overly restrictive. As a
586
594
/// convenience, `with_transaction` accepts a context argument that will be passed to the
Original file line number Diff line number Diff line change @@ -142,6 +142,14 @@ impl ClientSession {
142
142
/// caller. If the callback needs to provide its own error information, the
143
143
/// [`Error::custom`](crate::error::Error::custom) method can accept an arbitrary payload that
144
144
/// can be retrieved via [`Error::get_custom`](crate::error::Error::get_custom).
145
+ ///
146
+ /// If a command inside the callback fails, it may cause the transaction on the server to be
147
+ /// aborted. This situation is normally handled transparently by the driver. However, if the
148
+ /// application does not return that error from the callback, the driver will not be able to
149
+ /// determine whether the transaction was aborted or not. The driver will then retry the
150
+ /// callback indefinitely. To avoid this situation, the application MUST NOT silently handle
151
+ /// errors within the callback. If the application needs to handle errors within the
152
+ /// callback, it MUST return them after doing so.
145
153
pub fn with_transaction < R , F > (
146
154
& mut self ,
147
155
mut callback : F ,
You can’t perform that action at this time.
0 commit comments