[Qt-interest] Qt and exceptions
Stephan Rose
kermos at somrek.net
Thu Dec 11 02:50:01 CET 2008
On Thu, 2008-12-11 at 02:34 +0100, Jesús Fernández wrote:
> And what about "emitting" a signal if an error occours
>
> You can have connected the signal to a slot that shows a QMessageBox
Well the reason I haven't gone that route is that I need to guarantee
that code execution stops at the point where the exception was
generated. That's why I'm using exceptions in the first place.
Now I suppose since it's on the same thread, the signal will be executed
instantly. However, I still need to ensure that after the emit returns
no further code is executed.
Reason for all this is that not all database operations done by the app
are atomic. Few, but some, require multiple SQL calls to the database.
If any one of the calls fails all following steps may be in an undefined
state.
Eventually I'm going to move the app to a client / server model where it
just sends a request to a server, server performs the necessary database
actions and error checking and returns a result to the app making it
completely atomic on the application end. That would completely
alleviate the problem. Unfortunately there are only X number of hours in
a week and I need to occasionally sleep so I currently don't have the
time to implement that.
Thanks,
Stephan
More information about the Qt-interest-old
mailing list