From df73c229517c2c7e9e4053302b6f51f2d6d21faf Mon Sep 17 00:00:00 2001 From: Andrey Popp <8mayday@gmail.com> Date: Tue, 8 Oct 2024 12:56:12 +0400 Subject: [PATCH] fixup! ppx: consistent errors in runtime --- ppx/browser/ppx_deriving_json_runtime.ml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ppx/browser/ppx_deriving_json_runtime.ml b/ppx/browser/ppx_deriving_json_runtime.ml index a6cb4e4..e079441 100644 --- a/ppx/browser/ppx_deriving_json_runtime.ml +++ b/ppx/browser/ppx_deriving_json_runtime.ml @@ -14,7 +14,10 @@ let of_string s = | Some jsexn -> Js.Exn.message jsexn | None -> None in - let msg = Option.value msg ~default:"JSON error" in + let msg = + (* msg really cannot be None in browser or any sane JS runtime *) + Option.value msg ~default:"JSON error" + in raise (Json_error msg) exception Of_json_error = Json.Decode.DecodeError