I have a suspicion Js.Json must be semi-deprecated (bs-json
is probably the way to go), but I tried to decode JSON the way it’s done in an example there and now I have questions regarding errors in general.
-
Should we use
failwith
at all? Seems like some Caml pervasive, and I’ve got no idea how to catch it, so I’ve ended up usingJs.Exn.raiseTypeError
anyway. -
Isn’t
Belt.Result
meant for error handling? Of course it would meanflatMaps
everywhere so maybe that’s not the recommended style, but as a user, I’d like to know the recommended style.