Some notational convenience for formatting strings
We can now write
throw Error("file '%s' not found", path);
instead of
throw Error(format("file '%s' not found") % path);
and similarly
printError("file '%s' not found", path);
instead of
printMsg(lvlError, format("file '%s' not found") % path);
This commit is contained in:
parent
3f8e620b19
commit
4036185cb4
6 changed files with 81 additions and 22 deletions
|
|
@ -3768,7 +3768,7 @@ void LocalStore::buildPaths(const PathSet & drvPaths, BuildMode buildMode)
|
|||
}
|
||||
|
||||
if (!failed.empty())
|
||||
throw Error(format("build of %1% failed") % showPaths(failed), worker.exitStatus());
|
||||
throw Error(worker.exitStatus(), "build of %s failed",showPaths(failed));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -3804,7 +3804,7 @@ void LocalStore::ensurePath(const Path & path)
|
|||
worker.run(goals);
|
||||
|
||||
if (goal->getExitCode() != Goal::ecSuccess)
|
||||
throw Error(format("path ‘%1%’ does not exist and cannot be created") % path, worker.exitStatus());
|
||||
throw Error(worker.exitStatus(), "path ‘%s’ does not exist and cannot be created", path);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -3825,7 +3825,7 @@ void LocalStore::repairPath(const Path & path)
|
|||
goals.insert(worker.makeDerivationGoal(deriver, StringSet(), bmRepair));
|
||||
worker.run(goals);
|
||||
} else
|
||||
throw Error(format("cannot repair path ‘%1%’") % path, worker.exitStatus());
|
||||
throw Error(worker.exitStatus(), "cannot repair path ‘%s’", path);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -564,7 +564,7 @@ void RemoteStore::Connection::processStderr(Sink * sink, Source * source)
|
|||
if (msg == STDERR_ERROR) {
|
||||
string error = readString(from);
|
||||
unsigned int status = readInt(from);
|
||||
throw Error(format("%1%") % error, status);
|
||||
throw Error(status, error);
|
||||
}
|
||||
else if (msg != STDERR_LAST)
|
||||
throw Error("protocol error processing standard error");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue