mirror of https://github.com/sbt/sbt.git
Make BSP compile fail after random exception
This commit is contained in:
parent
74ff1b0a4a
commit
f0efbf0f5d
|
|
@ -10,7 +10,6 @@ package internal
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
|
|
||||||
import sbt.BuildSyntax._
|
import sbt.BuildSyntax._
|
||||||
import sbt.Def._
|
import sbt.Def._
|
||||||
import sbt.Keys._
|
import sbt.Keys._
|
||||||
|
|
@ -28,6 +27,7 @@ import sbt.std.TaskExtra
|
||||||
import sbt.util.Logger
|
import sbt.util.Logger
|
||||||
import sjsonnew.shaded.scalajson.ast.unsafe.{ JNull, JValue }
|
import sjsonnew.shaded.scalajson.ast.unsafe.{ JNull, JValue }
|
||||||
import sjsonnew.support.scalajson.unsafe.{ CompactPrinter, Converter, Parser => JsonParser }
|
import sjsonnew.support.scalajson.unsafe.{ CompactPrinter, Converter, Parser => JsonParser }
|
||||||
|
import xsbti.CompileFailed
|
||||||
|
|
||||||
// import scala.annotation.nowarn
|
// import scala.annotation.nowarn
|
||||||
import scala.util.control.NonFatal
|
import scala.util.control.NonFatal
|
||||||
|
|
@ -507,9 +507,11 @@ object BuildServerProtocol {
|
||||||
private def bspCompileTask: Def.Initialize[Task[Int]] = Def.task {
|
private def bspCompileTask: Def.Initialize[Task[Int]] = Def.task {
|
||||||
Keys.compile.result.value match {
|
Keys.compile.result.value match {
|
||||||
case Value(_) => StatusCode.Success
|
case Value(_) => StatusCode.Success
|
||||||
case Inc(_) =>
|
case Inc(cause) =>
|
||||||
// Cancellation is not yet implemented
|
cause.getCause match {
|
||||||
StatusCode.Error
|
case _: CompileFailed => StatusCode.Error
|
||||||
|
case err => throw cause
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue