@@ -15,4 +15,40 @@ public struct LibreError : Error {
15
15
self . errorCode = errorCode
16
16
self . errorMessage = errorMessage
17
17
}
18
+
19
+ public static func unknown( _ msg: String ) -> LibreError {
20
+ return LibreError ( errorCode: 0 , errorMessage: msg)
21
+ }
22
+
23
+ public static func connectionFailed( _ msg: String ) -> LibreError {
24
+ return LibreError ( errorCode: 1 , errorMessage: msg)
25
+ }
26
+
27
+ public static func gettingSystemInfoFailed( _ msg: String ) -> LibreError {
28
+ return LibreError ( errorCode: 2 , errorMessage: msg)
29
+ }
30
+
31
+ public static func commandNotSupported( _ cmd: String ) -> LibreError {
32
+ return LibreError ( errorCode: 3 , errorMessage: " Command not supported: \( cmd) " )
33
+ }
34
+
35
+ public static func activationError( _ msg: String ) -> LibreError {
36
+ return LibreError ( errorCode: 4 , errorMessage: " Activation error: \( msg) " )
37
+ }
38
+
39
+ public static func readFailure( _ msg: String ) -> LibreError {
40
+ return LibreError ( errorCode: 5 , errorMessage: " Read error: \( msg) " )
41
+ }
42
+
43
+ public static func unexpected( _ msg: String ) -> LibreError {
44
+ return LibreError ( errorCode: 6 , errorMessage: " Unexpected error: \( msg) " )
45
+ }
46
+
47
+ public static func oop( _ msg: String ) -> LibreError {
48
+ return LibreError ( errorCode: 7 , errorMessage: " OOP error: \( msg) " )
49
+ }
50
+
51
+ public static func dataValidation( _ msg: String ) -> LibreError {
52
+ return LibreError ( errorCode: 8 , errorMessage: " Data validation error: \( msg) " )
53
+ }
18
54
}
0 commit comments