You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What specific section or headline is this issue about?
No response
What information was incorrect, unhelpful, or incomplete?
The demo if try...catch page is not completely working.
I changed the demo code like:
try{nonExistentFunction();}catch(error){console.error(error);// Expected output: ReferenceError: nonExistentFunction is not defined// (Note: the exact output may be browser-dependent)throwerror}finally{console.log("Finally")}
Then clicked the button "Run".
Because of throw error in the catch block, the console.log in the finally block is not printed inside the box just below.
What did you expect to see?
I'd expect to see that the log "Finally" is printed in the box at bottom of the demo
Do you have any supporting links, references, or citations?
Josh-Cena
added
to move
If the issue doesn't belong in Content but elsewhere in the MDN org
and removed
Content:JS
JavaScript docs
needs triage
Triage needed by staff and/or partners. Automatically applied when an issue is opened.
labels
Jan 17, 2025
Josh-Cena
changed the title
Try...catch demo not logging finally if added
Try...catch demo not logging finally if throwing
Jan 17, 2025
MDN URL
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch
What specific section or headline is this issue about?
No response
What information was incorrect, unhelpful, or incomplete?
The demo if try...catch page is not completely working.
I changed the demo code like:
Then clicked the button "Run".
Because of
throw error
in thecatch
block, theconsole.log
in thefinally
block is not printed inside the box just below.What did you expect to see?
I'd expect to see that the log "Finally" is printed in the box at bottom of the demo
Do you have any supporting links, references, or citations?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch#try_it
Do you have anything more you want to share?
No response
MDN metadata
Page report details
en-us/web/javascript/reference/statements/try...catch
The text was updated successfully, but these errors were encountered: