Try, Catch, Error Flashcards

1
Q

The ___________ statement lets you to test a code for possible errors. Place the code within the opening and closing braces. When any error occurs, it will be passed on to the catch statement.

A

try { }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The ______ statement lets you handle the error. The catch is executed only when an error occurs. You can program what to do if an error occurs

A

catch()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The argument received by the catch (i.e. catch(error)) is a JavaScript ________

A

ErrorObject

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what key word to throw an error

A

THROW

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The ________ statement marks a block of statements to try, and specifies a response, should an exception be thrown

A

try…catch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

throw “error!”;

console.log(“hello”); //

A

does not run, stops at throw

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

try {
throw “error right here me i am here!”;

} catch(err){
console.log(“caught”, err);
}

console.log(“hello”);

//returns

A

caught error right here me i am here!

hello

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

try {
throw “error right here me i am here!”;
console.log(“hello”);

} catch(err){
console.log(“caught”, err);
}

//returns

A

caught error right here me i am here!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

__________ that are executed after the try statement completes. These statements execute regardless of whether an exception was thrown or caught.

A

Finally Statements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
try {
    //throw "error right here me i am here!";
    console.log("hello"); 
} catch(err){
    console.log("caught", err);
} finally {
    console.log("took you a while");
}
 //returns and why
A

hello
took you a while

the catch is skipped as there was no error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The ______ constructor creates an error object.

A

error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How many errors are there

A

7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

try {
console.logw(“hello”);

} catch(err){
    // throw a new error object here
}
A

throw new Error (//message);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

in _____ there is no fetch method

A

Node

How well did you know this?
1
Not at all
2
3
4
5
Perfectly