COM-Interop: How to pass on / throw exceptions?

  • Thread starter Thread starter Olaf Rabbachin
  • Start date Start date
O

Olaf Rabbachin

Hi folks,

I have a (VB.Net-) DLL that I'm using from MS Access 2003.
Everything's pretty fine except for one thing - When I throw or pass on
exceptions from within the .Net-DLL, all I get is Err #440 ("Automation
Error").

I'm passing on exceptions like this:
Throw ex
.... and I'm throwing my own exceptions like this:
Throw New ExternalException("Oops", [some enum])

Is there something wrong with that, or why do I only get #440 in VBA ..?

Also, the GetLastError-API doesn't return anything either, that is, I'll
always get #0 (= everything alright).

Cheers,
Olaf
 
Hi,

Olaf said:
I have a (VB.Net-) DLL that I'm using from MS Access 2003.
Everything's pretty fine except for one thing - When I throw or pass on
exceptions from within the .Net-DLL, all I get is Err #440 ("Automation
Error").

I'm passing on exceptions like this:
Throw ex
... and I'm throwing my own exceptions like this:
Throw New ExternalException("Oops", [some enum])

Is there something wrong with that, or why do I only get #440 in VBA ..?

Also, the GetLastError-API doesn't return anything either, that is, I'll
always get #0 (= everything alright).

sniff, no insights, anybody ..?

Cheers,
Olaf
 
Olaf Rabbachin said:
Hi,

Olaf said:
I have a (VB.Net-) DLL that I'm using from MS Access 2003.
Everything's pretty fine except for one thing - When I throw or
pass on exceptions from within the .Net-DLL, all I get is Err #440
("Automation Error").

I'm passing on exceptions like this:
Throw ex
... and I'm throwing my own exceptions like this:
Throw New ExternalException("Oops", [some enum])

Is there something wrong with that, or why do I only get #440 in
VBA ..?

Also, the GetLastError-API doesn't return anything either, that
is, I'll always get #0 (= everything alright).

sniff, no insights, anybody ..?

Hi, me again ;-) Maybe you can try in the m.p.d.framework.interop group.


Armin
 
Olaf Rabbachin wrote:
sniff, no insights, anybody ..?

=))))

I've been to a couple of sites researching your question in the last
few days, but something or other interrupted me before I had a
definitive answer. I suggest you don't reliquish the faith... ;-)

Regards,

Branco,
 
Hi Branco,

Branco said:
=))))

I've been to a couple of sites researching your question in the last
few days, but something or other interrupted me before I had a
definitive answer. I suggest you don't reliquish the faith... ;-)

thanks for your efforts. And no, I won't loose faith. Actually I worked
around this by using my own properties that will be queried from my VBA-app
when an exception is thrown. It's just that I consider the approach to be
very bad design and I don't see why this shouldn't work as expected in the
first place. :-)
Also, I opened another thread in a german NG where Armin also tries to
help. Just thought there should really be other people with the same
problem ...

Cheers,
Olaf
 
Back
Top