snatches errors generated during the execution of a goal....
Move to
Next Prev
Up Top
See also
abort/0
::(Apply)/2
break
call/1
fcall/1
catch/3
','(Conjunction)/2
!(Cut)/0
';'(Disjunction)/2
<-(Eval)/2
fail/0
halt/0/1
->(If-then)/2
';'(If-then-else)/2
'\+'/1
once/1
repeat/0
throw/1
true/0
IF Computer > MINERVA > Manual > Reference > Predicates > Logic and control > catch/3

catch/3

snatches errors generated during the execution of a goal.

catch(+Goal, ?CatchMask, ?RecoverGoal)

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.

Arguments

Goal                   goal
CatchMask              term
RecoverGoal            goal

Examples

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)

Standard

This predicate is part of the ISO-Prolog Standard.

See also

abort/0, break/0, call/1, fcall/1, ','(conjunction)/2, '!'(cut)/0, ';'(disjunction)/2, fail/0, true/0, halt/0/1, '->'(if-then)/2, ';'(if-then-else)/2, '\+'(not provable)/1, once/1, repeat/0, throw/1.

read on...
MINERVA
ifcomputer logo
f
Expert Services on the Web
Language
English
Japanese
Server
USA
Japan
Site Access
Local Index
Local Contents
Site Contents
Site Index
Printer Friendly
For imode
For PDA
Search
document: http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/Predicates/logic_and_control/catch/home_en.html
published 2008/7/7 update 2001/2/7 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 info@ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
scroll to top managed with ubiCMS