MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / expect_error

Method expect_error

nodedb-test-support/src/pgwire_harness/query.rs:167–180  ·  view source on GitHub ↗

Execute a SQL statement expecting an error containing the given substring.

(&self, sql: &str, expected_substring: &str)

Source from the content-addressed store, hash-verified

165
166 /// Execute a SQL statement expecting an error containing the given substring.
167 pub async fn expect_error(&self, sql: &str, expected_substring: &str) {
168 let client = self.client.as_ref();
169 match client.simple_query(sql).await {
170 Ok(_) => panic!("expected error containing '{expected_substring}', got success"),
171 Err(e) => {
172 let msg = pg_error_detail(&e);
173 assert!(
174 msg.to_lowercase()
175 .contains(&expected_substring.to_lowercase()),
176 "expected error containing '{expected_substring}', got: {msg}"
177 );
178 }
179 }
180 }
181}
182
183/// Extract a detailed error message from a tokio-postgres error.

Calls 2

pg_error_detailFunction · 0.70
as_refMethod · 0.45