It's ugly, but it is reasonably informative (i.e. if you can distinguish between invalid query syntax, non-existent namespace (sort of like a database), non-existent class name (sort of like a table)). I could take the approach in ruby-wmi though which special-cased the exceptions and tried to make them a little more straightforward:

2014.05.15 Thu 16:10:12.89-07:00> bundle exec ruby C:\test\wmitest\wmilite.rb  --class 'Win32_Environment2'
C:/src/wmi-lite/lib/wmi-lite/wmi.rb:68:in `method_missing': (in OLE method `count': ) (WIN32OLERuntimeError)
    OLE error code:80041010 in SWbemObjectSet
      Invalid class
    HRESULT error code:0x80020009
      Exception occurred.
 
2014.05.15 Thu 16:12:10.96-07:00> bundle exec ruby C:\test\wmitest\wmilite.rb  --class 'Win32_Environment' --namespace 'fun2'
C:/src/wmi-lite/lib/wmi-lite/wmi.rb:75:in `method_missing': (in OLE method `ConnectServer': ) (WIN32OLERuntimeError)
    OLE error code:8004100E in SWbemLocator
      Invalid namespace
    HRESULT error code:0x80020009
      Exception occurred.

C:/src/wmi-lite/lib/wmi-lite/wmi.rb:68:in `method_missing': (in OLE method `count': ) (WIN32OLERuntimeError)
    OLE error code:80041017 in SWbemObjectSet
      Invalid query
    HRESULT error code:0x80020009
      Exception occurred.