resgen.swift/Sources/ResgenSwift/Analytics/AnalyticsError.swift
Loris Perret 6f8e3b6664
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
Add error handling
2023-12-11 10:09:24 +01:00

33 lines
952 B
Swift

//
// AnalyticsError.swift
//
//
// Created by Loris Perret on 11/12/2023.
//
import Foundation
enum AnalyticsError: Error {
case fileNotExists(String)
case missingElement(String)
case invalidParameter(String)
case writeFile(String, String)
var description: String {
switch self {
case .fileNotExists(let filename):
return "error: [\(Analytics.toolName)] File \(filename) does not exists "
case .missingElement(let element):
return "error: [\(Analytics.toolName)] Missing \(element) for Matomo"
case .invalidParameter(let reason):
return "error: [\(Analytics.toolName)] Invalid parameter \(reason)"
case .writeFile(let subErrorDescription, let filename):
return "error: [\(Analytics.toolName)] An error occured while writing content to \(filename): \(subErrorDescription)"
}
}
}