For a basic example of a try catch block I have a sting that represents an invalid JSON string. When I attempt to try to parse the JSON string into a workable object this results in an Error.
Instead of the script failing completely a try catch statement can be used to define what to do in the event of an error such as this. The flow of the script will then continue instead of coming to a griding halt.
A try catch statement must be followed by a catch or finally statement or else it will result in an Error.
When using the return keyword in the body of a try catch block, any return statement used in the finally block will supersede any additional return statements that may exist in the try, or catch blocks.
The catch block of a try catch statement will have a reference to the error object or catch id of the error that occurred in the try block. This can be used to set custom error handling conditions for specific errors.