mirror of
https://github.com/matter-labs/teepot.git
synced 2025-07-21 23:23:57 +02:00
fix(tee-key-preexec): add context to file write operations
- Add context to `std::fs::write` calls to improve error tracing. - Ensures better debugging by attaching filenames to potential errors. Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
This commit is contained in:
parent
9114c47b90
commit
e27b5da856
1 changed files with 3 additions and 3 deletions
|
@ -58,17 +58,17 @@ fn main_with_error() -> Result<()> {
|
||||||
.extend()?;
|
.extend()?;
|
||||||
|
|
||||||
// save quote to file
|
// save quote to file
|
||||||
std::fs::write(TEE_QUOTE_FILE, quote)?;
|
std::fs::write(TEE_QUOTE_FILE, quote).context(TEE_QUOTE_FILE)?;
|
||||||
teepot::quote::TEEType::TDX.to_string()
|
teepot::quote::TEEType::TDX.to_string()
|
||||||
}
|
}
|
||||||
Ok((tee_type, quote)) => {
|
Ok((tee_type, quote)) => {
|
||||||
// save quote to file
|
// save quote to file
|
||||||
std::fs::write(TEE_QUOTE_FILE, quote)?;
|
std::fs::write(TEE_QUOTE_FILE, quote).context(TEE_QUOTE_FILE)?;
|
||||||
tee_type.to_string()
|
tee_type.to_string()
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Failed to get quote: {}", e);
|
error!("Failed to get quote: {}", e);
|
||||||
std::fs::write(TEE_QUOTE_FILE, [])?;
|
std::fs::write(TEE_QUOTE_FILE, []).context(TEE_QUOTE_FILE)?;
|
||||||
"none".to_string()
|
"none".to_string()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue