SWI-Prolog/swish

Unexpected behavior with catch/3

JeanChristopheRohner opened this issue · 1 comments

With swipl desktop, test1, test2 and test3 all have the expected behaviour. But on swish, test1 and test3 do not print
"[Oops, error:..." followed by the error.

test1:-
    Goal = writeln('something'),
    catch(
        call(Goal), 
        ExceptionTerm, 
        writeln(['Oops, error:', ExceptionTerm])
    ). 

test2:-
    catch(
        X is Y*2, 
        ExceptionTerm, 
        writeln(['Oops, error:', ExceptionTerm])
    ).

test3:-
    catch(
        format("~w~w",[banana]),
        ExceptionTerm,
        writeln(['Oops, error:', ExceptionTerm])
    ).

Both test1 and test3 fail during the program analysis that is part of the sandboxing. For format/2 this is the case because format/2 can use ~@ to call arbitrary goals and thus we need to figure out the format string and the arguments.