Fix error/warning message to be shown in Xcode.IssueNavigator
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit

This commit is contained in:
2022-11-22 17:14:13 +01:00
parent 5a3d273acc
commit fc427733ee
27 changed files with 79 additions and 79 deletions

View File

@ -74,14 +74,14 @@ struct Fonts: ParsableCommand {
// Check input file exists
guard fileManager.fileExists(atPath: options.inputFile) else {
let error = FontsToolError.fileNotExists(options.inputFile)
print(error.localizedDescription)
print(error.description)
Fonts.exit(withError: error)
}
// Extension for UIKit and SwiftUI should have different name
guard options.extensionName != options.extensionNameSwiftUI else {
let error = FontsToolError.extensionNamesCollision(options.extensionName)
print(error.localizedDescription)
print(error.description)
Fonts.exit(withError: error)
}

View File

@ -17,19 +17,19 @@ enum FontsToolError: Error {
var localizedDescription: String {
switch self {
case .extensionNamesCollision(let extensionName):
return "error:[\(Fonts.toolName)] Error on extension names, extension name and SwiftUI extension name should be different (\(extensionName) is used on both)"
return "error: [\(Fonts.toolName)] Error on extension names, extension name and SwiftUI extension name should be different (\(extensionName) is used on both)"
case .fcScan(let path, let code, let output):
return "error:[\(Fonts.toolName)] Error while getting fontName (fc-scan --format %{postscriptname} \(path). fc-scan exit with \(code) and output is: \(output ?? "no output")"
return "error: [\(Fonts.toolName)] Error while getting fontName (fc-scan --format %{postscriptname} \(path). fc-scan exit with \(code) and output is: \(output ?? "no output")"
case .inputFolderNotFound(let inputFolder):
return " error:[\(Fonts.toolName)] Input folder not found: \(inputFolder)"
return "error: [\(Fonts.toolName)] Input folder not found: \(inputFolder)"
case .fileNotExists(let filename):
return " error:[\(Fonts.toolName)] File \(filename) does not exists"
return "error: [\(Fonts.toolName)] File \(filename) does not exists"
case .writeExtension(let filename, let info):
return "error:[\(Fonts.toolName)] An error occured while writing extension in \(filename): \(info)"
return "error: [\(Fonts.toolName)] An error occured while writing extension in \(filename): \(info)"
}
}
}

View File

@ -39,7 +39,7 @@ class FontsToolHelper {
let fileManager = FileManager()
guard fileManager.fileExists(atPath: inputFolder) else {
let error = FontsToolError.inputFolderNotFound(inputFolder)
print(error.localizedDescription)
print(error.description)
Fonts.exit(withError: error)
}
@ -64,7 +64,7 @@ class FontsToolHelper {
guard let fontName = task.output, task.terminationStatus == 0 else {
let error = FontsToolError.fcScan(path, task.terminationStatus, task.output)
print(error.localizedDescription)
print(error.description)
Fonts.exit(withError: error)
}

View File

@ -38,7 +38,7 @@ class FontExtensionGenerator {
try extensionContent.write(to: extensionFilePathURL, atomically: false, encoding: .utf8)
} catch (let error) {
let error = FontsToolError.writeExtension(extensionFilePath, error.localizedDescription)
print(error.localizedDescription)
print(error.description)
Fonts.exit(withError: error)
}
}