Title
#core
Daniel Bretón Suárez

Daniel Bretón Suárez

07/19/2022, 9:44 AM
What is the way to proceed with exceptions? For instance, trying to convert a non-numerical string with
std::stoi
is caught at virtual_table, so I'm assuming I do not have to provide a try-catch block inside the table, I'm right?
E0719 02:38:39.292034 250400192 virtual_table.cpp:1006] Exception while executing table unified_log: stoi: no conversion
Error: stoi: no conversion
Stefano Bonicatti

Stefano Bonicatti

07/19/2022, 11:18 AM
That’s more of a band aid, which actually has some issues with sqlite. Tables should not really throw exceptions if possible (meaning, unless there’s really something out of your control, it would be better to avoid throwing them). That been said we have a helper named
tryTo<>
which does the number conversion and automatically try/catches the exception.
Daniel Bretón Suárez

Daniel Bretón Suárez

07/19/2022, 2:29 PM
Ok, thank you. I agree. That's a very cool helper btw