I’ve found an odd behaviour, don’t know if it’s a bug or (probably) an error in my code… anyway, here’s the scenario
Have this code in a thread
Try
Self.webDB.ExecuteSQL("a-wrong-query")
Catch err As DatabaseException
System.DebugLog "Error"
Self.errors.Add err.ErrorNumber.ToString + ": " + err.Message
End Try
Running the thread in debug i see it catching the Exception correctly, however i cannot find any output in the log nor in the errors array (it’s always -1).
webDB is a subclass of MySQLCommunityServer with a custom ExecuteSQL method that is coded like this:
Try
Super.ExecuteSQL(sqlString)
Catch err As DatabaseException
If err.ErrorNumber = 2006 Or err.ErrorNumber = 2013 Then
If Me.connect = False Then Return
Super.ExecuteSQL(sqlString)
End If
End Try
Kem, yes i set a breakpoing both in System.debugLog and Self.errors.Add line but it never gets reached.
Sascha, i just keep a list of all the errors i get, so i can look after them, in the actual code is a littel more descriptive, i omitted here as it just some informations useful to me
Thank you Sascha! I’ve modified my custom class ExecuteSQL method like this
Try
Super.ExecuteSQL(sqlString)
Catch err As DatabaseException
If err.ErrorNumber = 2006 Or err.ErrorNumber = 2013 Then
If Me.connect = False Then Return
Super.ExecuteSQL(sqlString)
Else
Raise New DatabaseException
End If
End Try
And now it correctly stops at the breack point, writes the log and add the entry to the array.
I’ve learned something new today