When Things Go Wrong: Errors and Debugging

Stephen Gruppetta 21 Lessons 6h 31m Updated intermediate js

Ruth Abebe keeps the Hilltop Running Club’s records. Members message her their runs, and a few arrive wrong: a missing distance, a date written month first, or minutes typed as a word. Last time, one bad record stopped her whole season log. In this course, you’ll build her a season log that reports each bad run, skips it, and still prints every runner’s totals.

An error isn’t damage. It’s information about what went wrong, where, and which calls led there. Once you can read it, you can decide where a failure should be handled. You’ll learn how to:

  • Read a stack trace to find where a failure starts
  • Catch only the errors your code can handle
  • Throw errors with useful messages, and catch them at the right level
  • Track down a wrong result with a method instead of guessing
  • Build Ruth’s season log, and explain how it works

Each of the first four sections mixes text lessons and short videos, and ends with an exercise you write in the browser, where automated tests check your code. You’ll run the lesson examples in your own terminal.

In the project, you build Ruth’s season log in Node. check.js throws an error that names each bad run and its problem, load.js catches those errors at the import step so one bad run is reported and skipped, and totals.js adds up each runner’s runs, kilometers, and minutes.

Along the way, you track down a bug that gives a wrong total without any error. Then you explain your season log to the AI mentor, make a change you haven’t seen before, and take a quiz.

This course is for programmers who have finished JavaScript Basics and can write small Node programs with functions, loops, arrays, and objects. The earlier intermediate courses on the path help, especially splitting a program into modules, loading JSON from a file, and following the call stack. You’ll need a current Node LTS, a terminal, and any editor.

What’s Included:

  • 21 Lessons
  • Video Subtitles and Full Transcripts
  • Translated Subtitles in 8 Languages
  • 2 Downloadable Resources
  • Interactive Quiz to Check Your Progress
  • 6 Hands-On Coding Exercises
  • Q&A With JavaScript Experts: Ask a Question
  • Certificate of Completion

Downloadable Resources:

Related Learning Paths:

About Stephen Gruppetta

Stephen obtained a PhD in physics and worked as a physicist in academia for over a decade before becoming a programming educator. He's constantly looking for simple ways to explain complex things.

» More about Stephen

Each tutorial at RealJS is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

← Browse All Courses