adding better error handling when indexing an RDD