Loading...
Loading...
Error
Oops! Something went wrong
4. JavaScript Custom Error Classes - When Why How
Speed
Speed
Quality
Quality
Captions
Captions
media loading
Play
Pause
10
Seek backward
Rewind 10s
Play
Pause
Play
Play
Pause
Pause
20
Seek forward
Forward 20s
Mute
Unmute
Volume High
Volume Low
Volume Low
Mute
Mute
Unmute
0:00
0:00
Start casting
Stop casting
Chapters
Chapters
Introduction to Custom Error Types
00:00
Scenario: Payment Error Example
00:20
Creating a Custom Payment Error Class
00:35
Constructor and Naming Conventions
00:49
Importance of 'name' Property
01:23
Simulating Payment Function with Error
01:41
Successful Payment Scenario
02:12
Basic Try-Catch for Payment Errors
02:26
Improving Error Handling
02:45
Introducing Error Codes
03:03
Implementing Error Codes in Constructor
03:54
Assigning Specific Error Codes
04:13
Handling Different Error Codes with Conditionals
04:41
Distinguishing Developer vs. User Messages
05:17
User-Friendly Messages
05:24
Adding a 'userMessage' Property
06:02
Mapping Error Codes to User Messages
06:11
Setting User Message Logic
06:40
Displaying User-Friendly Messages
06:49
Demonstrating User and Developer Messages
07:05
Handling Non-Custom Errors
07:43
The Problem with Built-in Errors
07:55
Using 'instanceof' for Error Type Checking
08:22
Conditional Error Handling for Different Types
08:36
Conclusion: Benefits of Custom Errors
09:02
Enable captions
Disable captions
Enable Captions
Enable captions
Disable Captions
Disable captions
Settings
Settings
Settings
Enter fullscreen mode
Exit fullscreen mode
Fullscreen
Enter fullscreen
Exit Fullscreen
Exit fullscreen