SyncSource: better error message for incomplete config

The file backend refuses to create a source if backendFormat is unset.
This was reported as "<source>: backend 'file' not supported",
which was confusing because the backend was in fact supported.

Now the error message is "<source>: backend 'file' not supported or
not fully configured (format '<format>')".
This commit is contained in:
Patrick Ohly 2011-04-19 13:56:02 +02:00
parent 22e5783822
commit 0574084362
1 changed files with 10 additions and 4 deletions

View File

@ -347,12 +347,18 @@ SyncSource *SyncSource::createSource(const SyncSourceParams &params, bool error,
}
if (error) {
string problem = params.m_name + ": backend '" + sourceType.m_backend + "' not supported";
string backends;
if (scannedModules.m_available.size()) {
problem += " by any of the backend modules (";
problem += boost::join(scannedModules.m_available, ", ");
problem += ")";
backends += "by any of the backend modules (";
backends += boost::join(scannedModules.m_available, ", ");
backends += ") ";
}
string problem =
StringPrintf("%s: backend '%s' not supported %sor not fully configured (format '%s')",
params.m_name.c_str(),
sourceType.m_backend.c_str(),
backends.c_str(),
sourceType.m_localFormat.c_str());
SyncContext::throwError(problem);
}