Unable to handle Exception in Toolbar's OnError Event

Add-in Express™ Support Service
That's what is more important than anything else

Unable to handle Exception in Toolbar's OnError Event
General error handling technique for unhandled exceptions 
Hernan




Posts: 37
Joined: 2011-01-28
Hi,

I'm developing a general error handling strategy for my project.

I found that when an exception comes is triggered, say, from a context menu option they can be handled in the Module's OnError event, but when they come triggered from, say, a Button in the toolbar i can't handle them neither in the Module's nor the Toolbar's OnError Events.

Is there another way to handle them and so avoid exposing the user to the error dialog IE presents?

Also, what would you recommend for general error handling in IE AddOns?

Thank you
Posted 11 May, 2011 10:49:47 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Hernan,

I would recommend using 'try ... catch' statement to handle exeptions which come from the custom code.

If any exceptions occur in Add-in Express code (like events of Add-in Express menus), they are processed by our code and you can catch them in the OnError event handler.
Posted 11 May, 2011 11:25:33 Top
Hernan




Posts: 37
Joined: 2011-01-28
Sergey,

Thanks for the help provided.

What i'd like is to avoid having one try/catch block in every event handler (buttons, etc) i write.

I was thinking about AppDomain.CurrentDomain.UnhandledException or Application.ThreadException to handle them, but some exceptions reach IE directly.

Can you tell me if this approach if fine? What would you recommend besides your first option?

Thanks again,
Posted 19 May, 2011 11:50:22 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Hernan,

I can't recommend you anything else. Try ... Catch is the most reliable way to catch all exceptions.
Posted 20 May, 2011 08:16:18 Top