From 53ff37792ea1047e48ea01750b852f8e15229be5 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Wed, 7 Jun 2017 21:01:36 +0200 Subject: [PATCH] DLS: do not swallow exceptions in initialization --- .../tools/languageserver/DottyLanguageServer.scala | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/language-server/src/dotty/tools/languageserver/DottyLanguageServer.scala b/language-server/src/dotty/tools/languageserver/DottyLanguageServer.scala index ca178b4a005f..dd89f9f9f3a1 100644 --- a/language-server/src/dotty/tools/languageserver/DottyLanguageServer.scala +++ b/language-server/src/dotty/tools/languageserver/DottyLanguageServer.scala @@ -5,6 +5,7 @@ import java.net.URI import java.io._ import java.nio.file._ import java.util.concurrent.CompletableFuture +import java.util.function.Function import com.fasterxml.jackson.databind.ObjectMapper @@ -133,6 +134,15 @@ class DottyLanguageServer extends LanguageServer // Do most of the initialization asynchronously so that we can return early // from this method and thus let the client know our capabilities. CompletableFuture.supplyAsync(() => drivers) + .exceptionally { + // Can't use a function literal here because of #2367 + new Function[Throwable, Nothing] { + def apply(ex: Throwable) = { + ex.printStackTrace + sys.exit(1) + } + } + } new InitializeResult(c) }