Merge pull request #139 from dagger/canceled-error-message
logs: clean up logs for canceled tasks
This commit is contained in:
commit
dce79f0a3e
@ -3,6 +3,7 @@ package dagger
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"cuelang.org/go/cue"
|
"cuelang.org/go/cue"
|
||||||
@ -297,18 +298,26 @@ func newPipelineTaskFunc(ctx context.Context, inst *cue.Instance, s Solver) cuef
|
|||||||
p := NewPipeline(t.Path().String(), s, NewFillable(t))
|
p := NewPipeline(t.Path().String(), s, NewFillable(t))
|
||||||
err := p.Do(ctx, v)
|
err := p.Do(ctx, v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// FIXME: this should use errdefs.IsCanceled(err)
|
||||||
|
if strings.Contains(err.Error(), "context canceled") {
|
||||||
|
lg.
|
||||||
|
Error().
|
||||||
|
Dur("duration", time.Since(start)).
|
||||||
|
Msg("canceled")
|
||||||
|
return err
|
||||||
|
}
|
||||||
lg.
|
lg.
|
||||||
Error().
|
Error().
|
||||||
Dur("duration", time.Since(start)).
|
Dur("duration", time.Since(start)).
|
||||||
Err(err).
|
Err(err).
|
||||||
Msg("failed")
|
Msg("failed")
|
||||||
} else {
|
return err
|
||||||
lg.
|
|
||||||
Info().
|
|
||||||
Dur("duration", time.Since(start)).
|
|
||||||
Msg("completed")
|
|
||||||
}
|
}
|
||||||
return err
|
lg.
|
||||||
|
Info().
|
||||||
|
Dur("duration", time.Since(start)).
|
||||||
|
Msg("completed")
|
||||||
|
return nil
|
||||||
}), nil
|
}), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user