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 IXSLTemplate supports IErrorInfo (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:)
CComPtr<IErrorInfo> error;
if (SUCCEEDED( GetErrorInfo(0, &error) ) && error)
{
// call IErrorInfo::GetDescription(), etc.
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With