-
-
Notifications
You must be signed in to change notification settings - Fork 124
Expand file tree
/
Copy patherror.ios.ts
More file actions
27 lines (25 loc) · 886 Bytes
/
error.ios.ts
File metadata and controls
27 lines (25 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
export class MobileAdsError extends Error {
_native: NSError;
static fromNative(native: NSError, message?: string) {
const error = new MobileAdsError(message || native?.localizedDescription);
error._native = native;
return error;
}
get native() {
return this._native;
}
intoNative() {
if (!this._native) {
const exception = NSException.exceptionWithNameReasonUserInfo(NSGenericException, this.message, null);
const info = {};
info['ExceptionName'] = exception.name;
info['ExceptionReason'] = exception.reason;
info['ExceptionCallStackReturnAddresses'] = exception.callStackReturnAddresses;
info['ExceptionCallStackSymbols'] = exception.callStackSymbols;
info['ExceptionUserInfo'] = exception.userInfo;
const error = NSError.alloc().initWithDomainCodeUserInfo('NativeScript', 1000, info as any);
return error;
}
return this._native;
}
}