Skip to content

Commit 3896055

Browse files
dkovbajglogan
andauthored
Lowercase error messages (apple#945)
## Type of Change - [x] Bug fix - [ ] New feature - [ ] Breaking change - [ ] Documentation update ## Motivation and Context For consistency, all error messages are lowercased. ## Testing - [ ] Tested locally - [ ] Added/updated tests - [ ] Added/updated docs --------- Co-authored-by: J Logan <sgtbakerrahulnet@yahoo.com>
1 parent 0733a81 commit 3896055

21 files changed

Lines changed: 44 additions & 44 deletions

File tree

Sources/ContainerBuild/BuildPipelineHandler.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public actor BuildPipeline {
105105
throw NSError(
106106
domain: "untilFirstError",
107107
code: 1,
108-
userInfo: [NSLocalizedDescriptionKey: "Failed to initialize task continuation"])
108+
userInfo: [NSLocalizedDescriptionKey: "failed to initialize task continuation"])
109109
}
110110
defer { taskContinuation.finish() }
111111
let stream = AsyncStream<Error> { continuation in

Sources/ContainerBuild/URL+Extensions.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public final class BufferedCopyReader: AsyncSequence {
228228
throw CocoaError(
229229
.fileReadUnsupportedScheme,
230230
userInfo: [
231-
NSLocalizedDescriptionKey: "Reset not supported with InputStream-based implementation"
231+
NSLocalizedDescriptionKey: "reset not supported with InputStream-based implementation"
232232
])
233233
}
234234

@@ -240,7 +240,7 @@ public final class BufferedCopyReader: AsyncSequence {
240240
throw CocoaError(
241241
.fileReadUnsupportedScheme,
242242
userInfo: [
243-
NSLocalizedDescriptionKey: "Offset tracking not supported with InputStream-based implementation"
243+
NSLocalizedDescriptionKey: "offset tracking not supported with InputStream-based implementation"
244244
])
245245
}
246246

@@ -252,7 +252,7 @@ public final class BufferedCopyReader: AsyncSequence {
252252
throw CocoaError(
253253
.fileReadUnsupportedScheme,
254254
userInfo: [
255-
NSLocalizedDescriptionKey: "Seeking not supported with InputStream-based implementation"
255+
NSLocalizedDescriptionKey: "seeking not supported with InputStream-based implementation"
256256
])
257257
}
258258

Sources/ContainerClient/Core/ClientDiskUsage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public struct ClientDiskUsage {
3131
guard let responseData = reply.dataNoCopy(key: .diskUsageStats) else {
3232
throw ContainerizationError(
3333
.internalError,
34-
message: "Invalid response from server: missing disk usage data"
34+
message: "invalid response from server: missing disk usage data"
3535
)
3636
}
3737

Sources/ContainerClient/Core/ClientKernel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ extension ClientKernel {
8484
throw err
8585
}
8686
throw ContainerizationError(
87-
.notFound, message: "Default kernel not configured for architecture \(platform.architecture). Please use the `container system kernel set` command to configure it")
87+
.notFound, message: "default kernel not configured for architecture \(platform.architecture), please use the `container system kernel set` command to configure it")
8888
}
8989
}
9090
}
@@ -97,7 +97,7 @@ extension SystemPlatform {
9797
case "amd64":
9898
return .linuxAmd
9999
default:
100-
fatalError("Unknown architecture")
100+
fatalError("unknown architecture")
101101
}
102102
}
103103
}

