We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 124a7e6 commit b3ef0c5Copy full SHA for b3ef0c5
exceptions/exercises-CT/test-student-labs.js
@@ -1,13 +1,20 @@
1
function gradeLabs(labs) {
2
for (let i=0; i < labs.length; i++) {
3
let lab = labs[i];
4
- let result = lab.runLab(3);
+ //let result = lab.runLab(3);
5
6
+
7
// Added a Try/Catch block to catch an Exception if the 'runLab' property is not defined.
8
try {
- //
9
- } catch(err) {
10
+ let result = lab.runLab(3);
+ } 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";
18
}
19
20
0 commit comments