File tree 2 files changed +16
-3
lines changed
src/darwin/Framework/CHIP
2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -23,12 +23,15 @@ FOUNDATION_EXPORT NSErrorDomain const MTRErrorDomain;
23
23
FOUNDATION_EXPORT NSErrorDomain const MTRInteractionErrorDomain;
24
24
25
25
/* *
26
- * ChipErrorDomain contains errors caused by data processing the framework
26
+ * MTRErrorDomain contains errors caused by data processing the framework
27
27
* itself is performing. These can be caused by invalid values provided to a
28
28
* framework API, failure to decode an incoming message, and so forth.
29
29
*
30
- * Errors reported by the other side of a Matter interaction use
31
- * MTRInteractionErrorDomain instead.
30
+ * This error domain also contains errors that are communicated via success
31
+ * responses from a server but mapped to an error on the client.
32
+ *
33
+ * Errors reported by the server side of a Matter interaction via the normal
34
+ * Matter error-reporting mechanisms use MTRInteractionErrorDomain instead.
32
35
*/
33
36
// clang-format off
34
37
typedef NS_ERROR_ENUM (MTRErrorDomain, MTRErrorCode){
@@ -51,6 +54,11 @@ typedef NS_ERROR_ENUM(MTRErrorDomain, MTRErrorCode){
51
54
MTRErrorCodeIntegrityCheckFailed = 8 ,
52
55
MTRErrorCodeTimeout = 9 ,
53
56
MTRErrorCodeBufferTooSmall = 10 ,
57
+ /* *
58
+ * MTRErrorCodeFabricExists is returned when trying to commission a device
59
+ * into a fabric when it's already part of that fabric.
60
+ */
61
+ MTRErrorCodeFabricExists = 11 ,
54
62
};
55
63
// clang-format on
56
64
Original file line number Diff line number Diff line change @@ -80,6 +80,11 @@ + (NSError *)errorForCHIPErrorCode:(CHIP_ERROR)errorCode
80
80
} else if (errorCode == CHIP_ERROR_BUFFER_TOO_SMALL) {
81
81
code = MTRErrorCodeBufferTooSmall;
82
82
[userInfo addEntriesFromDictionary: @{ NSLocalizedDescriptionKey : NSLocalizedString(@" A buffer is too small." , nil ) }];
83
+ } else if (errorCode == CHIP_ERROR_FABRIC_EXISTS) {
84
+ code = MTRErrorCodeFabricExists;
85
+ [userInfo addEntriesFromDictionary: @{
86
+ NSLocalizedDescriptionKey : NSLocalizedString(@" The device is already a member of this fabric." , nil )
87
+ }];
83
88
} else {
84
89
code = MTRErrorCodeGeneralError;
85
90
[userInfo addEntriesFromDictionary: @{
You can’t perform that action at this time.
0 commit comments