Overview
Features
Download
Documentation
Community
Add-Ons & Services

Shouldn't Poco::Exception::what() return the full message?

Discussion of ideas for features and new projects based on POCO.

Shouldn't Poco::Exception::what() return the full message?

Postby francisr » 28 Jan 2011, 11:10

I'm wondering if would be better to have Poco::Exception::what() return the full display message instead of only the exception name. There can be situations where the error handling code does not support Poco and can only catch standard exceptions.
francisr
 
Posts: 21
Joined: 09 Dec 2007, 13:19

Re: Shouldn't Poco::Exception::what() return the full messag

Postby guenter » 28 Jan 2011, 11:23

This can't be implemented in an efficient way (the complete message would have to be stored in the exception object) as what() returns const char*, so the complete message must be buffered somewhere. Also, allocating memory in what() is out of question since what is nothrow.
guenter
 
Posts: 1129
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Shouldn't Poco::Exception::what() return the full messag

Postby marlowabnp » 27 Aug 2011, 13:22

I agree with the OP. I think that what() should return the details of what went wrong. I realise that this means exception objects carry some weight but I do not see any alternative. I only just discovered that poco exceptions work this way. I am shocked. I know the theory about wanting to avoid heap allocation when we already know things are going wrong but maybe there is another way around this. What if the exception only stored the first 100 chars of the error? Then Poco::Exception could have a char array and avoid heap store allocation.

Regards,

Andrew Marlow
marlowabnp
 
Posts: 89
Joined: 08 Nov 2010, 17:29


Return to Wishlist

Who is online

Users browsing this forum: No registered users and 1 guest