-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherror.js
More file actions
57 lines (45 loc) · 1.44 KB
/
error.js
File metadata and controls
57 lines (45 loc) · 1.44 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const nsStr = NSString.stringWithString("0123");
try {
console.log(nsStr.substringFromIndex(5));
} catch (e) {
console.log(e.stack);
}
// NSOperationQueue.mainQueue.addOperationWithBlock(() => {
// console.log("Hello, World! from main queue");
// throw new Error("JavaScript error from block");
// });
// NSTimer.scheduledTimerWithTimeIntervalRepeatsBlock(
// 1,
// false,
// () => {
// console.log("Hello, World! from timer");
// throw new Error("JavaScript error from timer");
// },
// );
// globalThis.__onUncaughtError = (err) => {
// console.log("Hello, World! from globalThis.__onUncaughtError");
// console.log(err.stack);
// };
// class ApplicationDelegate extends NSObject {
// static ObjCProtocols = [NSApplicationDelegate];
// static {
// NativeClass(this);
// }
// applicationDidFinishLaunching(_notification) {
// console.log("Hello, World! from applicationDidFinishLaunching");
// throw new Error("JavaScript error from applicationDidFinishLaunching");
// }
// }
// const appDelegate = ApplicationDelegate.new();
// const app = NSApplication.sharedApplication;
// app.delegate = appDelegate;
// app.setActivationPolicy(NSApplicationActivationPolicy.Regular);
// NSApplicationMain(0, null);
const arr = NSArray.arrayWithArray([1, 2, 3]);
try {
arr.enumerateObjectsUsingBlock((_obj, _idx, _stop) => {
throw new Error("JavaScript error from block");
});
} catch (e) {
console.log(e.stack);
}