Skip to content

Commit a440eda

Browse files
committed
Merge #23: Tell std::system_error() which function failed
d6dac63 Tell std::system_error() which function failed (Vasil Dimov) Pull request description: This would make the error messages a bit more descriptive. For example: `ex.what()` could be `Invalid argument` before this patch and `socketpair: Invalid argument` after this patch. Top commit has no ACKs. Tree-SHA512: 95870919c6a0fe2181658a9949ec85bf929aae15f272ebc1f6aca0ccc8fc8f9cc8b5b4023e7dcc6b47aa60331d2603479f6dfb5ae4ac17258d99e90b32353e79
2 parents 49a9637 + d6dac63 commit a440eda

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/mp/util.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ int SpawnProcess(int& pid, FdToArgsFn&& fd_to_args)
9999
{
100100
int fds[2];
101101
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) != 0) {
102-
throw std::system_error(errno, std::system_category());
102+
throw std::system_error(errno, std::system_category(), "socketpair");
103103
}
104104

105105
pid = fork();
106106
if (pid == -1) {
107107
throw std::system_error(errno, std::system_category(), "fork");
108108
}
109109
if (close(fds[pid ? 0 : 1]) != 0) {
110-
throw std::system_error(errno, std::system_category());
110+
throw std::system_error(errno, std::system_category(), "close");
111111
}
112112
if (!pid) {
113113
int maxFd = MaxFd();
@@ -138,7 +138,7 @@ int WaitProcess(int pid)
138138
{
139139
int status;
140140
if (::waitpid(pid, &status, 0 /* options */) != pid) {
141-
throw std::system_error(errno, std::system_category());
141+
throw std::system_error(errno, std::system_category(), "waitpid");
142142
}
143143
return status;
144144
}

0 commit comments

Comments
 (0)