To get more detailed messages in MOSS 2007 and WSS3.0 during development process, user can enable debugging in the web.config file for the SharePoint web application:
<SafeMode
MaxControls="200"
CallStack="true"
DirectFileDependencies="10"
TotalFileDependencies="50"
AllowPageLevelTrace="false">
And:
<customErrors
mode="Off" />
This should make development process so much pleasant and more efficient, by getting rid of "An unexpected error has occurred" error, which is useless to the developers.
Note: It's not recommended to have debugging enabled on the production server, if possible, please do all your debugging on the development server(s)