catching exceptions and pushing them into script