mirror of
https://github.com/NixOS/nix
synced 2025-06-27 16:51:15 +02:00
Adjust FileTransferError message to use opt response
This commit is contained in:
parent
004570a377
commit
74b219ef6e
3 changed files with 17 additions and 5 deletions
|
@ -834,6 +834,18 @@ void FileTransfer::download(FileTransferRequest && request, Sink & sink)
|
|||
}
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
FileTransferError::FileTransferError(FileTransfer::Error error, std::shared_ptr<string> response, const Args & ... args)
|
||||
: Error(args...), error(error), response(response)
|
||||
{
|
||||
const auto hf = hintfmt(args...);
|
||||
if (response) {
|
||||
err.hint = hintfmt("%1%\n\nresponse body:\n\n%2%", normaltxt(hf.str()), response);
|
||||
} else {
|
||||
err.hint = hf;
|
||||
}
|
||||
}
|
||||
|
||||
bool isUri(const string & s)
|
||||
{
|
||||
if (s.compare(0, 8, "channel:") == 0) return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue