Incorporate suggestions.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
Narfinger 2025-05-27 16:56:39 +02:00
parent 505bb0406e
commit 92519bfed4

View file

@ -59,7 +59,8 @@ impl ServoInternalsMethods<crate::DomTypeHolder> for ServoInternals {
impl RoutedPromiseListener<MemoryReportResult> for ServoInternals {
fn handle_response(&self, response: MemoryReportResult, promise: &Rc<Promise>, can_gc: CanGc) {
let stringified = serde_json::to_string(&response.results).unwrap();
let stringified = serde_json::to_string(&response.results)
.unwrap_or_else(|_| "{ error: \"failed to create memory report\"}".to_owned());
promise.resolve_native(&stringified, can_gc);
}
}