(&self, hook_type: HookType, input: &[u8])
| 194 | } |
| 195 | |
| 196 | fn parse_json(&self, hook_type: HookType, input: &[u8]) -> AgentResult<Value> { |
| 197 | if input.is_empty() { |
| 198 | return Err(AgentError::HookInputEmpty { |
| 199 | agent: self.name().to_string(), |
| 200 | hook_type: hook_type.as_str().to_string(), |
| 201 | }); |
| 202 | } |
| 203 | |
| 204 | serde_json::from_slice(input).map_err(|e| AgentError::HookParseFailed { |
| 205 | agent: self.name().to_string(), |
| 206 | hook_type: hook_type.as_str().to_string(), |
| 207 | reason: e.to_string(), |
| 208 | }) |
| 209 | } |
| 210 | |
| 211 | fn parse_value<T: for<'de> Deserialize<'de>>( |
| 212 | &self, |
no test coverage detected