So I am working on exception handling and I used a try-catch to solve an issue with converting strings to integers. The project runs fine, but if I look in the output window, multiple messages like this one show up:
Exception thrown at 0x00007FFB7ACE3B29 in CPP-eindopdracht.exe: Microsoft C++ exception: std::invalid_argument at memory location 0x0000006DF9B3ECC0.
Does that mean my exception handling isn't working properly or is this always what the output window of VS2019 shows you anyway?
Thanks.
Edit:
Here is where the exception thrown message is generated when debugging:
bool Interpreter::tryConvertToInt(std::string convertible, int& value)
{
try
{
value = std::stoi(convertible); // Also accepts "123abc" as a valid conversion. No problem for now but keep in mind.
return true;
}
catch (...)
{
//std::cout << "Conversion from " << convertible << " to integer is not possible..." << std::endl;
return false;
}
}
However, as you can see I'm dealing with the exception, so I don't understand why the message is being shown in the output tab.
Your exception handling is working properly. From my tests, it looks like the Debug Output window in Visual Studio always shows the exceptions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With