local sync: better error reporting when child finds problem

The parent always reported a "remote transport error" when the child
didn't finish as expected. In cases where we know what the problem
was, because the child sent a report, using that status also on the
server side gives more useful information to the user.

For example, the overall sync status is now "unexpected slow sync
(local, status 22000)" after an unexpected slow sync instead of
logging a transport error there.
This commit is contained in:
Patrick Ohly 2012-01-20 18:15:05 +01:00
parent fce458b52e
commit 1fa8a5d94e
1 changed files with 10 additions and 2 deletions

View File

@ -372,8 +372,16 @@ TransportAgent::Status LocalTransportAgent::wait(bool noReply)
if (m_forkexec &&
m_forkexec->getState() == ForkExecParent::TERMINATED) {
m_status = FAILED;
SE_THROW_EXCEPTION(TransportException,
"child process quit without sending its message");
if (m_clientReport.getStatus() != STATUS_OK &&
m_clientReport.getStatus() != STATUS_HTTP_OK) {
// report that status
SE_THROW_EXCEPTION_STATUS(StatusException,
"failure in local sync child",
m_clientReport.getStatus());
} else {
SE_THROW_EXCEPTION(TransportException,
"child process quit without sending its message");
}
}
g_main_loop_run(m_loop.get());
}