I've looked into this quite extensively and I've found the following:
- You can do some clever stuff to catch most errors by implementing a base class, see Andreas Knudsen's solution for this.
- The Error event in UserControl never gets fired, see details here: http://weblogs.asp.net/vga/archive/2003/06/16/8748.aspx
What I can't find is any general way to catch errors occurring in postback events, such as the click event for a button, at the web part or user control level. What I mean by general is a something I can implement in a baseclass.
I'm aware the I should do proper try/catch in my code, but for large teams I'd like to be sure that a web part never crashes the page, but always shows a nice message and allows execution to continue for the other web parts on the page.
I don't think it's possible but I'd love to be proved wrong.
Thanks, Bjoern