DEV Community

Discussion on: Custom exceptions with JS

Collapse
 
renatoruk profile image
Renato Ruk

Can you explain this in more detail? I guess throwing a lot of exceptions frequently may introduce performance issues, but not sure why. Is it because of the stack tracing?

Collapse
 
damxipo profile image
Damian Cipolat

Maybe the problem Is hoy don't catch the exceptoins very well.Seriously, it's the 1st time I've heard that throwing exceptions loses Performance. but I want to see how you base it, I don't say no but I am working like this on a project and we didn't lose performance

Collapse
 
danielpdev profile image
danielpdev

Yes, you are right. It's because of the stack tracing. As it needs to build your stack trace and it walks through the call stack to collect all required information like method names, line numbers etc.