DEV Community

Discussion on: Custom exceptions with JS

damxipo profile image
Damian Cipolat Author • Edited on

Well I'm using this way in a very massive production project and we don't lose Performance. Do you have a link that supports this or what you say or experience to tell?

danielpdev profile image

try-catch will impact your performance only if you actually throw exceptions.

  1. Performance loss when exception is thrown:
  2. No performance loss if no exception is thrown:

I'm not saying that you should not use try-catch at all, but like in the examples above actually throwing an exception can be easily avoided.

Thread Thread
damxipo profile image
Damian Cipolat Author

Nice, thanks for the links provides very useful information. I will be investigating about this.