Do I have to make an exception for all the blocks?

Asked 2 years ago, Updated 2 years ago, 124 views

In the case of reducing the exception, it is safe to deal with exceptions. Then should I make an exception by using all those blocks as a try-catch? Doesn't that make the code too messy?

c++ exception exception-handling try-catch

2022-09-22 14:43

1 Answers

You do not need to make an exception for all blocks.

The method should only be caught when the exception can be handled properly. Exceptions that cannot be processed in the current method go up in the call stack and look for a method to handle them.

If you do this, the top level of the call stack logs unexpected errors You do not need to make an exception for all blocks.


2022-09-22 14:43

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.