You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good question. We should have better error handling. This is a larger issue with AS since there isn't really error handling just aborting. Perhaps JSON.parse should return an Result type.
An alternative with one less level of type wrapping would be to introduce a JSON.Error subtype of JSON.Value, this would not break backwards compatibility and all code that is already checking for the return type with isObj would work as before and could add an else if branch for the isError case.
Is there a way to verify that a given input is indeed valid JSON?
I'm able to guard against the parsed value not being the object I expect, but not against it not being JSON at all:
The text was updated successfully, but these errors were encountered: