blob: cc5e2c0d161e039613042ba5aa95b4e103053b62 (
plain)
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
|
//
// OperationError.swift
// Operations
//
// Created by pronebird on 24/01/2022.
// Copyright © 2026 Mullvad VPN AB. All rights reserved.
//
import Foundation
public enum OperationError: LocalizedError, Equatable {
/// Unsatisfied operation requirement.
case unsatisfiedRequirement
/// Operation cancelled.
case cancelled
public var errorDescription: String? {
switch self {
case .unsatisfiedRequirement:
return "Unsatisfied operation requirement."
case .cancelled:
return "Operation was cancelled."
}
}
}
extension Error {
public var isOperationCancellationError: Bool {
(self as? OperationError) == .cancelled
}
}
|