This may be a debugger issue, but here goes:
I have this piece of code:
Private Function Connect() As Boolean
Try
sessionBegun = False
connectionOpen = False
rp = New RequestProcessor2()
rp.OpenConnection2("","EZSystem", QBXMLRPConnectionType.localQBD)
connectionOpen = True
ticket = rp.BeginSession("", QBFileMode.qbFileOpenDoNotCare)
sessionBegun = True
Return True
Catch e As COMException
exceptionHandler.HandleConnectionException(e)
**Throw New QuickBooksConnectionException(e.Message)**
End Try
End Function
My intention is to ‘convert’ the low level exception into something more meaningful, so I throw an exception of my own creation. I want this to bubble up to a place where I can handle it.
However what is happening is my debugger breaks and tells me that an exception of type “QuickBooksConnectionException” was thrown.
I know that, I just threw it, why are you catching it?
From what I’ve read, this ought to work, and there doesn’t appear to be an analogous Java throws keyword, so perhaps it is my debugger.
I am using SharpDevelop.
Thanks,
Dane
As written, your code throws an unhandled exception, which is always going to cause the debugger to balk. You just have to catch the QuickBooksConnectionException in the code that invokes this method. (And you’re right, there’s no equivalent in C# to the throws Java keyword.)