Eliminate last usage of Checks::check_throw()

This commit is contained in:
Robert Schumacher 2017-03-31 17:00:24 -07:00 committed by Alexander Karatarakis
parent a7c13ce724
commit c26e7c94c6

View File

@ -128,15 +128,14 @@ static void loadConfig()
auto user_id = keys["User-Id"]; auto user_id = keys["User-Id"];
auto user_time = keys["User-Since"]; auto user_time = keys["User-Since"];
Checks::check_throw(VCPKG_LINE_INFO, !user_id.empty() && !user_time.empty(), ""); // Use as goto to the catch statement if (!user_id.empty() && !user_time.empty())
{
SetUserInformation(user_id, user_time); SetUserInformation(user_id, user_time);
return; return;
}
} }
} }
catch (...) catch (...) { }
{
}
// config file not found, could not be read, or invalid // config file not found, could not be read, or invalid
std::string user_id, user_time; std::string user_id, user_time;
@ -150,9 +149,7 @@ static void loadConfig()
<< "User-Id: " << user_id << "\n" << "User-Id: " << user_id << "\n"
<< "User-Since: " << user_time << "\n"; << "User-Since: " << user_time << "\n";
} }
catch (...) catch (...) { }
{
}
} }
static std::string trim_path_from_command_line(const std::string& full_command_line) static std::string trim_path_from_command_line(const std::string& full_command_line)
@ -233,17 +230,17 @@ int wmain(const int argc, const wchar_t* const* const argv)
fflush(stdout); fflush(stdout);
System::print( System::print(
"vcpkg.exe has crashed.\n" "vcpkg.exe has crashed.\n"
"Please send an email to:\n" "Please send an email to:\n"
" %s\n" " %s\n"
"containing a brief summary of what you were trying to do and the following data blob:\n" "containing a brief summary of what you were trying to do and the following data blob:\n"
"\n" "\n"
"Version=%s\n" "Version=%s\n"
"EXCEPTION='%s'\n" "EXCEPTION='%s'\n"
"CMD=\n", "CMD=\n",
Commands::Contact::email(), Commands::Contact::email(),
Commands::Version::version(), Commands::Version::version(),
exc_msg); exc_msg);
fflush(stdout); fflush(stdout);
for (int x = 0; x < argc; ++x) for (int x = 0; x < argc; ++x)
System::println("%s|", Strings::utf16_to_utf8(argv[x])); System::println("%s|", Strings::utf16_to_utf8(argv[x]));