Skip to content

Commit d770988

Browse files
committed
Improve error messages for detectMsvcPrefix().
1 parent 7aafa03 commit d770988

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/sw/builder/command.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,14 +1313,19 @@ String detectMsvcPrefix(builder::detail::ResolvableCommand c, const path &idir)
13131313
fs::remove(obj);
13141314
fs::remove(fn);
13151315

1316+
auto error = [&c](const String &reason)
1317+
{
1318+
return "Cannot match VS include prefix (" + reason + "):\n" + c.out.text + "\nstderr:\n" + c.err.text;
1319+
};
1320+
13161321
auto lines = split_lines(c.out.text);
13171322
if (lines.size() < 2)
1318-
throw SW_RUNTIME_ERROR("Cannot match vs include prefix (bad output)");
1323+
throw SW_RUNTIME_ERROR(error("bad output"));
13191324

13201325
static std::regex r(R"((.*\s)[a-zA-Z]:\\.*iostream)");
13211326
std::smatch m;
13221327
if (!std::regex_search(lines[1], m, r))
1323-
throw SW_RUNTIME_ERROR("Cannot match vs include prefix");
1328+
throw SW_RUNTIME_ERROR(error("regex_search failed"));
13241329
return p[c.getProgram()] = m[1].str();
13251330
}
13261331

0 commit comments

Comments
 (0)