From aa0b5d1a0e84f0b43d7b6ddd8deb8cca4f79b794 Mon Sep 17 00:00:00 2001 From: Daniel King Date: Fri, 10 Nov 2017 13:33:02 -0500 Subject: [PATCH] Improve error message when bgen.idx does not exist --- src/main/scala/is/hail/io/IndexBTree.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/scala/is/hail/io/IndexBTree.scala b/src/main/scala/is/hail/io/IndexBTree.scala index dc0e329d2db..f126e556da7 100644 --- a/src/main/scala/is/hail/io/IndexBTree.scala +++ b/src/main/scala/is/hail/io/IndexBTree.scala @@ -52,7 +52,11 @@ object IndexBTree { class IndexBTree(indexFileName: String, hConf: Configuration) { val maxDepth = calcDepth() - private val fs = hConf.fileSystem(indexFileName).open(new Path(indexFileName)) + private val fs = try { + hConf.fileSystem(indexFileName).open(new Path(indexFileName)) + } catch { + case e: Exception => fatal("Could not find a BGEN .idx file at $indexFileName. Try running HailContext.index_begn().", e) + } def close() = fs.close() @@ -119,4 +123,4 @@ class IndexBTree(indexFileName: String, hConf: Configuration) { else None } -} \ No newline at end of file +}