Skip to content

Commit 93023c8

Browse files
Make DependencyScanningError conform to LocalizedError
In order to get better error message on the build system, make DependencyScanningError conform to LocalizedError and return descriptive `errorDescription` for build system to display.
1 parent 1ef0e3e commit 93023c8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sources/SwiftDriver/SwiftScan/SwiftScan.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
import func Foundation.strdup
1616
import func Foundation.free
1717
import class Foundation.JSONDecoder
18+
import protocol Foundation.LocalizedError
1819
import struct Foundation.Data
1920

2021
import protocol TSCBasic.DiagnosticData
2122
import struct TSCBasic.AbsolutePath
2223
import struct TSCBasic.Diagnostic
2324

24-
public enum DependencyScanningError: Error, DiagnosticData {
25+
public enum DependencyScanningError: LocalizedError, DiagnosticData {
2526
case missingRequiredSymbol(String)
2627
case dependencyScanFailed(String)
2728
case failedToInstantiateScanner
@@ -60,6 +61,10 @@ public enum DependencyScanningError: Error, DiagnosticData {
6061
return "Supported compiler argument query failed"
6162
}
6263
}
64+
65+
public var errorDescription: String? {
66+
return self.description
67+
}
6368
}
6469

6570
@_spi(Testing) public struct ScannerDiagnosticPayload {

0 commit comments

Comments
 (0)