Does sensetalk support multiple catch handlers? If I have some different errors to handle, how can I do that?
e.g.
Try
functionA
throw errorA
functionB
throw errorB
catch errorA
errorAHandler
catch errorB
errorBHandler
end try
Does sensetalk support multiple catch handlers? If I have some different errors to handle, how can I do that?
e.g.
Try
functionA
throw errorA
functionB
throw errorB
catch errorA
errorAHandler
catch errorB
errorBHandler
end try
Yes you can throw multiple handlers but you don’t use different catch statements (just a single catch). From there you can branch based on exception name or reasons.
try
if random(2) is 1
throw "this"
else
throw "that"
end if
catch exception
put exception
end catch
For more information refer to Chapter 7: Error Handling in the SenseTalk Reference manual.