Skip to content

Commit

Permalink
fix: incorrect logic for error handling (#72)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaukas Wang <[email protected]>
  • Loading branch information
gaukas authored Jun 24, 2024
1 parent b72fffc commit 8979246
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,14 +392,16 @@ 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)
}

if expFsCfg, ok := fsCfg.(expsysfs.FSConfig); ok {
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(
Expand Down

0 comments on commit 8979246

Please sign in to comment.