I see that when Parse JSON fails in a Try, the catch block doesn't seem to get executed. I also see that parsing malformed JSON has been more problematic than this in the past (see this thread), so I grabbed the suggested parsing logic from that thread, which allows me to get the Try to behave as expected, but it seems problematic that Try has this very specific scenario where it doesn't execute its catch.
Code:
someVar = Try(
Parse JSON("{{1}}")
,
Print("in catch 1");
2;
);
someVar2 = Try(
Throw( "broke!" )
,
Print("in catch 2");
2;
);
someVar3 = Try(
txt = Log Capture( result = Parse JSON( "{{1}}") );
If( Length( txt ),
Throw( txt ) // error message
);
result; // parsed JSON
,
Print("in catch 3");
2;
);
Print("someVar is:");
Print(someVar);
Print("someVar2 is:");
Print(someVar2);
Print("someVar3 is:");
Print(someVar3);
Output:
Unexpected "{". Perhaps there is a missing }.
Line 1 Column 2: {►{1}}
"in catch 2"
"in catch 3"
"someVar is:"
.
"someVar2 is:"
2
"someVar3 is:"
2