added error handling

added error handling so application continues scripting if there is an
error with scripting one object but the error is shown.