SharePoint 2007 displays a nice "friendly" error message when anything goes wrong. This "friendly" error message usually provides no useful information about why the error has occurred (sometimes you get an HRESULT). It may be friendly but isn't usually very helpful, not for a developer.
You can alter this default behaviour by making two changes to the web.config for the site you are debugging.
CallStack is set to false. Change the CallStack setting to true, as shown below -
<SafeMode MaxControls="200" CallStack="true" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">
customErrors mode is set to On. Change the mode to Off, as shown below -
<customErrors mode="Off" />
Hey presto, helpful error messages. Now if I could only fix the error... ;-)