# Errors in JavaScript

Errors in JavaScript: Handling Errors with try, catch and finally, Throwing Your Own Errors.

Updated: November 14, 2026

1. [Handling Errors with try, catch and finally](https://www.ask-codey.com/lessons/javascript-errors-try-catch-finally) (Apprentice): 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.
2. [Throwing Your Own Errors](https://www.ask-codey.com/lessons/javascript-errors-throwing-your-own) (Journeyman): When a function gets a value it can't use, throw new Error with a message that says what was wrong, make your own error class with extends Error for the problems your program knows about, and return a value instead when there's no mistake to report.

Source: https://www.ask-codey.com/courses/javascript-in-depth/topics/javascript-errors
