sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

Expose SqliteError::new

Open ColonelThirtyTwo opened this issue 9 months ago • 3 comments

Is your feature request related to a problem? Please describe. SqliteError has a new function that takes a C handle and generates an error using sqlite3_extended_errcode and sqlite3_errmsg, but it's crate-private. This function would be convenient for anyone working with the C API, for example in SqlitePoolOptions::after_connect to register a custom SQLite function, so that they don't have to write sqlx::Error-compatible error handle themselves.

Describe the solution you'd like Change SqliteError::new to pub and add unsafe to it (it technically should be unsafe even if crate-private since it requires the passed in handle to be valid).

Describe alternatives you've considered Writing my own boilerplate to get the error code and message myself. But it's boilerplate.

Additional context N/A

ColonelThirtyTwo avatar May 17 '24 17:05 ColonelThirtyTwo