improve error codes

This commit is contained in:
leminlimez committed 2025-06-18 18:47:27 -04:00
1 parent d45a64bb19
commit 54aa8e20a3
2 files changed
+46 -7

No files matched your search

@@ -0,0 +1,30 @@
//
// ApplyError.swift
// Pocket Poster
//
// Created by lemin on 6/18/25.
//
import Foundation
enum ApplyError: LocalizedError {
// Throw when the app hash is incorrect
case wrongAppHash
// Throw when the collections need to be reset
case collectionsNeedsReset
// Throw in all other cases
case unexpected(info: String)
public var errorDescription: String? {
switch self {
case .wrongAppHash:
return "Your app hash is incorrect. Please set it again."
case .collectionsNeedsReset:
return "The folder is improperly set up. Please tap \"Reset Collections\" and try again."
case .unexpected(let info):
return info
}
}
}