Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions src/libstore/build/substitution-goal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ void PathSubstitutionGoal::tryNext()
if (subs.size() == 0) {
/* None left. Terminate this goal and let someone else deal
with it. */
if (subError.has_value()) {
throw std::move(*subError);
}

/* Hack: don't indicate failure if there were no substituters.
In that case the calling derivation should just do a
Expand Down Expand Up @@ -111,19 +114,12 @@ void PathSubstitutionGoal::tryNext()
} catch (InvalidPath &) {
tryNext();
return;
} catch (SubstituterDisabled &) {
if (settings.tryFallback) {
tryNext();
return;
}
throw;
} catch (Error & e) {
if (settings.tryFallback) {
logError(e.info());
tryNext();
return;
if (!subError.has_value()) {
subError = std::move(e);
}
throw;
tryNext();
return;
}

if (info->path != storePath) {
Expand Down
5 changes: 5 additions & 0 deletions src/libstore/build/substitution-goal.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ struct PathSubstitutionGoal : public Goal
*/
std::optional<StorePath> subPath;

/**
* The first error we came across while substituting.
*/
std::optional<Error> subError;

/**
* The remaining substituters.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/libstore/http-binary-cache-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class HttpBinaryCacheStore : public virtual HttpBinaryCacheStoreConfig, public v
void maybeDisable()
{
auto state(_state.lock());
if (state->enabled && settings.tryFallback) {
if (state->enabled) {
int t = 60;
printError("disabling binary cache '%s' for %s seconds", getUri(), t);
state->enabled = false;
Expand Down
5 changes: 1 addition & 4 deletions src/libstore/store-api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -592,10 +592,7 @@ void Store::querySubstitutablePathInfos(const StorePathCAMap & paths, Substituta
} catch (InvalidPath &) {
} catch (SubstituterDisabled &) {
} catch (Error & e) {
if (settings.tryFallback)
logError(e.info());
else
throw;
logError(e.info());
}
}
}
Expand Down