Errormessage

errormessage

Reports the last error message trapped by carefully. If errormessage reports an empty word, it means that the last operation using carefully did not report an error.

Example:

There is no turtle on the page.

carefully [fd 50]

[show errormessage]

No turtle found for forward

The following procedure asks a question and tries to play the answer. If the sound doesn't exist, the procedure displays a message and continues to the next instruction. Without carefully, an error message would be displayed and the procedure would stop.

to safe-play

question [What sound do you want?]

if empty? answer [stop]

carefully [run (list answer)] [announce [I don't have it.]] safe-play end