fix(test): handle null metadata for unvalidated tx in Env::meta (#5715)

This change handles errors better when calling `env.meta`. It prints some debug help and throws an error if `env.meta` is going to return a `nullptr`.
This commit is contained in:
Mayukha Vadari
2025-08-22 12:15:03 -04:00
committed by GitHub
parent 2e255812ae
commit 095dc4d9cc

View File

@@ -499,7 +499,16 @@ Env::meta()
close();
}
auto const item = closed()->txRead(txid_);
return item.second;
auto const result = item.second;
if (result == nullptr)
{
test.log << "Env::meta: no metadata for txid: " << txid_ << std::endl;
test.log << "This is probably because the transaction failed with a "
"non-tec error."
<< std::endl;
Throw<std::runtime_error>("Env::meta: no metadata for txid");
}
return result;
}
std::shared_ptr<STTx const>