From b6d092d81e779a15acbfbaf8acae1cdbd1a33d2b Mon Sep 17 00:00:00 2001 From: Maxime Lagresle Date: Tue, 28 Sep 2021 21:56:57 +0200 Subject: [PATCH] return an error instead of panicking when failing to get edge Signed-off-by: Maxime Lagresle --- solver/scheduler.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/solver/scheduler.go b/solver/scheduler.go index 8de4d694e4b4..d56b06c9f3eb 100644 --- a/solver/scheduler.go +++ b/solver/scheduler.go @@ -351,7 +351,9 @@ type pipeFactory struct { func (pf *pipeFactory) NewInputRequest(ee Edge, req *edgeRequest) pipe.Receiver { target := pf.s.ef.getEdge(ee) if target == nil { - panic("failed to get edge") // TODO: return errored pipe + return pf.NewFuncRequest(func(_ context.Context) (interface{}, error) { + return req, errors.Errorf("failed to get edge: inconsistent graph state") + }) } p := pf.s.newPipe(target, pf.e, pipe.Request{Payload: req}) if debugScheduler {