Skip to content

Commit b3ef0c5

Browse files
Charlene TranCharlene Tran
Charlene Tran
authored and
Charlene Tran
committed
completed but still confused
1 parent 124a7e6 commit b3ef0c5

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

exceptions/exercises-CT/test-student-labs.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
function gradeLabs(labs) {
22
for (let i=0; i < labs.length; i++) {
33
let lab = labs[i];
4-
let result = lab.runLab(3);
4+
//let result = lab.runLab(3);
55

6+
67
// Added a Try/Catch block to catch an Exception if the 'runLab' property is not defined.
78
try {
8-
//
9-
} catch(err) {
10-
//
9+
let result = lab.runLab(3);
10+
} catch(error) {
11+
console.log("A TypeError has been caught. Due to 'runLab' property is not defined.")
12+
13+
// Prints out the actual Error message
14+
//console.log(error);
15+
16+
// If the Exception is thrown, 'result' should be set to "Error thrown"
17+
let result = "Error thrown";
1118
}
1219

1320

0 commit comments

Comments
 (0)