13
13
import Foundation
14
14
import IndexStoreDB
15
15
import LanguageServerProtocol
16
+ import SKLogging
16
17
import SemanticIndex
17
18
@_spi ( Linkcompletion) @preconcurrency import SwiftDocC
18
19
import SwiftExtensions
@@ -48,7 +49,7 @@ final class DocCReferenceResolutionService: DocumentationService, Sendable {
48
49
) {
49
50
do {
50
51
let response = try process ( message)
51
- completion ( response) ;
52
+ completion ( response)
52
53
} catch {
53
54
completion ( createResponseWithErrorMessage ( error. localizedDescription) )
54
55
}
@@ -120,7 +121,7 @@ final class DocCReferenceResolutionService: DocumentationService, Sendable {
120
121
}
121
122
}
122
123
123
- private func decode< T> ( _ type: T . Type , from data: Data ) throws ( ReferenceResolutionError) -> T where T : Decodable {
124
+ private func decode< T: Decodable > ( _ type: T . Type , from data: Data ) throws ( ReferenceResolutionError) -> T {
124
125
do {
125
126
return try JSONDecoder ( ) . decode ( T . self, from: data)
126
127
} catch {
@@ -138,12 +139,10 @@ final class DocCReferenceResolutionService: DocumentationService, Sendable {
138
139
139
140
private func createResponseWithErrorMessage( _ message: String ) -> DocumentationServer . Message {
140
141
let errorMessage = OutOfProcessReferenceResolver . Response. errorMessage ( message)
141
- do {
142
- let encodedErrorMessage = try JSONEncoder ( ) . encode ( errorMessage)
143
- return createResponse ( payload: encodedErrorMessage)
144
- } catch {
145
- return createResponse ( payload: nil )
142
+ let encodedErrorMessage = orLog ( " Encoding error message for OutOfProcessReferenceResolver.Response " ) {
143
+ try JSONEncoder ( ) . encode ( errorMessage)
146
144
}
145
+ return createResponse ( payload: encodedErrorMessage)
147
146
}
148
147
149
148
private func createResponse( payload: Data ? ) -> DocumentationServer . Message {
0 commit comments