-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathSystemActionFailure.swift
More file actions
32 lines (28 loc) · 1.01 KB
/
SystemActionFailure.swift
File metadata and controls
32 lines (28 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//
// File.swift
//
//
// Created by Danny Sung on 10/05/2021.
//
import Foundation
public enum SystemActionFailure: LocalizedError {
case nothingToRemove
case attemptToRemoveDirectory(URL)
case attemptToRemoveFile(URL)
case pathDoesNotExist(URL)
case directoryExists(URL)
public var errorDescription: String? {
switch self {
case .nothingToRemove:
return "Remove requested, but no item type specified."
case .attemptToRemoveDirectory(let fileUrl):
return "Attempted to remove a directory at \"\(fileUrl.path)\" when only file removal was specified"
case .attemptToRemoveFile(let fileUrl):
return "Attempted to remove a file at \"\(fileUrl.path)\" when only directory removal was specified"
case .pathDoesNotExist(let fileUrl):
return "The path \"\(fileUrl.path)\"specified does not exist."
case .directoryExists(let fileUrl):
return "Directory '\(fileUrl.path)' already exists."
}
}
}