From 9c791359c71e22b63076e97d3df319cb82e5c285 Mon Sep 17 00:00:00 2001 From: Darren Li Date: Fri, 12 Apr 2024 18:15:40 +1000 Subject: [PATCH] Changing error messages to not be capitlised --- timedesc-sexp/of_sexp.ml | 24 ++++++++++++------------ timedesc-sexp/of_sexp_utils.ml | 10 +++++----- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/timedesc-sexp/of_sexp.ml b/timedesc-sexp/of_sexp.ml index bbbaa5f4..666168c0 100644 --- a/timedesc-sexp/of_sexp.ml +++ b/timedesc-sexp/of_sexp.ml @@ -7,45 +7,45 @@ let int_of_sexp (x : Sexp.t) = | Atom s -> ( try int_of_string s with Failure _ -> - invalid_data (Printf.sprintf "Failed to parse int: %s" s)) + invalid_data (Printf.sprintf "failed to parse int: %s" s)) | List _ -> invalid_data - (Printf.sprintf "Expected atom for int: %s" (Sexp.to_string x)) + (Printf.sprintf "expected atom for int: %s" (Sexp.to_string x)) let ints_of_sexp_list (x : Sexp.t) = match x with | Atom _ -> invalid_data - (Printf.sprintf "Expected list for ints: %s" (Sexp.to_string x)) + (Printf.sprintf "expected list for ints: %s" (Sexp.to_string x)) | List l -> List.map int_of_sexp l let span_of_sexp (x : Sexp.t) = match x with | Atom _ -> invalid_data - (Printf.sprintf "Expected list for span: %s" (Sexp.to_string x)) + (Printf.sprintf "expected list for span: %s" (Sexp.to_string x)) | List [ s; ns ] -> let s = int64_of_sexp s in let ns = int_of_sexp ns in T.Span.make ~s ~ns () | List _ -> invalid_data - (Printf.sprintf "List too long for span: %s" (Sexp.to_string x)) + (Printf.sprintf "list too long for span: %s" (Sexp.to_string x)) let tz_make_of_sexp (x : Sexp.t) = match x with | Atom s -> ( match T.Time_zone.make s with | Some x -> x - | None -> invalid_data (Printf.sprintf "Unrecognized time zone: %s" s)) + | None -> invalid_data (Printf.sprintf "unrecognized time zone: %s" s)) | List _ -> invalid_data - (Printf.sprintf "Expected atom for time zone: %s" (Sexp.to_string x)) + (Printf.sprintf "expected atom for time zone: %s" (Sexp.to_string x)) let tz_info_of_sexp (x : Sexp.t) : T.Time_zone_info.t = match x with | Atom _ -> - invalid_data (Printf.sprintf "Invalid tz_info: %s" (Sexp.to_string x)) + invalid_data (Printf.sprintf "invalid tz_info: %s" (Sexp.to_string x)) | List l -> ( match l with | [ x ] -> T.Time_zone_info.make_exn ~tz:(tz_make_of_sexp x) () @@ -59,11 +59,11 @@ let tz_info_of_sexp (x : Sexp.t) : T.Time_zone_info.t = () | _ -> invalid_data - (Printf.sprintf "Invalid tz_info: %s" (Sexp.to_string x))) + (Printf.sprintf "invalid tz_info: %s" (Sexp.to_string x))) let date_of_sexp (x : Sexp.t) = let invalid_data () = - invalid_data (Printf.sprintf "Invalid date: %s" (Sexp.to_string x)) + invalid_data (Printf.sprintf "invalid date: %s" (Sexp.to_string x)) in match x with | List [ year; month; day ] -> ( @@ -77,7 +77,7 @@ let date_of_sexp (x : Sexp.t) = let time_of_sexp (x : Sexp.t) = let invalid_data () = - invalid_data (Printf.sprintf "Invalid time: %s" (Sexp.to_string x)) + invalid_data (Printf.sprintf "invalid time: %s" (Sexp.to_string x)) in match x with | List [ hour; minute; second; ns ] -> ( @@ -103,7 +103,7 @@ let zoneless_of_sexp (x : Sexp.t) = let date_time_of_sexp (x : Sexp.t) = let invalid_data () = - invalid_data (Printf.sprintf "Invalid date time: %s" (Sexp.to_string x)) + invalid_data (Printf.sprintf "invalid date time: %s" (Sexp.to_string x)) in match x with | List [ date; time; tz; offset_from_utc ] -> diff --git a/timedesc-sexp/of_sexp_utils.ml b/timedesc-sexp/of_sexp_utils.ml index 52e08c08..97665f65 100644 --- a/timedesc-sexp/of_sexp_utils.ml +++ b/timedesc-sexp/of_sexp_utils.ml @@ -9,20 +9,20 @@ let int_of_sexp (x : Sexp.t) = | Atom s -> ( try int_of_string s with Failure _ -> - invalid_data (Printf.sprintf "Failed to parse int: %s" s)) + invalid_data (Printf.sprintf "failed to parse int: %s" s)) | List _ -> invalid_data - (Printf.sprintf "Expected atom for int: %s" (Sexplib.Sexp.to_string x)) + (Printf.sprintf "expected atom for int: %s" (Sexplib.Sexp.to_string x)) let int64_of_sexp (x : Sexp.t) = match x with | Atom s -> ( try Int64.of_string s with Failure _ -> - invalid_data (Printf.sprintf "Failed to parse int64: %s" s)) + invalid_data (Printf.sprintf "failed to parse int64: %s" s)) | List _ -> invalid_data - (Printf.sprintf "Expected atom for int64: %s" (Sexplib.Sexp.to_string x)) + (Printf.sprintf "expected atom for int64: %s" (Sexplib.Sexp.to_string x)) let wrap_of_sexp (f : Sexp.t -> 'a) : Sexp.t -> ('a, string) result = fun x -> @@ -34,5 +34,5 @@ let wrap_of_sexp_into_of_sexp_string (f : Sexplib.Sexp.t -> 'a) : string -> ('a, string) result = fun s -> match Sexplib.Sexp.of_string s with - | exception _ -> Error "Failed to parse string into sexp" + | exception _ -> Error "failed to parse string into sexp" | x -> (wrap_of_sexp f) x