Skip to content

Commit

Permalink
lib: make decode raise Invalid_argument exception
Browse files Browse the repository at this point in the history
  • Loading branch information
bikallem committed Jan 5, 2023
1 parent 8cb73b0 commit d3daa65
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/http_date.ml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ let decode ?century s =
in
Ptime.of_date_time ((y, m, d), time) |> Option.get
| `ASCTIME -> Ptime.of_date_time (date, time) |> Option.get
with exn -> failwith @@ Printexc.to_string exn
with exn ->
raise
@@ Invalid_argument
("s contains invalid date time format. " ^ Printexc.to_string exn)

let encode ?(encoding = IMF) t =
let buf = Buffer.create 29 in
Expand Down

0 comments on commit d3daa65

Please sign in to comment.