rescript-compiler icon indicating copy to clipboard operation
rescript-compiler copied to clipboard

Handle the exception of Js_json.stringifyAny

Open mununki opened this issue 3 years ago • 1 comments

This PR fixes #5598

The exception thrown by JSON.stringify will be handled with try-with, instead of renaming it. The renaming would cause a breaking change, so we won't do that. It is proper thatstringifyAny returns option<string> because it is possible to return the undefined

mununki avatar Aug 18 '22 14:08 mununki

Why is the exn function returning an option type?

The javascript stringify function returns two types of values and the exception. Two types of values are string and undefined. If stringifyAny() is called with no argument(actually there is unit), it will return the undefined which is corresponded to None in ReScript.

mununki avatar Aug 18 '22 23:08 mununki

@mununki what's the status of this? Starting to move stuff to v12, unless there are plans for things to progress soon.

cristianoc avatar Apr 09 '23 11:04 cristianoc

Maybe this belongs in Core now?

zth avatar Apr 09 '23 12:04 zth

Maybe this belongs in Core now?

Great let's move it then.

cristianoc avatar Apr 09 '23 12:04 cristianoc

Technically we need close this and open another one: different GitHub org.

cristianoc avatar Apr 09 '23 12:04 cristianoc

Sorry for being late, is a PR opened in the Core for this?

mununki avatar Apr 20 '23 14:04 mununki