Skip to content

Fix incorrect `cause` function for YDBError

cause is deprecated in favor of source. The docs for source say this (https://doc.rust-lang.org/nightly/std/error/trait.Error.html):

Error::source() is generally used when errors cross "abstraction boundaries". If one module must report an error that is caused by an error from a lower-level module, it can allow accessing that error via Error::source(). This makes it possible for the high-level module to provide its own errors while also revealing some of the implementation for debugging via source chains.

It is never correct to return the current error as the source; doing so can cause infinite loops when the error sources are recursively reported: https://doc.rust-lang.org/nightly/src/std/error.rs.html#729

This now uses the default provided by the trait, which is not to return a source error.

Edited by Jynn Nelson

Merge request reports

Loading