# Handling Errors with try, catch and finally

try runs code that might fail, catch takes over when it does and gets an error object with a name and a message, and finally runs either way, so one bad value doesn't stop your whole program.

![Cheat sheet: Handling Errors with try, catch and finally](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/10/524d47fb7a4540978a6ebb9676b1269b.webp)

- Category: JavaScript
- Level: Apprentice
- Tags: catch Block (javascript), Error, finally Block (javascript), JavaScript, Runtime Error (javascript), software-development, Stack Trace (javascript), try Block (javascript)
- Updated: November 1, 2026

Source: https://www.ask-codey.com/cheat-sheets/javascript-errors-try-catch-finally-cheat-sheet
