Skip to content

Commit 584f3b9

Browse files
Update adapter/rest/src/main.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Raphael Götz <52959657+raphael-goetz@users.noreply.github.com>
1 parent 8339d53 commit 584f3b9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

adapter/rest/src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,11 @@ async fn execute_flow_to_hyper_response(
252252
// payload -> json bytes
253253
let json_val = pb_value_to_json(payload_val);
254254
let json = serde_json::to_vec_pretty(&json_val).unwrap_or_else(|err| {
255-
format!(r#"{{"error":"Serialization failed: {:?}"}}"#, err).into_bytes()
255+
let fallback = serde_json::json!({
256+
"error": format!("Serialization failed: {}", err),
257+
});
258+
serde_json::to_vec(&fallback)
259+
.unwrap_or_else(|_| br#"{"error":"Serialization failed"}"#.to_vec())
256260
});
257261

258262
let status =

0 commit comments

Comments
 (0)