Quick exception handling
Jump to navigation
Jump to search
Problem. You have a code block that may fail but you don't want to open the Debugger when it fails, instead you want to run a plan-B in those cases.
Solution. In the following example the code block containing a division will fail for sure, when it fails we want to return nil
and write a message into the Transcript
.
[ 1/0 ] on: Error do: [
Transcript log: 'Error, division failed, result set to nil. '.
nil ].