Fix multi-sentence error messages (#443)

Fixes multi-sentence error messages, where they start from a lowercased
letter.
This commit is contained in:
Dmitry Kovba
2025-12-09 12:32:09 -08:00
committed by GitHub
parent e8aff29be3
commit 96d37e2e21
6 changed files with 10 additions and 10 deletions
@@ -209,7 +209,7 @@ extension ImageStore {
throw ContainerizationError(
.internalError,
message:
"descriptor \(root.mediaType) with digest \(root.digest) does not list any supported platform or supports more than one platform. Supported platforms = \(supportedPlatforms)"
"descriptor \(root.mediaType) with digest \(root.digest) does not list any supported platform or supports more than one platform, supported platforms: \(supportedPlatforms)"
)
}
let platform = supportedPlatforms.first!
@@ -208,7 +208,7 @@ extension ImageStore {
do {
_ = try Reference.parse(new)
} catch {
throw ContainerizationError(.invalidArgument, message: "invalid reference \(new). Error: \(error)")
throw ContainerizationError(.invalidArgument, message: "invalid reference \(new), error: \(error)")
}
let newDescription = Image.Description(reference: new, descriptor: descriptor)
return try await self.create(description: newDescription)
@@ -55,13 +55,13 @@ public enum ArchiveError: Error, CustomStringConvertible {
case .unableToAddFilter(let code, let name):
return "unable to set the archive filter \(name), code \(code)"
case .unableToWriteEntryHeader(let code):
return "unable to write the entry header to the archive. Error code \(code)"
return "unable to write the entry header to the archive, code \(code)"
case .unableToWriteData(let code):
return "unable to write data to the archive. Error code \(code)"
return "unable to write data to the archive, code \(code)"
case .unableToCloseArchive(let code):
return "unable to close the archive. Error code \(code)"
return "unable to close the archive, code \(code)"
case .unableToOpenArchive(let code):
return "unable to open the archive. Error code \(code)"
return "unable to open the archive, code \(code)"
case .unableToSetOption(_):
return "unable to set an option on the archive."
case .failedToSetLocale(let locales):
@@ -87,7 +87,7 @@ package final class LocalOCILayoutClient: ContentClient {
throw ContainerizationError(
.internalError,
message:
"file \(filePath) exists but contains different content. expected digest: \(expectedDigest.digestString), existing digest: \(existingDigest.digestString)"
"file \(filePath) exists but contains different content, expected digest: \(expectedDigest.digestString), existing digest: \(existingDigest.digestString)"
)
}
@@ -36,7 +36,7 @@ public class ContentWriter {
let exists = FileManager.default.fileExists(atPath: base.path, isDirectory: &isDirectory)
guard exists && isDirectory.boolValue else {
throw ContainerizationError(.internalError, message: "cannot create ContentWriter for path \(base.absolutePath()). Not a directory")
throw ContainerizationError(.internalError, message: "cannot create ContentWriter for path \(base.absolutePath()), not a directory")
}
}
+2 -2
View File
@@ -188,7 +188,7 @@ public class Reference: CustomStringConvertible {
tag = fields["tag"] ?? ""
if tag.isEmpty {
throw ContainerizationError(.invalidArgument, message: "invalid format for image reference. Missing tag")
throw ContainerizationError(.invalidArgument, message: "invalid format for image reference, missing tag")
}
return try Reference(path: self.path, domain: self.domain, tag: tag)
}
@@ -202,7 +202,7 @@ public class Reference: CustomStringConvertible {
digest = fields["digest"] ?? ""
if digest.isEmpty {
throw ContainerizationError(.invalidArgument, message: "invalid format for image reference. Missing digest")
throw ContainerizationError(.invalidArgument, message: "invalid format for image reference, missing digest")
}
return try Reference(path: self.path, domain: self.domain, digest: digest)
}