MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / assert_pglite_code

Function assert_pglite_code

tests/extensions_smoke.rs:34–44  ·  view source on GitHub ↗
(err: &anyhow::Error, expected_code: &str, message_contains: &str)

Source from the content-addressed store, hash-verified

32}
33
34fn assert_pglite_code(err: &anyhow::Error, expected_code: &str, message_contains: &str) {
35 let pg_err = err
36 .downcast_ref::<PgliteError>()
37 .expect("error should preserve Postgres fields");
38 assert_eq!(pg_err.database_error().code.as_deref(), Some(expected_code));
39 assert!(
40 pg_err.database_error().message.contains(message_contains),
41 "expected error message to contain {message_contains:?}, got {:?}",
42 pg_err.database_error().message
43 );
44}
45
46fn assert_sqlx_code(err: &sqlx::Error, expected_code: &str) {
47 assert_eq!(

Calls

no outgoing calls