(response: &[u8])
| 3107 | } |
| 3108 | |
| 3109 | fn 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 | |
| 3129 | fn format_output_tail(bytes: &[u8]) -> String { |
| 3130 | const LIMIT: usize = 512; |
no test coverage detected