mirror of https://github.com/sbt/sbt.git
Record the name of an Analysis file in case of a read failure.
Catch ReadException and wrap it in IOException that carries the name of the file we failed to read in its message. We have to catch exception and wrap them because in TextAnalysisFormat we don't have an access to the file name (it operates using an abstract reader).
This commit is contained in:
parent
668ae8d8b1
commit
bb8dd21620
|
|
@ -46,5 +46,12 @@ object IC extends IncrementalCompiler[Analysis, AnalyzingCompiler]
|
|||
}
|
||||
|
||||
def readCacheUncaught(file: File): (Analysis, CompileSetup) =
|
||||
Using.fileReader(IO.utf8)(file) { reader => TextAnalysisFormat.read(reader) }
|
||||
Using.fileReader(IO.utf8)(file) { reader =>
|
||||
try {
|
||||
TextAnalysisFormat.read(reader)
|
||||
} catch {
|
||||
case ex: sbt.inc.ReadException =>
|
||||
throw new java.io.IOException(s"Error while reading $file", ex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue