From 131deab2cf292f1246109f5e2e2e14b35bdc3ca6 Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Thu, 7 Apr 2022 10:38:22 +0200 Subject: [PATCH 1/2] improve runtime connect error messages --- ocis/pkg/command/kill.go | 2 +- ocis/pkg/command/list.go | 2 +- ocis/pkg/command/run.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ocis/pkg/command/kill.go b/ocis/pkg/command/kill.go index 853acdd715d..03f2d52a36e 100644 --- a/ocis/pkg/command/kill.go +++ b/ocis/pkg/command/kill.go @@ -35,7 +35,7 @@ func KillCommand(cfg *config.Config) *cli.Command { Action: func(c *cli.Context) error { client, err := rpc.DialHTTP("tcp", net.JoinHostPort(cfg.Runtime.Host, cfg.Runtime.Port)) if err != nil { - log.Fatal("dialing:", err) + log.Fatalf("Failed to connect to the runtime. Is the runtime running and did you configure the right runtime address (\"%s\")", cfg.Runtime.Host+":"+cfg.Runtime.Port) } var arg1 int diff --git a/ocis/pkg/command/list.go b/ocis/pkg/command/list.go index c7fd1558710..a4223f48004 100644 --- a/ocis/pkg/command/list.go +++ b/ocis/pkg/command/list.go @@ -34,7 +34,7 @@ func ListCommand(cfg *config.Config) *cli.Command { Action: func(c *cli.Context) error { client, err := rpc.DialHTTP("tcp", net.JoinHostPort(cfg.Runtime.Host, cfg.Runtime.Port)) if err != nil { - log.Fatal("dialing:", err) + log.Fatalf("Failed to connect to the runtime. Is the runtime running and did you configure the right runtime address (\"%s\")", cfg.Runtime.Host+":"+cfg.Runtime.Port) } var arg1 string diff --git a/ocis/pkg/command/run.go b/ocis/pkg/command/run.go index 1cab47a0d37..d48da69338e 100644 --- a/ocis/pkg/command/run.go +++ b/ocis/pkg/command/run.go @@ -36,7 +36,7 @@ func RunCommand(cfg *config.Config) *cli.Command { Action: func(c *cli.Context) error { client, err := rpc.DialHTTP("tcp", net.JoinHostPort(cfg.Runtime.Host, cfg.Runtime.Port)) if err != nil { - log.Fatal("dialing:", err) + log.Fatalf("Failed to connect to the runtime. Is the runtime running and did you configure the right runtime address (\"%s\")", cfg.Runtime.Host+":"+cfg.Runtime.Port) } var reply int From 5f500d3c0630b9e488b8901f16281d0c78de3d5d Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Fri, 8 Apr 2022 20:52:32 +0200 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Martin --- ocis/pkg/command/kill.go | 2 +- ocis/pkg/command/list.go | 2 +- ocis/pkg/command/run.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ocis/pkg/command/kill.go b/ocis/pkg/command/kill.go index 03f2d52a36e..51b8b426186 100644 --- a/ocis/pkg/command/kill.go +++ b/ocis/pkg/command/kill.go @@ -35,7 +35,7 @@ func KillCommand(cfg *config.Config) *cli.Command { Action: func(c *cli.Context) error { client, err := rpc.DialHTTP("tcp", net.JoinHostPort(cfg.Runtime.Host, cfg.Runtime.Port)) if err != nil { - log.Fatalf("Failed to connect to the runtime. Is the runtime running and did you configure the right runtime address (\"%s\")", cfg.Runtime.Host+":"+cfg.Runtime.Port) + log.Fatalf("Failed to connect to the runtime. Has the runtime been started and did you configure the right runtime address (\"%s\")", cfg.Runtime.Host+":"+cfg.Runtime.Port) } var arg1 int diff --git a/ocis/pkg/command/list.go b/ocis/pkg/command/list.go index a4223f48004..64a3f6d14d9 100644 --- a/ocis/pkg/command/list.go +++ b/ocis/pkg/command/list.go @@ -34,7 +34,7 @@ func ListCommand(cfg *config.Config) *cli.Command { Action: func(c *cli.Context) error { client, err := rpc.DialHTTP("tcp", net.JoinHostPort(cfg.Runtime.Host, cfg.Runtime.Port)) if err != nil { - log.Fatalf("Failed to connect to the runtime. Is the runtime running and did you configure the right runtime address (\"%s\")", cfg.Runtime.Host+":"+cfg.Runtime.Port) + log.Fatalf("Failed to connect to the runtime. Has the runtime been started and did you configure the right runtime address (\"%s\")", cfg.Runtime.Host+":"+cfg.Runtime.Port) } var arg1 string diff --git a/ocis/pkg/command/run.go b/ocis/pkg/command/run.go index d48da69338e..5259bdec51d 100644 --- a/ocis/pkg/command/run.go +++ b/ocis/pkg/command/run.go @@ -36,7 +36,7 @@ func RunCommand(cfg *config.Config) *cli.Command { Action: func(c *cli.Context) error { client, err := rpc.DialHTTP("tcp", net.JoinHostPort(cfg.Runtime.Host, cfg.Runtime.Port)) if err != nil { - log.Fatalf("Failed to connect to the runtime. Is the runtime running and did you configure the right runtime address (\"%s\")", cfg.Runtime.Host+":"+cfg.Runtime.Port) + log.Fatalf("Failed to connect to the runtime. Has the runtime been started and did you configure the right runtime address (\"%s\")", cfg.Runtime.Host+":"+cfg.Runtime.Port) } var reply int