XMLNotepad provides the following text (for example) when a transform fails:
Error Transforming XML
The variable or parameter ‘saturated-background-color’ was duplicated with the same import precedence.
How would I go about getting this error text programmatically? My code looks like this:
CComPtr<IXSLTemplate> tmpl; HRESULT hr = CoCreateInstance(CLSID_XSLTemplate, NULL, CLSCTX_INPROC_SERVER, IID_IXSLTemplate, (void**)&tmpl); if (SUCCEEDED(hr)) { hr = tmpl->putref_stylesheet(xslt_doc); if (SUCCEEDED(hr)) { // Huzzah; do stuff. } else { // How do I get the error text? I want to log it! } }
If
IXSLTemplatesupportsIErrorInfo(AFAIK, it does), then you can query that for additional information.(jeffamaphone clued me in on the proper way to get this – using the
GetErrorInfo()API:)