snatches errors generated during the execution of a goal.
catch/3 snatches errors which are unifiable by CatchMask and generated during the execution of Goal, stops the execution of Goal and executes RecoverGoal. An error can be generated either in the program (see throw/1) or by the processor.
Goal goal CatchMask term RecoverGoal goal
| X=throw(write('ok')), catch(X,Y,write('error')). | Succeeds with substitution X <- throw(write(ok)), Y <- write(ok) and executes write(error). |
| X=write(ok), catch(X,Y,write(error)). | Succeeds with substitution X <- write(ok), Y <- _735 and executes write(ok) |
This predicate is part of the ISO-Prolog Standard.