Debugging DirectX calls that fail is a pain as the debugger cannot show the "nice" HRESULT codes as it does for COM errors (such as E_NOTIMPL). However you can tell the debugger about the custom error codes and add them to the [hresult] section of autoexp.dat. I went through the pain of hand calculating the (decimal!) values of these for the DX errors, so you don't have to. Here are the DX errors, remember to add them to the [hresult] section:
This will work on Visual Studio 2005 for sure and 2003 probably - I can't remember when I added this feature. I would like to include a link to some documentation on this feature, but MSDN search sucks and I can't find it. It's there somewhere I am sure.