Better "file not found" error message#10152
Conversation
|
Since we didn't start the testing against this change, can we target the PR to |
5e405b5 to
dcfd27c
Compare
| static func localArchiveNotFound(archivePath: AbsolutePath, targetName: String) -> Self { | ||
| .init(description: "local archive of binary target '\(targetName)' at '\(archivePath)' does not exist.") | ||
| } |
There was a problem hiding this comment.
suggestion: consider changing targetName to target to ensure the caller sends an "expected" value.
| static func localArchiveNotFound(archivePath: AbsolutePath, targetName: String) -> Self { | |
| .init(description: "local archive of binary target '\(targetName)' at '\(archivePath)' does not exist.") | |
| } | |
| static func localArchiveNotFound(archivePath: AbsolutePath, target: Target) -> Self { | |
| .init(description: "local archive of binary target '\(target.name)' at '\(archivePath)' does not exist.") | |
| } |
There was a problem hiding this comment.
I think we should refactor every error so it references a target object instead of a string. This is outside the scope of this PR, so I made this one.
|
@swift-ci test |
|
@swift-ci test |
|
@swift-ci test self hosted windows |
|
@swift-ci test macOS |
|
@swift-ci test linux |
1 similar comment
|
@swift-ci test linux |
|
@swift-ci test macOS |
|
hmmm... I found a simpler solution. I changed the definition of extension FileSystemError: CustomNSError {
public var errorUserInfo: [String : Any] {
return [NSLocalizedDescriptionKey: localizedMessage ?? "\(self)"]
}
}When the target doesn't exist, an error is thrown with no swiftlang/swift-tools-support-core#563 adds the I'm closing this PR because swiftlang/swift-tools-support-core#563 already fixes this issue. |
If you reference a file that doesn't exist in
Package.swift, you get this error:This PR throws this error instead: