What is the way to proceed with exceptions? For in...
# core
d
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?
Copy code
E0719 02:38:39.292034 250400192 virtual_table.cpp:1006] Exception while executing table unified_log: stoi: no conversion
Error: stoi: no conversion
s
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.
d
Ok, thank you. I agree. That's a very cool helper btw