I got some strange situation at first. I got a default custom error message when calling search in SharePoint 2010. I first changed the <customError mode=”Off”> tag in the web.config of the current web application. However that didn’t change anything.
I noticed that the page that showed the error was <website URL>/_layouts/, so I checked the <14-hive>\TEMPLATE\LAYOUTS\, and there it was, a web.config. I contained the line:
<customErrors mode="On" />
So I changed it to “Off”, and worked as expected.