@@ -22,29 +22,30 @@ public enum VPErrors: Error, CustomStringConvertible, Sendable {
22
22
/// Error case for when settings are not unique.
23
23
case settingsNotUnique
24
24
25
- /// Picture-in-Picture (PiP) is not supported
25
+ /// Picture-in-Picture (PiP) is not supported.
26
26
case notSupportedPiP
27
27
28
- /// Failed to load
29
- case failedToLoad
28
+ /// Failed to load.
29
+ /// - Parameter error: The error encountered during loading.
30
+ case failedToLoad( Error ? )
30
31
31
32
/// A description of the error, suitable for display.
32
33
public var description : String {
33
34
switch self {
34
- case . sourceNotFound( let name) :
35
- return " Source not found: \( name) "
35
+ case . sourceNotFound( let name) :
36
+ return " Source not found: \( name) "
36
37
37
- case . notSupportedPiP:
38
- return " Picture-in-Picture (PiP) is not supported on this device. "
38
+ case . notSupportedPiP:
39
+ return " Picture-in-Picture (PiP) is not supported on this device. "
39
40
40
- case . settingsNotUnique:
41
- return " Settings are not unique "
41
+ case . settingsNotUnique:
42
+ return " Settings are not unique. "
42
43
43
- case . remoteVideoError( let error) :
44
- return " Playback error: \( String ( describing : error? . localizedDescription) ) "
44
+ case . remoteVideoError( let error) :
45
+ return " Playback error: \( error? . localizedDescription?? " Unknown error. " ) "
45
46
46
- case . failedToLoad:
47
- return " Failed to load the video. "
47
+ case . failedToLoad( let error ) :
48
+ return " Failed to load the video: \( error ? . localizedDescription ?? " Unknown error. " ) "
48
49
}
49
50
}
50
51
}
@@ -57,12 +58,19 @@ extension VPErrors: Equatable {
57
58
switch ( lhs, rhs) {
58
59
case ( . remoteVideoError( let a) , . remoteVideoError( let b) ) :
59
60
return a? . localizedDescription == b? . localizedDescription
61
+
60
62
case ( . sourceNotFound( let a) , . sourceNotFound( let b) ) :
61
63
return a == b
64
+
62
65
case ( . settingsNotUnique, . settingsNotUnique) :
63
66
return true
64
- case ( . failedToLoad, . failedToLoad) :
67
+
68
+ case ( . notSupportedPiP, . notSupportedPiP) :
65
69
return true
70
+
71
+ case ( . failedToLoad( let a) , . failedToLoad( let b) ) :
72
+ return a? . localizedDescription == b? . localizedDescription
73
+
66
74
default :
67
75
return false
68
76
}
0 commit comments