From 5f7db0b4d0d01ba8725839a9cc7065882f5791c0 Mon Sep 17 00:00:00 2001 From: Matthew Rich Date: Sun, 26 May 2024 02:14:16 -0700 Subject: [PATCH] fix lint errors --- internal/resource/container_image.go | 8 ++++++-- internal/resource/declaration.go | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/internal/resource/container_image.go b/internal/resource/container_image.go index e6e8313..77596de 100644 --- a/internal/resource/container_image.go +++ b/internal/resource/container_image.go @@ -278,10 +278,14 @@ func (c *ContainerImage) ResolveId(ctx context.Context) string { slog.Info("ContainerImage.ResolveId()", "name", c.Name, "machine.state", c.StateMachine().CurrentState(), "resource.state", c.State) c.Id = imageInspect.ID if c.Id != "" { - c.StateMachine().Trigger("exists") + if triggerErr := c.StateMachine().Trigger("exists"); triggerErr != nil { + panic(fmt.Errorf("%w: %s %s", triggerErr, c.Type(), c.Name)) + } slog.Info("ContainerImage.ResolveId() trigger created", "machine", c.StateMachine(), "state", c.StateMachine().CurrentState()) } else { - c.StateMachine().Trigger("notexists") + if triggerErr := c.StateMachine().Trigger("notexists"); triggerErr != nil { + panic(fmt.Errorf("%w: %s %s", triggerErr, c.Type(), c.Name)) + } slog.Info("ContainerImage.ResolveId()", "name", c.Name, "machine.state", c.StateMachine().CurrentState(), "resource.state", c.State) } return c.Id diff --git a/internal/resource/declaration.go b/internal/resource/declaration.go index 4d81b57..5169f41 100644 --- a/internal/resource/declaration.go +++ b/internal/resource/declaration.go @@ -42,7 +42,9 @@ func (d *Declaration) ResolveId(ctx context.Context) string { defer func() { if r := recover(); r != nil { slog.Info("Declaration.ResolveId() - panic", "recover", r, "state", d.Attributes.StateMachine()) - d.Attributes.StateMachine().Trigger("notexists") + if triggerErr := d.Attributes.StateMachine().Trigger("notexists"); triggerErr != nil { + panic(triggerErr) + } } }() slog.Info("Declaration.ResolveId()")