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()")