Log offending XML on deserialization failure

This commit is contained in:
Dirkjan Ochtman 2023-02-17 20:43:14 +01:00
parent bd3d7f87e4
commit 46d23efacd
1 changed files with 9 additions and 1 deletions

View File

@ -129,7 +129,15 @@ impl<C: Connector> EppClient<C> {
let response = self.connection.transact(&xml)?.await?; let response = self.connection.transact(&xml)?.await?;
debug!("{}: response: {}", self.connection.registry, &response); debug!("{}: response: {}", self.connection.registry, &response);
let rsp = xml::deserialize::<ResponseDocument<Cmd::Response, Ext::Response>>(&response)?; let rsp =
match xml::deserialize::<ResponseDocument<Cmd::Response, Ext::Response>>(&response) {
Ok(rsp) => rsp,
Err(e) => {
error!(%response, "failed to deserialize response for transaction: {e}");
return Err(e);
}
};
if rsp.data.result.code.is_success() { if rsp.data.result.code.is_success() {
return Ok(rsp.data); return Ok(rsp.data);
} }