Skip to content

Commit 6124c9d

Browse files
committed
Replace an assertion by a fault log in WorkDoneProgressState
We didn’t hit this assertion but I noticed it and the best practice in sourcekit-lsp is to log a fault instead of throwing an assertion for any kind of recoverable error.
1 parent d439d12 commit 6124c9d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/SourceKitLSP/WorkDoneProgressState.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
import LSPLogging
1314
import LanguageServerProtocol
1415
import SKSupport
1516

@@ -108,7 +109,10 @@ final actor WorkDoneProgressState {
108109
}
109110

110111
func endProgressImpl(server: SourceKitLSPServer) async {
111-
assert(activeTasks > 0, "Unbalanced startProgress/endProgress calls")
112+
guard activeTasks > 0 else {
113+
logger.fault("Unbalanced startProgress/endProgress calls")
114+
return
115+
}
112116
activeTasks -= 1
113117
guard await server.capabilityRegistry?.clientCapabilities.window?.workDoneProgress ?? false else {
114118
return

0 commit comments

Comments
 (0)