-
Notifications
You must be signed in to change notification settings - Fork 4
/
primitives.txt
56 lines (43 loc) · 1.17 KB
/
primitives.txt
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
Current:
testCompileNamedPrimitive
<primitive: 'crc32' module: 'Crypto' >
function PrimitiveTestCase__testCompileNamedPrimitive(){
var self=this;
Crypto.crc32();
return self;
}
Goal(s):
testCompileNamedPrimitive
<primitive: 'crc32' module: 'Crypto' >
function PrimitiveTestCase__testCompileNamedPrimitive(){
var self=this;
try {
return Crypto.crc32(self, arguments); // arguments is a JS built-in magic var
} catch (exception){
if (exception instanceof PrimitiveFailedException) {
// run fall through code
} else {
// pass on exception
throw exception;
}
self error: 'prim failed';
}
return self;
}
-----------
if (denominator === 0)
throw new Error("Attempted division by zero!");
catch (exception) {
if (exception instanceof TypeError) {
// Handle TypeError exceptions
} else if (exception instanceof ReferenceError) {
// Handle ReferenceError exceptions
} else {
// Handle all other types of exceptions
}
function DivisionByZeroError(message) {
this.name = "DivisionByZeroError";
this.message = (message || "");
}
DivisionByZeroError.prototype = new Error();
DivisionByZeroError.prototype.constructor = DivisionByZeroError;