让视觉绑定调试预览写入失败可降级
调试 PNG 写入失败时记录警告并继续绑定流程。
This commit is contained in:
+6
-2
@@ -44,8 +44,12 @@ fn preprocess_for_visual_binding_blocking(
|
||||
.write_to(&mut Cursor::new(&mut png), ImageFormat::Png)
|
||||
.map_err(|error| format!("编码视觉绑定预览失败:{error}"))?;
|
||||
let debug_name = format!("binding-{}.png", uuid::Uuid::new_v4().simple());
|
||||
fs::write(sidecar.join(&debug_name), &png)
|
||||
.map_err(|error| format!("写入视觉绑定预览失败:{error}"))?;
|
||||
if let Err(error) = fs::write(sidecar.join(&debug_name), &png) {
|
||||
app_log!(
|
||||
"ui_separation.warning stage=visual_binding_preview_write file={} error={error}",
|
||||
debug_name
|
||||
);
|
||||
}
|
||||
Ok(format!(
|
||||
"data:image/png;base64,{}",
|
||||
base64::engine::general_purpose::STANDARD.encode(png)
|
||||
|
||||
Reference in New Issue
Block a user