-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathscript.js
More file actions
31 lines (30 loc) · 702 Bytes
/
script.js
File metadata and controls
31 lines (30 loc) · 702 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
28
29
30
31
function MyError(param1, param2) {
var instance = new Error(param1);
Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
if (Error.captureStackTrace) {
Error.captureStackTrace(instance, MyError);
}
instance.name = "MyError";
return instance;
}
try {
try {
console.log("im trying");
eval("function test() {console.log('test');}");
test();
throw new Error("test error");
console.log("Done");
} catch (error) {
console.log("Oups error");
if (error instanceof MyError) {
console.log(error);
} else {
throw error;
}
} finally {
console.log("can do it");
}
} catch (error) {
console.log("really bad");
throw error;
}