Skip to content

Commit 4882762

Browse files
authored
Merge pull request #2708 from dotty-staging/ide-crash
DLS: do not swallow exceptions in initialization
2 parents 60f5b03 + 53ff377 commit 4882762

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

language-server/src/dotty/tools/languageserver/DottyLanguageServer.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import java.net.URI
55
import java.io._
66
import java.nio.file._
77
import java.util.concurrent.CompletableFuture
8+
import java.util.function.Function
89

910
import com.fasterxml.jackson.databind.ObjectMapper
1011

@@ -133,6 +134,15 @@ class DottyLanguageServer extends LanguageServer
133134
// Do most of the initialization asynchronously so that we can return early
134135
// from this method and thus let the client know our capabilities.
135136
CompletableFuture.supplyAsync(() => drivers)
137+
.exceptionally {
138+
// Can't use a function literal here because of #2367
139+
new Function[Throwable, Nothing] {
140+
def apply(ex: Throwable) = {
141+
ex.printStackTrace
142+
sys.exit(1)
143+
}
144+
}
145+
}
136146

137147
new InitializeResult(c)
138148
}

0 commit comments

Comments
 (0)