
16 Aug
2010
16 Aug
'10
12:01 p.m.
exception are just here to gather and carry diagnostic info, not full fledged error message If you throw a bad_alloc, you don't need to add a full fledged error message, I agree that the localization and the exception type is sufficient. When you throw a logic_error, more the message is clear, precise and detailed better it is.
may fail to allocate the needed memory for the string and stream, thus maskign the initial exception with some bad_alloc. I agree for bad_alloc exception, but as before you don't really need a message in this particular case. If you throw a logic_error, you don't have more chance to encounter a bad_alloc than everywhere in your application.