If you are developing with WSS/MOSS, this is a known message. A lot of unexpected errors are displayed simply as “An unexpected error has occurred.”. Some of them you can debug in the sharepoint log files, some of them you can find details in the event log, and some… you can’t find anything… those are pure and simple desperation until you hit with your head enough times to almost develop a 6th sense; with this sense you start guessing where the problem comes from.
The biggest problem about this type of errors is that the debug process is VERY time consuming.
Well, today I came across a very smart approach for this problem. You just implement a HTTPModule that catches the exception prior to being treated by MOSS and logs it where ever you want.
This great approach was developed by Janne Mattila and you can find the full post here: http://blogs.msdn.com/jannemattila/archive/2008/02/04/catching-unhandled-exceptions-in-sharepoint.aspx