Skip to content

Commit

Permalink
Print meaningful message when waiting for output
Browse files Browse the repository at this point in the history
  • Loading branch information
Marek Żarnowski committed Dec 4, 2019
1 parent 735ac3b commit 6498b4b
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -9,6 +9,7 @@ import org.eclipse.lsp4j.debug.OutputEventArguments
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import scala.concurrent.Promise
import scala.concurrent.TimeoutException
import scala.meta.internal.metals.MetalsEnrichments._

final class TestDebugger(connect: RemoteServer.Listener => Debugger)(
Expand Down Expand Up @@ -61,6 +62,11 @@ final class TestDebugger(connect: RemoteServer.Listener => Debugger)(
output
.awaitPrefix(Category.STDOUT, prefix)
.withTimeout(seconds, TimeUnit.SECONDS)
.recoverWith {
case timeout: TimeoutException =>
val error = s"No prefix [$prefix] in [${output()}]"
Future.failed(new Exception(error, timeout))
}
}
}

Expand Down

0 comments on commit 6498b4b

Please sign in to comment.