diff --git a/sledge/src/config.ml b/sledge/src/config.ml index 50e799ed9..58d319d78 100644 --- a/sledge/src/config.ml +++ b/sledge/src/config.ml @@ -8,6 +8,10 @@ (** Configuration options *) let trace_conv = + let parse s = + Trace.parse s + |> Result.map_error ~f:(fun _ -> `Msg ("Invalid trace spec: " ^ s)) + in let print fs {trace_all; trace_mods_funs} = let pf fmt = Format.fprintf fs fmt in if trace_all then pf "*" @@ -22,7 +26,7 @@ let trace_conv = if fun_enabled then pf "+%s.%s" mod_name fun_name else pf "-%s.%s" mod_name fun_name ) ) in - (Trace.parse, print) + (parse, print) type t = { compile_only: bool diff --git a/sledge/src/trace/trace.ml b/sledge/src/trace/trace.ml index b90460686..cae90f84c 100644 --- a/sledge/src/trace/trace.ml +++ b/sledge/src/trace/trace.ml @@ -75,7 +75,7 @@ let parse s = ~data:{trace_mod= Some enabled; trace_funs= default} ) in Ok {none with trace_mods_funs} - with Assert_failure _ -> Error (`Msg ("Invalid trace spec: " ^ s)) + with Assert_failure _ as exn -> Error exn let init ?(margin = 300) ~config:c () = Format.set_margin margin ; diff --git a/sledge/src/trace/trace.mli b/sledge/src/trace/trace.mli index 8fd32d7a3..66d5f80dd 100644 --- a/sledge/src/trace/trace.mli +++ b/sledge/src/trace/trace.mli @@ -23,7 +23,7 @@ type config = val none : config val all : config -val parse : string -> (config, [> `Msg of string]) result +val parse : string -> (config, exn) result val init : ?margin:int -> config:config -> unit -> unit (** Initialize the configuration of debug tracing. *)