Thibaut Schmitt 6203700b0c
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
Publish v1.0
Reviewed-on: #1
2022-10-17 11:24:27 +02: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 localizedDescription: 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 TwineTool. Please use it or remove reference from you strings file."
}
return " error:[\(Stringium.toolName)] Lang \"\(lang)\" not found for \"\(definitionName)\""
}
}
}