mirror of
https://github.com/tlsnotary/tlsn.git
synced 2026-01-08 21:08:04 -05:00
chore: improve error msg (#1003)
This commit is contained in:
@@ -91,6 +91,13 @@ impl RecordProofError {
|
||||
{
|
||||
Self(ErrorRepr::Vm(err.into()))
|
||||
}
|
||||
|
||||
pub(crate) fn is_insufficient(&self) -> bool {
|
||||
match &self.0 {
|
||||
ErrorRepr::Aes(err) => err.is_insufficient(),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
|
||||
@@ -281,8 +281,8 @@ impl Prover<state::Setup> {
|
||||
)
|
||||
.map_err(ProverError::zk)?;
|
||||
|
||||
// Prove received plaintext. Prover drops the proof output, as
|
||||
// they trust themselves.
|
||||
// Prove sent and received plaintext. Prover drops the proof
|
||||
// output, as they trust themselves.
|
||||
let (sent_refs, _) = commit_records(
|
||||
&mut vm,
|
||||
&mut zk_aes_ctr_sent,
|
||||
@@ -293,6 +293,7 @@ impl Prover<state::Setup> {
|
||||
)
|
||||
.map_err(ProverError::zk)?;
|
||||
|
||||
|
||||
let (recv_refs, _) = commit_records(
|
||||
&mut vm,
|
||||
&mut zk_aes_ctr_recv,
|
||||
@@ -301,7 +302,13 @@ impl Prover<state::Setup> {
|
||||
.iter()
|
||||
.filter(|record| record.typ == ContentType::ApplicationData),
|
||||
)
|
||||
.map_err(ProverError::zk)?;
|
||||
.map_err(|e| {
|
||||
if e.is_insufficient() {
|
||||
ProverError::zk(format!("{e}. Attempted to prove more received data than was configured, increase `max_recv_data` in the config."))
|
||||
} else {
|
||||
ProverError::zk(e)
|
||||
}
|
||||
})?;
|
||||
|
||||
mux_fut
|
||||
.poll_with(vm.execute_all(&mut ctx).map_err(ProverError::zk))
|
||||
|
||||
@@ -184,6 +184,10 @@ impl ZkAesCtrError {
|
||||
{
|
||||
Self(ErrorRepr::Vm(err.into()))
|
||||
}
|
||||
|
||||
pub fn is_insufficient(&self) -> bool {
|
||||
matches!(self.0, ErrorRepr::InsufficientPreprocessing { .. })
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
|
||||
Reference in New Issue
Block a user