mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-23 09:18:51 +02:00
fix(docker): improve error handling for missing Docker agent
Replaced panic with an error return in the NewClient
This commit is contained in:
@@ -152,7 +152,7 @@ func NewClient(cfg types.DockerProviderConfig, unique ...bool) (*SharedClient, e
|
|||||||
if agent.IsDockerHostAgent(host) {
|
if agent.IsDockerHostAgent(host) {
|
||||||
a, ok := agentpool.Get(host)
|
a, ok := agentpool.Get(host)
|
||||||
if !ok {
|
if !ok {
|
||||||
panic(fmt.Errorf("agent %q not found", host))
|
return nil, fmt.Errorf("agent %q not found", host)
|
||||||
}
|
}
|
||||||
opt = []client.Opt{
|
opt = []client.Opt{
|
||||||
client.WithHost(agent.DockerHost),
|
client.WithHost(agent.DockerHost),
|
||||||
|
|||||||
Reference in New Issue
Block a user