Use heuristics to decide when to show the response
Due to https://github.com/NixOS/nix/issues/3841 we don't know how print different messages for different verbosity levels.
This commit is contained in:
parent
e3a3406db8
commit
0ca9744694
1 changed files with 5 additions and 2 deletions
|
@ -845,7 +845,10 @@ FileTransferError::FileTransferError(FileTransfer::Error error, std::shared_ptr<
|
|||
: Error(args...), error(error), response(response)
|
||||
{
|
||||
const auto hf = hintfmt(args...);
|
||||
if (response) {
|
||||
// FIXME: Due to https://github.com/NixOS/nix/issues/3841 we don't know how
|
||||
// to print different messages for different verbosity levels. For now
|
||||
// we add some heuristics for detecting when we want to show the response.
|
||||
if (response && (response->size() < 1024 || response->find("<html>") != string::npos)) {
|
||||
err.hint = hintfmt("%1%\n\nresponse body:\n\n%2%", normaltxt(hf.str()), *response);
|
||||
} else {
|
||||
err.hint = hf;
|
||||
|
|
Loading…
Reference in a new issue