using namespace std::string_literals;
try {
std::vector<std::string> options {"Max-Age"s, "9999999999"s};
cookie::Cookie c {"USER_TOKEN"s, "1mbda"s, options};
std::cout << c << std::endl;
}
catch (const cookie::CookieException& ce) {
std::cout << "bad cookie!" << std::endl;
}
// => terminating with uncaught exception of type std::out_of_range: stoi: out of range
When calling the Cookie constructor I would expect to get a valid
Cookie
or having aCookieException
thrown.This works:
This does not: