File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -819,15 +819,17 @@ myTag`Note: ${person} is a member of following communities: ${membership}`;
819819
820820` ` ` js
821821try {
822- callAPI (); // It will throw an Error
822+ // Below statement will throw an Error
823+ callAPI ();
823824} catch (error) {
824- throw new Error (error); // ReferenceError: callAPI is not defined
825+ // Create a new error and throw
826+ throw new Error (error); // ReferenceError: callAPI is not defined
825827} finally {
826- console .log (" I will execute no matter what happened in try or catch" );
828+ console .log (' I will execute no matter what happened in try or catch' );
827829}
828830` ` `
829- ###### Notes
830831
832+ ###### Notes
831833- ` try ` can be chained with ` catch ` block or ` finally ` block
832834- ` try ..catch ` only works synchronously and for runtime errors
833835
You can’t perform that action at this time.
0 commit comments