Learn JavaScript

Lesson 6 of 9 ¡ Error Handling: throw, try, catch, finally, and Reading a Stack Trace

Module 10 ¡ Error Handling: throw, try, catch, finally, and Reading a Stack Trace

The Errors Pack: Contest Patterns, Six Interview Questions and a Bug Gallery

ProReading

Rafi has a frontend interview on Thursday. His friend passed last month and says the error questions are always the same. "What does finally do with a return?" "Can try catch an error from a setTimeout?" "What is an error-first callback?" He also says the take-home task had a log file full of stack traces. The fast candidates were the ones who read the traces as data.

Checking what this lesson needs for youâ€Ļ

What is inside The Errors Pack: Contest Patterns, Six Interview Questions and a Bug Gallery

  1. Pattern 1: validate, count, and keep going
  2. Pattern 2: walk a cause chain once
  3. Pattern 3: a stack trace is text you can parse
  4. Interview question 1: what does finally do with a return?
  5. Interview question 2: can try catch a throw from a callback, and from a promise?
  6. Interview question 3: what is the error-first callback convention?
  7. Interview question 4: here is a stack trace. Where is the bug?
  8. Interview question 5: why should a custom error extend Error?
  9. Interview question 6: what do you do with an error you cannot recover from?