Feature #5116
closedWEnvironment.C:536 exception
0%
Description
WEnvironment.C says:
const std::string WEnvironment::getCookie(const std::string& cookieName) const
{
CookieMap::const_iterator i = cookies_.find(cookieName);
if (i == cookies_.end())
throw std::runtime_error("Missing cookie: " + cookieName);
else
return i->second;
}
https://github.com/kdeforche/wt/blob/master/src/Wt/WEnvironment.C
Is it possible to cut out this exception (maybe change the signature to return bool), as using exceptions is a bad practice?
It also causes solid hangs in debug mode on windows environment just as any other exception.
Best wishes.
Updated by Vasily Pupkin over 8 years ago
I am sorry, is this description clear enough?
Wt uses that getCookie method for internal matters, so this exception happens and gets handled. But it reduces perfomance and annoys while debugging.
Updated by Koen Deforche over 8 years ago
- Target version set to 4.0.0
I agree, we should remove this in Wt4 as it is a breaking API change.
Updated by Roel Standaert over 7 years ago
getCookieValue does the same thing, but returns a null pointer when the value is missing instead. I'll make Wt use getCookieValue internally (this seems to only affect WebSession.C).
Updated by Roel Standaert over 7 years ago
- Status changed from New to Implemented @Emweb
In Wt 4, getCookieValue was renamed to getCookie, and the original getCookie implementation (which can throw) was removed.
Updated by Roel Standaert over 7 years ago
- Status changed from Implemented @Emweb to Resolved
Updated by Roel Standaert over 7 years ago
- Status changed from Resolved to Closed