[platform] restarter: improving the ACP conversion error message (IJPL-156417)

GitOrigin-RevId: 67c8b9f3d6cdae73e113444dff78f8d471d98185
This commit is contained in:
Roman Shevchenko
2024-07-25 15:53:01 +02:00
committed by intellij-monorepo-bot
parent 6a9966fdda
commit a7c8c9eac1

View File

@@ -259,9 +259,12 @@ fn convert_vm_options(vm_options: Vec<String>) -> Result<Vec<CString>> {
let acp_len = unsafe {
WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, ucs_str.as_wide(), Some(&mut acp_bytes), PCSTR::null(), Some(&mut failed))
};
if acp_len == 0 || failed.as_bool() {
if acp_len == 0 {
bail!("Cannot convert VM option string '{}' to ANSI code page ({}): {}", opt, acp, std::io::Error::last_os_error());
}
if failed.as_bool() {
bail!("Cannot convert VM option string '{}' to ANSI code page ({})", opt, acp);
}
CString::new(acp_bytes)
}.with_context(|| format!("Invalid VM option string: '{}'", opt))?;
strings.push(str);