Skip to content

Commit d0715c9

Browse files
bob-wilsonmirza-garibovic
authored andcommitted
Provide more detailed errors when serializing the ModuleDependenciesContext signature
1 parent 2c1c48a commit d0715c9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Sources/SWBCore/SpecImplementations/Tools/CCompiler.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,12 +1344,16 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
13441344
}
13451345

13461346
if let moduleDependenciesContext {
1347-
guard let jsonData = try? JSONEncoder(outputFormatting: [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes]).encode(moduleDependenciesContext),
1348-
let signature = String(data: jsonData, encoding: .utf8) else {
1349-
delegate.error("failed to serialize 'MODULE_DEPENDENCIES' context information")
1347+
do {
1348+
let jsonData = try JSONEncoder(outputFormatting: [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes]).encode(moduleDependenciesContext)
1349+
guard let signature = String(data: jsonData, encoding: .utf8) else {
1350+
throw StubError.error("non-UTF-8 data")
1351+
}
1352+
additionalSignatureData += "|\(signature)"
1353+
} catch {
1354+
delegate.error("failed to serialize 'MODULE_DEPENDENCIES' context information: \(error)")
13501355
return
13511356
}
1352-
additionalSignatureData += "|\(signature)"
13531357
}
13541358

13551359
// Finally, create the task.

0 commit comments

Comments
 (0)