File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
extension/apple/ExecuTorch/Exported Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -67,4 +67,16 @@ __attribute__((deprecated("This API is experimental.")))
6767NSError *ExecuTorchErrorWithCode(ExecuTorchErrorCode code)
6868 NS_SWIFT_NAME(Error(code:));
6969
70+ /* *
71+ * Create an NSError in the ExecuTorch domain for the given code.
72+ *
73+ * @param code The ExecuTorchErrorCode to wrap.
74+ * @param description Additional error description.
75+ * @return An NSError with ExecuTorchErrorDomain, the specified code, and a localized description.
76+ */
77+ FOUNDATION_EXPORT
78+ __attribute__ ((deprecated(" This API is experimental." )))
79+ NSError *ExecuTorchErrorWithCodeAndDescription(ExecuTorchErrorCode code, NSString * __nullable description)
80+ NS_SWIFT_NAME(Error(code:description:));
81+
7082NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change 5454}
5555
5656NSError *ExecuTorchErrorWithCode (ExecuTorchErrorCode code) {
57+ return ExecuTorchErrorWithCodeAndDescription (code, nil );
58+ }
59+
60+ NSError *ExecuTorchErrorWithCodeAndDescription (ExecuTorchErrorCode code, NSString * __nullable description) {
5761 return [NSError errorWithDomain: ExecuTorchErrorDomain
5862 code: code
5963 userInfo: @{
60- NSLocalizedDescriptionKey : ExecuTorchErrorDescription (code)
61- }];
64+ NSLocalizedDescriptionKey :
65+ description.length > 0
66+ ? [ExecuTorchErrorDescription (code) stringByAppendingFormat: @" : %@ " , description]
67+ : ExecuTorchErrorDescription (code)
68+ }];
6269}
You can’t perform that action at this time.
0 commit comments