Index: src/ch/MainWnd.cpp =================================================================== diff -u -N -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 -ref0341282095cec2957225e031580d0c0bbaa5f6 --- src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) +++ src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision ef0341282095cec2957225e031580d0c0bbaa5f6) @@ -451,8 +451,36 @@ chcore::TString wstrData(pszBuffer); chcore::TTaskDefinition tTaskDefinition; - tTaskDefinition.LoadFromString(wstrData, true); + CString strError; + try + { + tTaskDefinition.LoadFromString(wstrData, true); + } + catch(const chcore::TCoreException& e) + { + strError.Format(_T("Error code: %ld"), e.GetErrorCode()); + } + catch(const std::exception& e) + { + strError.Format(_T("Error message: %s"), e.what()); + } + if(!strError.IsEmpty()) + { + ictranslate::CFormat fmt; + fmt.SetFormat(_T("Cannot import shell extension xml in WM_COPYDATA. Xml: '%xml'. Error: %err.")); + fmt.SetParam(_T("%xml"), wstrData.c_str()); + fmt.SetParam(_T("%err"), (PCTSTR)strError); + + LOG_ERROR(fmt); + + fmt.SetFormat(GetResManager().LoadString(IDS_SHELLEXT_XML_IMPORT_FAILED)); + fmt.SetParam(_T("%err"), (PCTSTR)strError); + AfxMessageBox(fmt, MB_OK | MB_ICONERROR); + + break; + } + // apply current options from global config; in the future we might want to merge the incoming options with global ones instead of overwriting... chcore::TConfig& rConfig = GetConfig(); rConfig.ExtractSubConfig(BRANCH_TASK_SETTINGS, tTaskDefinition.GetConfiguration()); @@ -559,7 +587,7 @@ ictranslate::CFormat fmt; fmt.SetFormat(_T("Error encountered while importing task from path '%path'. Error: %err.")); fmt.SetParam(_T("%path"), strPath.ToString()); - fmt.SetParam(_T("%error"), szBuffer.get()); + fmt.SetParam(_T("%err"), szBuffer.get()); LOG_ERROR(fmt);