r/learnjavascript • • Dec 19 '21

Help with Error Handling and Try/Catch

How do you fire a specific function based on the error received from a try block?

I am working through the javascript track on exercism and am having trouble with the third part of the Factory Sensors problem. Any help would be greatly appreciated.

5 Upvotes

3 comments sorted by

View all comments

Show parent comment

2

u/Notimecelduv Dec 19 '21

That might depend on your previous code but if the try-block doesn't throw an error, then the function will return whatever the try-block returns and the catch-block will not be used.