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); Index: src/ch/ch.rc =================================================================== diff -u -N -rc9092a6f41bed1c132d5d5ddfe430e8b3ddd70ca -ref0341282095cec2957225e031580d0c0bbaa5f6 --- src/ch/ch.rc (.../ch.rc) (revision c9092a6f41bed1c132d5d5ddfe430e8b3ddd70ca) +++ src/ch/ch.rc (.../ch.rc) (revision ef0341282095cec2957225e031580d0c0bbaa5f6) @@ -1125,6 +1125,7 @@ IDS_SHELLEXT_VERSIONMISMATCH_SHOWHIDE_STRING "Show message about shell extension version mismatch" IDS_SHELLEXT_CHOOSE_DIR_STRING "Choose directory..." IDS_SHELLEXT_CHOOSE_DIR_TOOLTIP_STRING "Allows to choose the destination directory" + IDS_SHELLEXT_XML_IMPORT_FAILED "Encountered an error when communicating with CH Shell Extension.\nDetails:\n%err" END STRINGTABLE Index: src/ch/resource.h =================================================================== diff -u -N -rc9092a6f41bed1c132d5d5ddfe430e8b3ddd70ca -ref0341282095cec2957225e031580d0c0bbaa5f6 --- src/ch/resource.h (.../resource.h) (revision c9092a6f41bed1c132d5d5ddfe430e8b3ddd70ca) +++ src/ch/resource.h (.../resource.h) (revision ef0341282095cec2957225e031580d0c0bbaa5f6) @@ -390,6 +390,7 @@ #define IDS_DIALOGS_SHOW_HIDE_STRING 5040 #define IDS_SHELLEXT_REGISTER_SHOWHIDE_STRING 5041 #define IDS_SHELLEXT_VERSIONMISMATCH_SHOWHIDE_STRING 5042 +#define IDS_SHELLEXT_XML_IMPORT_FAILED 5043 #define IDS_ONECOPY_STRING 6000 #define IDS_REGISTEROK_STRING 6001 #define IDS_REGISTERERR_STRING 6002