

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: Error Handling in TypeScript
incomplete
2: Bugs vs. Errors
incomplete
3: Async/Await Makes Error Handling Easier
incomplete
This lesson's interactive features are locked, please to keep using them
Click to play video
Error handling via try/catch is not the same as debugging. Likewise, errors are not the same as bugs.
"Debugging" a program is the process of going through your code to find where it is not behaving as expected. Debugging is a manual process performed by the developer. Sometimes developers use special software called a "debugger" to help them find bugs, but often they just use console.log() statements to figure out what's going on.
Examples of debugging:
"Error handling" is code that can handle expected edge cases in your program. Error handling is an automated process that we design into our production code to protect it from things like weak internet connections, bad user input, or bugs in other people's code that we have to interface with.
Examples of error handling:
If your code has a bug, try/catch won't help you. You need to just go find the bug and fix it.
If something out of your control can produce issues in your code, you should use try/catch or other error-handling logic to deal with it.
For example, there could be a prompt in Jello for users to type in a new character name, but we don't want them to use punctuation. Validating their input and displaying an error message if something is wrong with it would be a form of "error handling".