Closed czocher closed 1 year ago
Second solution is better considering users can still do Result<Result<_>>
which is also true for current version.
For example:
async fn return_error() -> Result<()> {
let conn = Connection::open_in_memory().await?;
struct AppError;
let result = conn.call(|_| Ok(Err::<(), _>(AppError))).await?;
if let Err(app_error) = result {
// ...
}
Ok(())
}
Adding Other
variant would give a convenient choice if user doesn't care about the type or fine with downcasting.
Hello, The error design I went with for the
CallFn
makes it problematic to pass application-specific errors. Example:I have two ideas how to solve this issue:
Result<Result<>>
issue, but the applications will be able to return anything.call
closure param to returntokio_rusqlite::Error
and add anOther
(application specific) error variant:Other(Box<dyn std::error::Error + Send + Sync + 'static>),
.Which version would you prefer?