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.")))
67
67
NSError *ExecuTorchErrorWithCode(ExecuTorchErrorCode code)
68
68
NS_SWIFT_NAME(Error(code:));
69
69
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
+
70
82
NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change 54
54
}
55
55
56
56
NSError *ExecuTorchErrorWithCode (ExecuTorchErrorCode code) {
57
+ return ExecuTorchErrorWithCodeAndDescription (code, nil );
58
+ }
59
+
60
+ NSError *ExecuTorchErrorWithCodeAndDescription (ExecuTorchErrorCode code, NSString * __nullable description) {
57
61
return [NSError errorWithDomain: ExecuTorchErrorDomain
58
62
code: code
59
63
userInfo: @{
60
- NSLocalizedDescriptionKey : ExecuTorchErrorDescription (code)
61
- }];
64
+ NSLocalizedDescriptionKey :
65
+ description.length > 0
66
+ ? [ExecuTorchErrorDescription (code) stringByAppendingFormat: @" : %@ " , description]
67
+ : ExecuTorchErrorDescription (code)
68
+ }];
62
69
}
You can’t perform that action at this time.
0 commit comments