Skip to content

Commit 12c204b

Browse files
author
Valery Piashchynski
committed
Fix critical error with error hiding on first Serve run
1 parent b5ba265 commit 12c204b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

serve.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,20 @@ import (
99

1010
func (e *Endure) callServeFn(vertex *Vertex, in []reflect.Value) (*result, error) {
1111
const op = errors.Op("call_serve_fn")
12-
e.logger.Debug("preparing to serveInternal the vertex", zap.String("vertex id", vertex.ID))
12+
e.logger.Debug("preparing to calling Serve on the Vertex", zap.String("vertex id", vertex.ID))
13+
// find Serve method
1314
m, _ := reflect.TypeOf(vertex.Iface).MethodByName(ServeMethodName)
15+
// call with needed number of `in` parameters
1416
ret := m.Func.Call(in)
1517
res := ret[0].Interface()
18+
e.logger.Debug("called Serve on the vertex", zap.String("vertex id", vertex.ID))
1619
if res != nil {
17-
e.logger.Debug("called serveInternal on the vertex", zap.String("vertex id", vertex.ID))
1820
if e, ok := res.(chan error); ok && e != nil {
1921
// error come right after we start serving the vertex
2022
if len(e) > 0 {
21-
return nil, errors.E(op, errors.FunctionCall, errors.Errorf("got first run error from vertex %s, stopping execution", vertex.ID))
23+
// read the error
24+
err := <-e
25+
return nil, errors.E(op, errors.FunctionCall, errors.Errorf("got initial serve error from the Vertex %s, stopping execution, error: %v", vertex.ID, err))
2226
}
2327
return &result{
2428
errCh: e,

0 commit comments

Comments
 (0)