Skip to content

Commit 1108294

Browse files
bzbarsky-applepull[bot]
authored andcommitted
Add Darwin error mapping for CHIP_ERROR_TIMEOUT. (#15980)
1 parent 335f88e commit 1108294

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/darwin/Framework/CHIP/CHIPError.h

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ typedef NS_ERROR_ENUM(CHIPErrorDomain, CHIPErrorCode){
4949
CHIPErrorCodeInvalidState = 6,
5050
CHIPErrorCodeWrongAddressType = 7,
5151
CHIPErrorCodeIntegrityCheckFailed = 8,
52+
CHIPErrorCodeTimeout = 9,
5253
};
5354
// clang-format on
5455

src/darwin/Framework/CHIP/CHIPError.mm

+8
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ + (NSError *)errorForCHIPErrorCode:(CHIP_ERROR)errorCode
7777
userInfo:@{ NSLocalizedDescriptionKey : NSLocalizedString(@"Integrity check failed.", nil) }];
7878
}
7979

80+
if (errorCode == CHIP_ERROR_TIMEOUT) {
81+
return [NSError errorWithDomain:CHIPErrorDomain
82+
code:CHIPErrorCodeTimeout
83+
userInfo:@{ NSLocalizedDescriptionKey : NSLocalizedString(@"Transaction timed out.", nil) }];
84+
}
85+
8086
return [NSError errorWithDomain:CHIPErrorDomain
8187
code:CHIPErrorCodeGeneralError
8288
userInfo:@{
@@ -237,6 +243,8 @@ + (CHIP_ERROR)errorToCHIPErrorCode:(NSError * _Nullable)error
237243
return CHIP_ERROR_INCORRECT_STATE;
238244
case CHIPErrorCodeIntegrityCheckFailed:
239245
return CHIP_ERROR_INTEGRITY_CHECK_FAILED;
246+
case CHIPErrorCodeTimeout:
247+
return CHIP_ERROR_TIMEOUT;
240248
default:
241249
return CHIP_ERROR_INTERNAL;
242250
}

0 commit comments

Comments
 (0)