From 24572adc37fe7beec271681a29aa859291483751 Mon Sep 17 00:00:00 2001 From: Gaukas Wang Date: Mon, 24 Jun 2024 03:45:17 -0600 Subject: [PATCH] fix: incorrect logic for error handling Signed-off-by: Gaukas Wang --- core.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core.go b/core.go index 7fec75c..c2ac93c 100644 --- a/core.go +++ b/core.go @@ -392,7 +392,7 @@ func (c *core) Instantiate() (err error) { memFS := memfs.New() err := memFS.WriteFile("watm.cfg", c.config.TransportModuleConfig.AsBytes()) - if errors.Is(err, nil) || errors.Is(err, sys.Errno(0)) { + if !errors.Is(err, nil) && !errors.Is(err, sys.Errno(0)) { return fmt.Errorf("water: memFS.WriteFile returned error: %w", err) } @@ -400,6 +400,8 @@ func (c *core) Instantiate() (err error) { fsCfg = expFsCfg.WithSysFSMount(memFS, "/conf/") mc.SetFSConfig(fsCfg) } + } else { + log.LWarnf(c.config.Logger(), "water: TransportModuleConfig is not set, skipping...") } if c.instance, err = c.runtime.InstantiateModule(