Thibaut Schmitt 9ab7e74991
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
Renaming errors property: localizedDescription -> description
Re enabling generation of ressources on commond
Architecture will now generate property of subobject as non-static. It will allow usage like R.sub_object.sub_property.property
2022-11-22 17:37:24 +01:00

39 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 .writeFile(let subErrorDescription, let filename):
return "error: [\(Stringium.toolName)] An error occured while writing content to \(filename): \(subErrorDescription)"
case .langNotDefined(let lang, let definitionName, let 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)\""
}
}
}