-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sqlite error log? #109
Comments
@bstarynk I think we should somehow use our A simple solution may be: sqlite::error_log([](sqlite_exception e) {
cerr << e.get_code() << ": " << e.what() << " during "
<< e.get_sql() << endl; // Now we also have .get_sql() :-)
}); I am also wondering how can we efficiently overload that function on exceptions from sqlite::error_log([](sqlite::exceptions::internal e) { });
sqlite::error_log([](sqlite::exceptions::full e) { });
// ... |
I think it would be easier to specify all overloads in a sigle call, like sqlite::error_log(
[](sqlite::exceptions::internal e) {
// Do sth.
}),
[](sqlite::exceptions::full e) {
// Do sth.
}),
...
); Otherwise we would need some kind of runtime list for this. This can easily be implemented on top of the basic functionality. Anyway |
I am not sure to follow you. It looks you think of C++ exceptions. |
sqlite::error_log([&](int errcode, const char*msg) {
std::clog<<"SQLITE ERROR " << errcode << ":" << msg << std:endl;
}); With this interface we need to check errorcode to determine the type of an error / exception. For each sqlite error message we have a corresponding class in In addition to sqlite exceptions we also have some exceptions for invalid use of the library like So my suggestion is to pass the exception object itself to the new |
@bryant1410 also take a look at @zauguin implementation #110 |
It would be nice to be able to interface with sqlite3_config for error logging with SQLITE_CONFIG_LOG.
Perhaps we would want to be able to code
What do you think?
I might provide a small patch if we agree on that API.
Thanks.
Basile Starynkevitch :
basile
atstarynkevitch
dotnet
(France)
The text was updated successfully, but these errors were encountered: