Sandbox: Fix/enhance error messages for Create

CreateSandbox states "failed to start sandbox". This is quite confusing
when you're perusing logs and trying to pinpoint how far a shim got in
its execution.

Signed-off-by: Danny Canter <danny@dcantah.dev>
This commit is contained in:
Danny Canter 2023-03-04 01:11:21 -08:00
parent 1e0e909dcc
commit 6b4b6956e3

View File

@ -102,9 +102,8 @@ func (c *controllerLocal) Create(ctx context.Context, sandboxID string, opts ...
Runtime: info.Runtime.Name,
TaskOptions: nil,
})
if err != nil {
return fmt.Errorf("failed to start new sandbox: %w", err)
return fmt.Errorf("failed to start new shim for sandbox %s: %w", sandboxID, err)
}
svc, err := sandbox.NewClient(shim.Client())
@ -127,7 +126,7 @@ func (c *controllerLocal) Create(ctx context.Context, sandboxID string, opts ...
Options: options,
}); err != nil {
// TODO: Delete sandbox shim here.
return fmt.Errorf("failed to start sandbox %s: %w", sandboxID, errdefs.FromGRPC(err))
return fmt.Errorf("failed to create sandbox %s: %w", sandboxID, errdefs.FromGRPC(err))
}
return nil