From d0e159785eb5a496f8aac9cc2b1b5f5d2b2891bc Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Fri, 1 Mar 2024 15:18:04 -0500 Subject: [PATCH] fix in trace-tef now that meta-map can raise Invalid_arg --- src/tef/trace_tef.ml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/tef/trace_tef.ml b/src/tef/trace_tef.ml index bbbee69..f4ffddd 100644 --- a/src/tef/trace_tef.ml +++ b/src/tef/trace_tef.ml @@ -433,7 +433,9 @@ let collector ~out () : collector = let id = Meta_map.find_exn key_async_id es.meta in let name, flavor = Meta_map.find_exn key_async_data es.meta in let data = - try !(Meta_map.find_exn key_data es.meta) with Not_found -> [] + match Meta_map.find key_data es.meta with + | None -> [] + | Some r -> !r in let time_us = now_us () in let tid = get_tid_ () in @@ -443,8 +445,9 @@ let collector ~out () : collector = let add_data_to_manual_span (es : explicit_span) data = if data <> [] then ( let data_ref, add = - try Meta_map.find_exn key_data es.meta, false - with Not_found -> ref [], true + match Meta_map.find key_data es.meta with + | Some r -> r, false + | None -> ref [], true in let new_data = List.rev_append data !data_ref in data_ref := new_data;