I think just including the query and the namespace along with the error message back from windows would probably be good enough to give you a head start on debugging. Something like:

```
WMI query error:
  Query: select * from Win32_Environment
  Namespace: fun2
 Error:
    OLE error code:8004100E in SWbemLocator
      Invalid namespace
    HRESULT error code:0x80020009
      Exception occurred.
```