Sources/ContainerClient/Core/ClientVolume.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public struct ClientVolume {
4141
let reply = try await client.send(message)
4242

4343
guard let responseData = reply.dataNoCopy(key: .volume) else {
44-
throw VolumeError.storageError("Invalid response from server")
44+
throw VolumeError.storageError("invalid response from server")
4545
}
4646

4747
return try JSONDecoder().decode(Volume.self, from: responseData)

Sources/ContainerClient/Core/Volume.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,17 @@ public enum VolumeError: Error, LocalizedError {
8080
public var errorDescription: String? {
8181
switch self {
8282
case .volumeNotFound(let name):
83-
return "Volume '\(name)' not found"
83+
return "volume '\(name)' not found"
8484
case .volumeAlreadyExists(let name):
85-
return "Volume '\(name)' already exists"
85+
return "volume '\(name)' already exists"
8686
case .volumeInUse(let name):
87-
return "Volume '\(name)' is currently in use and cannot be accessed by another container, or deleted."
87+
return "volume '\(name)' is currently in use and cannot be accessed by another container, or deleted"
8888
case .invalidVolumeName(let name):
89-
return "Invalid volume name '\(name)'"
89+
return "invalid volume name '\(name)'"
9090
case .driverNotSupported(let driver):
91-
return "Volume driver '\(driver)' is not supported"
91+
return "volume driver '\(driver)' is not supported"
9292
case .storageError(let message):
93-
return "Storage error: \(message)"
93+
return "storage error: \(message)"
9494
}
9595
}
9696
}

Sources/ContainerClient/Parser.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public struct Parser {
262262
}()
263263

264264
guard let commandToRun = processArguments, commandToRun.count > 0 else {
265-
throw ContainerizationError(.invalidArgument, message: "Command/Entrypoint not specified for container process")
265+
throw ContainerizationError(.invalidArgument, message: "command/entrypoint not specified for container process")
266266
}
267267

268268
let defaultUser: ProcessConfiguration.User = {

Sources/ContainerCommands/Container/ContainerStats.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ extension Application {
7474
guard let container = allContainers.first(where: { $0.id == containerId || $0.id.starts(with: containerId) }) else {
7575
throw ContainerizationError(
7676
.notFound,
77-
message: "Error: No such container: \(containerId)"
77+
message: "no such container: \(containerId)"
7878
)
7979
}
8080
found.append(container)
@@ -102,7 +102,7 @@ extension Application {
102102
guard allContainers.first(where: { $0.id == containerId || $0.id.starts(with: containerId) }) != nil else {
103103
throw ContainerizationError(
104104
.notFound,
105-
message: "Error: No such container: \(containerId)"
105+
message: "no such container: \(containerId)"
106106
)
107107
}
108108
}
@@ -140,7 +140,7 @@ extension Application {
140140
}
141141
} catch {
142142
clearScreen()
143-
print("Error collecting stats: \(error)")
143+
print("error collecting stats: \(error)")
144144
try await Task.sleep(for: .seconds(2))
145145
}
146146
}

Sources/ContainerCommands/DefaultCommand.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ struct DefaultCommand: AsyncParsableCommand {
4242

4343
// Check for edge cases and unknown options to match the behavior in the absence of plugins.
4444
if command.isEmpty {
45-
throw ValidationError("Unknown argument '\(command)'")
45+
throw ValidationError("unknown argument '\(command)'")
4646
} else if command.starts(with: "-") {
47-
throw ValidationError("Unknown option '\(command)'")
47+
throw ValidationError("unknown option '\(command)'")
4848
}
4949

5050
// Compute canonical plugin directories to show in helpful errors (avoid hard-coded paths)

Sources/ContainerCommands/System/Kernel/KernelSet.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ extension Application {
6767

6868
private func setKernelFromBinary() async throws {
6969
guard let binaryPath else {
70-
throw ArgumentParser.ValidationError("Missing argument '--binary'")
70+
throw ArgumentParser.ValidationError("missing argument '--binary'")
7171
}
7272
let absolutePath = URL(fileURLWithPath: binaryPath, relativeTo: .currentDirectory()).absoluteURL.absoluteString
7373
let platform = try getSystemPlatform()
@@ -76,10 +76,10 @@ extension Application {
7676

7777
private func setKernelFromTar() async throws {
7878
guard let binaryPath else {
79-
throw ArgumentParser.ValidationError("Missing argument '--binary'")
79+
throw ArgumentParser.ValidationError("missing argument '--binary'")
8080
}
8181
guard let tarPath else {
82-
throw ArgumentParser.ValidationError("Missing argument '--tar")
82+
throw ArgumentParser.ValidationError("missing argument '--tar")
8383
}
8484
let platform = try getSystemPlatform()
8585
let localTarPath = URL(fileURLWithPath: tarPath, relativeTo: .currentDirectory()).path

0 commit comments

Comments
 (0)