Open mtangoo opened 9 years ago
You already have a class wxDatabaseErrorReporter that more or less does what you describe. My suggestion would be to rename wxDatabaseErrorReporter::ThrowDatabaseException to something like wxDatabaseErrorReporter::LogError and call wxLogError by default or maybe throw an exception within #ifdef #else #endif. Could also rename wxDatabaseErrorReporter! Also, should we complete the map for each wxXYZDatabase::TranslateErrorCode(int nCode) method or continue to pass through the native error codes?
You already have a class wxDatabaseErrorReporter that more or less does what you describe. My suggestion would be to rename wxDatabaseErrorReporter::ThrowDatabaseException to something like wxDatabaseErrorReporter::LogError and call wxLogError by default or
Yeah, above suggestion is an abstract. We can reuse the wxDatabaseErrorReporter and just rename it. I have no problem with that. My concern is, user must have a way to know what error happened (code) and the message. So my question was how do we provide for this?
wxLog is okay but then when user want to do something with error (like tell user that libpq.so is missing) is forced to use logging. Some people don't use logging so they will have problem here.
maybe throw an exception within #ifdef #else #endif.
We should avoid having exceptions thrown at all ;)
Could also rename wxDatabaseErrorReporter! Also, should we complete the map for each wxXYZDatabase::TranslateErrorCode(int nCode) method or continue to pass through the native error codes?
I want to hear your opinions on that.
@patlkli what do you think?
In wxWidgets coding guidelines exceptions are discouraged. This ticket aim at removing all exceptions in the library.
The idea I have is to have a class similar to QT SQLError. For function that can return bool (like Commit) will do so and for the rest, checking the error it will be something like
What do you think @patlkli @manyleaves and whoever reads this ;) ?