Debug Tip for SharePoint Web Parts
To obtain the complete call stack instead of the default error page, you can alter the web.config file: set the ClassStack value to true in the SharePoint section:
<SafeMode MaxControls="50" CallStack="true"/>
Additionally make sure the CustomeErrors mode value (in the system.web section) is set to “off”:
<customErrors mode=”Off”>
More info, tips and tricks in following article: Debugging Web Parts.