Catch error thrown by built in functions

Catch error thrown by built in functions

Hi, I would like to know if there is any method to catch or find if there is any error thrown during the deluge script execution and handle the same? Basically I am looking for something like a try-catch block. Any alternative will be appreciated.

Scenario: Parsing input text into date time format using toTime() function