I have read in a few places that raising exceptions can be expensive. I have an exception that I expect to occur with some frequency and I will catch it each time. This may be a naive question (like many, I'm late to the exception game):
can I create a static global instance of my exception and throw
it when it does arise (only from one method), catching it each time?
Will this even save me any time? Or since I expect to throw with some frequency, will only throw this exception from this one method (at the moment), and will always catch this exception, is this a sign that I should be using some other paradigm for handling this situation?
Thanks for any helpful answers!
Aucun commentaire:
Enregistrer un commentaire