Don't copy in rethrow

This commit is contained in:
Eelco Dolstra 2021-09-27 14:35:55 +02:00
parent 4b2b151131
commit 8430a8f086
3 changed files with 8 additions and 8 deletions

View file

@ -125,7 +125,7 @@ static void import(EvalState & state, const Pos & pos, Value & vPath, Value * vS
}); });
} catch (Error & e) { } catch (Error & e) {
e.addTrace(pos, "while importing '%s'", path); e.addTrace(pos, "while importing '%s'", path);
throw e; throw;
} }
Path realPath = state.checkSourcePath(state.toRealPath(path, context)); Path realPath = state.checkSourcePath(state.toRealPath(path, context));
@ -579,7 +579,7 @@ static Bindings::iterator getAttr(
// Adding another trace for the function name to make it clear // Adding another trace for the function name to make it clear
// which call received wrong arguments. // which call received wrong arguments.
e.addTrace(pos, hintfmt("while invoking '%s'", funcName)); e.addTrace(pos, hintfmt("while invoking '%s'", funcName));
throw e; throw;
} }
} }
@ -1717,7 +1717,7 @@ static void prim_fromJSON(EvalState & state, const Pos & pos, Value * * args, Va
parseJSON(state, s, v); parseJSON(state, s, v);
} catch (JSONParseError &e) { } catch (JSONParseError &e) {
e.addTrace(pos, "while decoding a JSON string"); e.addTrace(pos, "while decoding a JSON string");
throw e; throw;
} }
} }
@ -2902,7 +2902,7 @@ static void prim_concatMap(EvalState & state, const Pos & pos, Value * * args, V
state.forceList(lists[n], lists[n].determinePos(args[0]->determinePos(pos))); state.forceList(lists[n], lists[n].determinePos(args[0]->determinePos(pos)));
} catch (TypeError &e) { } catch (TypeError &e) {
e.addTrace(pos, hintfmt("while invoking '%s'", "concatMap")); e.addTrace(pos, hintfmt("while invoking '%s'", "concatMap"));
throw e; throw;
} }
len += lists[n].listSize(); len += lists[n].listSize();
} }

View file

@ -1009,7 +1009,7 @@ HookReply DerivationGoal::tryBuildHook()
return readLine(worker.hook->fromHook.readSide.get()); return readLine(worker.hook->fromHook.readSide.get());
} catch (Error & e) { } catch (Error & e) {
e.addTrace({}, "while reading the response from the build hook"); e.addTrace({}, "while reading the response from the build hook");
throw e; throw;
} }
}(); }();
if (handleJSONLogMessage(s, worker.act, worker.hook->activities, true)) if (handleJSONLogMessage(s, worker.act, worker.hook->activities, true))
@ -1055,7 +1055,7 @@ HookReply DerivationGoal::tryBuildHook()
machineName = readLine(hook->fromHook.readSide.get()); machineName = readLine(hook->fromHook.readSide.get());
} catch (Error & e) { } catch (Error & e) {
e.addTrace({}, "while reading the machine name from the build hook"); e.addTrace({}, "while reading the machine name from the build hook");
throw e; throw;
} }
/* Tell the hook all the inputs that have to be copied to the /* Tell the hook all the inputs that have to be copied to the

View file

@ -943,7 +943,7 @@ void LocalDerivationGoal::startBuilder()
worker.store.printStorePath(drvPath), worker.store.printStorePath(drvPath),
statusToString(status), statusToString(status),
concatStringsSep("|", msgs)); concatStringsSep("|", msgs));
throw e; throw;
} }
}(); }();
if (string(msg, 0, 1) == "\2") break; if (string(msg, 0, 1) == "\2") break;
@ -951,7 +951,7 @@ void LocalDerivationGoal::startBuilder()
FdSource source(builderOut.readSide.get()); FdSource source(builderOut.readSide.get());
auto ex = readError(source); auto ex = readError(source);
ex.addTrace({}, "while setting up the build environment"); ex.addTrace({}, "while setting up the build environment");
throw ex; throw;
} }
debug("sandbox setup: " + msg); debug("sandbox setup: " + msg);
msgs.push_back(std::move(msg)); msgs.push_back(std::move(msg));