-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.js
87 lines (74 loc) · 1.62 KB
/
test.js
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
'use strict';
const errorHub = require('./hub.js');
test1('testParam1');
test2('testParam2');
test3('JONNY');
test4('testParam4');
test5('testParam5');
test6('testParam6');
test7('hello');
////// Testing with original method
function test1(param) {
try {
let num = 123;
return num.toUpperCase();
} catch (e) {
errorHub.logError(e, 'ryan987', [1,2,3,4], 'This is ben1243s note');
}
}
function test2(param) {
try {
throw new SyntaxError('test2', 'someFile.js', 10);
} catch (e) {
errorHub.logError(e, 'davee1234', true, 'this is notes from test 2 function');
}
}
function test3(person) {
try {
throw new ReferenceError('test3', 'index.js', 10);
} catch (e) {
errorHub.logError1(e, 'ben6789', person, 'Will this note work? TRY AGAIN');
}
}
/////// Testing using metadata Obj
function test4(param) {
try {
let num = 123;
return num.toUpperCase();
} catch (e) {
let metaData = {
userid: 'dave123',
userparam: {hello:'hello'},
usernote: 'This is dave123 notes'
};
errorHub.logError1(e, metaData);
}
}
function test5(param) {
try {
throw new SyntaxError('test2', 'someFile.js', 10);
} catch (e) {
let metaData = {
userid: 'ryan234',
userparam: 1000,
};
errorHub.logError1(e, metaData);
}
}
function test6(person) {
try {
throw new ReferenceError('test3', 'index.js', 10);
} catch (e) {
let metaData = {
userid: 'ben345',
};
errorHub.logError1(e, metaData);
}
}
function test7(person) {
try {
throw new ReferenceError('test3', 'index.js', 10);
} catch (e) {
errorHub.logError1(e);
}
}