Wrap script in try/except block