Thibaut Schmitt 279f13dbd5
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
Add SwiftLint HARD rules
2025-04-30 17:05:02 +02:00

40 lines
1.3 KiB
Swift

//
// StringToolError.swift
//
//
// Created by Thibaut Schmitt on 05/01/2022.
//
import Foundation
enum StringiumError: Error {
case fileNotExists(String)
case langsListEmpty
case defaultLangsNotInLangs
case writeFile(String, String)
case langNotDefined(String, String, Bool)
var description: String {
switch self {
case .fileNotExists(let filename):
return "error: [\(Stringium.toolName)] File \(filename) does not exists "
case .langsListEmpty:
return "error: [\(Stringium.toolName)] Langs list is empty"
case .defaultLangsNotInLangs:
return "error: [\(Stringium.toolName)] Langs list does not contains the default lang"
case let .writeFile(subErrorDescription, filename):
return "error: [\(Stringium.toolName)] An error occured while writing content to \(filename): \(subErrorDescription)"
case let .langNotDefined(lang, definitionName, isReference):
if isReference {
return "error: [\(Stringium.toolName)] Reference are handled only by Twine. Please use it or remove reference from you strings file."
}
return "error: [\(Stringium.toolName)] Lang \"\(lang)\" not found for \"\(definitionName)\""
}
}
}