mirror of
https://github.com/NixOS/nix.git
synced 2025-11-16 23:42:43 +01:00
Properly separater builer failure content and presentation
Before, had a very ugly `appendLogTailErrorMsg` callback. Now, we instead have a `fixupBuilderFailureErrorMessage` that is just used by `DerivationBuildingGoal`, and `DerivationBuilder` just returns the raw data needed by this.
This commit is contained in:
parent
3e0b1705c1
commit
8825bfa7fe
4 changed files with 48 additions and 34 deletions
|
|
@ -534,26 +534,16 @@ SingleDrvOutputs DerivationBuilderImpl::unprepareBuild()
|
|||
/* Check the exit status. */
|
||||
if (!statusOk(status)) {
|
||||
|
||||
/* Check *before* cleaning up. */
|
||||
bool diskFull = decideWhetherDiskFull();
|
||||
|
||||
cleanupBuild(false);
|
||||
|
||||
auto msg =
|
||||
fmt("Cannot build '%s'.\n"
|
||||
"Reason: " ANSI_RED "builder %s" ANSI_NORMAL ".",
|
||||
Magenta(store.printStorePath(drvPath)),
|
||||
statusToString(status));
|
||||
|
||||
msg += showKnownOutputs(store, drv);
|
||||
|
||||
miscMethods->appendLogTailErrorMsg(msg);
|
||||
|
||||
if (diskFull)
|
||||
msg += "\nnote: build failure may have been caused by lack of free disk space";
|
||||
|
||||
throw BuildError(
|
||||
throw BuilderFailureError{
|
||||
!derivationType.isSandboxed() || diskFull ? BuildResult::TransientFailure : BuildResult::PermanentFailure,
|
||||
msg);
|
||||
status,
|
||||
diskFull ? "\nnote: build failure may have been caused by lack of free disk space" : "",
|
||||
};
|
||||
}
|
||||
|
||||
/* Compute the FS closure of the outputs and register them as
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue