Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
Ajout de la définition d'une architecture de classe pour éviter de définir manuellement les classes R/R2Image/R2Fonts.... (optionel)
35 lines
1.2 KiB
Swift
35 lines
1.2 KiB
Swift
//
|
|
// ResgenSwiftError.swift
|
|
//
|
|
//
|
|
// Created by Thibaut Schmitt on 30/08/2022.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
enum GenerateError: Error {
|
|
case fileNotExists(String)
|
|
case invalidConfigurationFile(String)
|
|
case commandError([String], String)
|
|
case writeFile(String, String)
|
|
|
|
var localizedDescription: String {
|
|
switch self {
|
|
case .fileNotExists(let filename):
|
|
return " error:[\(Generate.toolName)] File \(filename) does not exists"
|
|
|
|
case .invalidConfigurationFile(let filename):
|
|
return " error:[\(Generate.toolName)] File \(filename) is not a valid configuration file"
|
|
|
|
case .commandError(let command, let terminationStatus):
|
|
let readableCommand = command
|
|
.map { $0 }
|
|
.joined(separator: " ")
|
|
return "error:[\(Generate.toolName)] An error occured while running command '\(readableCommand)'. Command terminate with status code: \(terminationStatus)"
|
|
|
|
case .writeFile(let filename, let info):
|
|
return "error:[\(Generate.toolName)] An error occured while writing file in \(filename): \(info)"
|
|
}
|
|
}
|
|
}
|