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

Function protocol_response_contains_error

src/pglite/postgres_mod.rs:3109–3127  ·  view source on GitHub ↗
(response: &[u8])

Source from the content-addressed store, hash-verified

3107}
3108
3109fn protocol_response_contains_error(response: &[u8]) -> bool {
3110 let mut cursor = 0usize;
3111 while cursor + 5 <= response.len() {
3112 let tag = response[cursor];
3113 let len = i32::from_be_bytes(response[cursor + 1..cursor + 5].try_into().unwrap());
3114 if len < 4 {
3115 return false;
3116 }
3117 let total = 1usize.saturating_add(len as usize);
3118 if cursor + total > response.len() {
3119 return false;
3120 }
3121 if tag == b'E' {
3122 return true;
3123 }
3124 cursor += total;
3125 }
3126 false
3127}
3128
3129fn format_output_tail(bytes: &[u8]) -> String {
3130 const LIMIT: usize = 512;

Callers 2

startup_failureMethod · 0.85
send_protocol_innerMethod · 0.85

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected