If the following error is shown while using try-catch in your project,
The codegenerator for the current device does not support structured exception handling.
Please check if your TwinCAT version is higher than 4024 and whether your runtime system is 32 bit or not.