mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-24 18:11:19 +01:00
tweak(docker): add hint when specified network not found
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/yusing/go-proxy/agent/pkg/agent"
|
||||
config "github.com/yusing/go-proxy/internal/config/types"
|
||||
"github.com/yusing/go-proxy/internal/gperr"
|
||||
idlewatcher "github.com/yusing/go-proxy/internal/idlewatcher/types"
|
||||
"github.com/yusing/go-proxy/internal/serialization"
|
||||
"github.com/yusing/go-proxy/internal/utils"
|
||||
@@ -247,7 +248,8 @@ func (c *Container) setPrivateHostname(helper containerHelper) {
|
||||
}
|
||||
}
|
||||
}
|
||||
c.addError(fmt.Errorf("%w: %s", ErrNetworkNotFound, c.Network))
|
||||
nearest := gperr.DoYouMean(utils.NearestField(c.Network, helper.NetworkSettings.Networks))
|
||||
c.addError(fmt.Errorf("network %q not found, %w", c.Network, nearest))
|
||||
return
|
||||
}
|
||||
// fallback to first network if no network is specified
|
||||
|
||||
Reference in New Issue
Block a user