fix(agent/agentscripts): display informative error for ErrWaitDelay (#10407)

Fixes #10400
This commit is contained in:
Mathias Fredriksson
2023-10-27 19:07:26 +03:00
committed by GitHub
parent 99fda4a8e2
commit 7fecd39e23
2 changed files with 26 additions and 2 deletions
+2 -1
View File
@@ -743,7 +743,7 @@ func (a *agent) run(ctx context.Context) error {
return script.RunOnStart
})
if err != nil {
a.logger.Warn(ctx, "startup script failed", slog.Error(err))
a.logger.Warn(ctx, "startup script(s) failed", slog.Error(err))
if errors.Is(err, agentscripts.ErrTimeout) {
a.setLifecycle(ctx, codersdk.WorkspaceAgentLifecycleStartTimeout)
} else {
@@ -1465,6 +1465,7 @@ func (a *agent) Close() error {
return script.RunOnStop
})
if err != nil {
a.logger.Warn(ctx, "shutdown script(s) failed", slog.Error(err))
if errors.Is(err, agentscripts.ErrTimeout) {
lifecycleState = codersdk.WorkspaceAgentLifecycleShutdownTimeout
} else {